@@ -2171,7 +2171,6 @@ struct pkg_data {
21712171 long long sam_mc6_ms ;
21722172 unsigned int sam_mhz ;
21732173 unsigned int sam_act_mhz ;
2174- unsigned int package_id ;
21752174 struct rapl_counter energy_pkg ; /* MSR_PKG_ENERGY_STATUS */
21762175 struct rapl_counter energy_dram ; /* MSR_DRAM_ENERGY_STATUS */
21772176 struct rapl_counter energy_cores ; /* MSR_PP0_ENERGY_STATUS */
@@ -2395,7 +2394,7 @@ struct platform_counters {
23952394} platform_counters_odd , platform_counters_even ;
23962395
23972396struct cpu_topology {
2398- int physical_package_id ;
2397+ int package_id ;
23992398 int die_id ;
24002399 int l3_id ;
24012400 int logical_cpu_id ;
@@ -2662,7 +2661,7 @@ unsigned int cpu_to_domain(const struct perf_counter_info *pc, int cpu)
26622661 return cpus [cpu ].physical_core_id ;
26632662
26642663 case SCOPE_PACKAGE :
2665- return cpus [cpu ].physical_package_id ;
2664+ return cpus [cpu ].package_id ;
26662665 }
26672666
26682667 __builtin_unreachable ();
@@ -3199,8 +3198,6 @@ int dump_counters(PER_THREAD_PARAMS)
31993198 }
32003199
32013200 if (p && is_cpu_first_core_in_package (t , p )) {
3202- outp += sprintf (outp , "package: %d\n" , p -> package_id );
3203-
32043201 outp += sprintf (outp , "Weighted cores: %016llX\n" , p -> pkg_wtd_core_c0 );
32053202 outp += sprintf (outp , "Any cores: %016llX\n" , p -> pkg_any_core_c0 );
32063203 outp += sprintf (outp , "Any GFX: %016llX\n" , p -> pkg_any_gfxe_c0 );
@@ -3366,7 +3363,7 @@ int format_counters(PER_THREAD_PARAMS)
33663363 } else {
33673364 if (DO_BIC (BIC_Package )) {
33683365 if (p )
3369- outp += sprintf (outp , "%s%d" , (printed ++ ? delim : "" ), p -> package_id );
3366+ outp += sprintf (outp , "%s%d" , (printed ++ ? delim : "" ), cpus [ t -> cpu_id ]. package_id );
33703367 else
33713368 outp += sprintf (outp , "%s-" , (printed ++ ? delim : "" ));
33723369 }
@@ -5180,11 +5177,11 @@ static inline int get_rapl_domain_id(int cpu)
51805177 int rapl_core_id ;
51815178
51825179 if (!platform -> has_per_core_rapl )
5183- return cpus [cpu ].physical_package_id ;
5180+ return cpus [cpu ].package_id ;
51845181
51855182 /* Compute the system-wide unique core-id for @cpu */
51865183 rapl_core_id = cpus [cpu ].physical_core_id ;
5187- rapl_core_id += cpus [cpu ].physical_package_id * nr_cores_per_package ;
5184+ rapl_core_id += cpus [cpu ].package_id * nr_cores_per_package ;
51885185
51895186 return rapl_core_id ;
51905187}
@@ -5328,7 +5325,7 @@ int get_counters(PER_THREAD_PARAMS)
53285325 }
53295326
53305327 if (DO_BIC (BIC_UNCORE_MHZ ))
5331- p -> uncore_mhz = get_legacy_uncore_mhz (p -> package_id );
5328+ p -> uncore_mhz = get_legacy_uncore_mhz (cpus [ t -> cpu_id ]. package_id );
53325329
53335330 if (DO_BIC (BIC_GFX_rc6 ))
53345331 p -> gfx_rc6_ms = gfx_info [GFX_rc6 ].val_ull ;
@@ -5352,9 +5349,9 @@ int get_counters(PER_THREAD_PARAMS)
53525349 char * path = NULL ;
53535350
53545351 if (mp -> msr_num == 0 ) {
5355- path = find_sysfs_path_by_id (mp -> sp , p -> package_id );
5352+ path = find_sysfs_path_by_id (mp -> sp , cpus [ t -> cpu_id ]. package_id );
53565353 if (path == NULL ) {
5357- warnx ("%s: package_id %d not found" , __func__ , p -> package_id );
5354+ warnx ("%s: package_id %d not found" , __func__ , cpus [ t -> cpu_id ]. package_id );
53585355 return -10 ;
53595356 }
53605357 }
@@ -5366,7 +5363,7 @@ int get_counters(PER_THREAD_PARAMS)
53665363 return -10 ;
53675364
53685365 for (i = 0 , pp = sys .pmt_pp ; pp ; i ++ , pp = pp -> next )
5369- p -> pmt_counter [i ] = pmt_read_counter (pp , p -> package_id );
5366+ p -> pmt_counter [i ] = pmt_read_counter (pp , cpus [ t -> cpu_id ]. package_id );
53705367
53715368done :
53725369 gettimeofday (& t -> tv_end , (struct timezone * )NULL );
@@ -6050,7 +6047,7 @@ int cpu_is_first_core_in_package(int cpu)
60506047 return cpu == parse_int_file ("/sys/devices/system/cpu/cpu%d/topology/core_siblings_list" , cpu );
60516048}
60526049
6053- int get_physical_package_id (int cpu )
6050+ int get_package_id (int cpu )
60546051{
60556052 return parse_int_file ("/sys/devices/system/cpu/cpu%d/topology/physical_package_id" , cpu );
60566053}
@@ -6083,7 +6080,7 @@ void set_node_data(void)
60836080 for (pkg = 0 ; pkg < topo .num_packages ; pkg ++ ) {
60846081 lnode = 0 ;
60856082 for (cpu = 0 ; cpu <= topo .max_cpu_num ; ++ cpu ) {
6086- if (cpus [cpu ].physical_package_id != pkg )
6083+ if (cpus [cpu ].package_id != pkg )
60876084 continue ;
60886085 /* find a cpu with an unset logical_node_id */
60896086 if (cpus [cpu ].logical_node_id != -1 )
@@ -6096,7 +6093,7 @@ void set_node_data(void)
60966093 * the logical_node_id
60976094 */
60986095 for (cpux = cpu ; cpux <= topo .max_cpu_num ; cpux ++ ) {
6099- if ((cpus [cpux ].physical_package_id == pkg ) && (cpus [cpux ].physical_node_id == node )) {
6096+ if ((cpus [cpux ].package_id == pkg ) && (cpus [cpux ].physical_node_id == node )) {
61006097 cpus [cpux ].logical_node_id = lnode ;
61016098 cpu_count ++ ;
61026099 }
@@ -7206,7 +7203,7 @@ static void probe_intel_uncore_frequency_cluster(void)
72067203 }
72077204 for (i = uncore_max_id ; i >= 0 ; -- i ) {
72087205 int k , l ;
7209- int package_id , domain_id , cluster_id ;
7206+ int unc_pkg_id , domain_id , cluster_id ;
72107207 char name_buf [16 ];
72117208
72127209 sprintf (path_base , "/sys/devices/system/cpu/intel_uncore_frequency/uncore%02d" , i );
@@ -7215,7 +7212,7 @@ static void probe_intel_uncore_frequency_cluster(void)
72157212 err (1 , "%s: %s" , __func__ , path_base );
72167213
72177214 sprintf (path , "%s/package_id" , path_base );
7218- package_id = read_sysfs_int (path );
7215+ unc_pkg_id = read_sysfs_int (path );
72197216
72207217 sprintf (path , "%s/domain_id" , path_base );
72217218 domain_id = read_sysfs_int (path );
@@ -7238,7 +7235,7 @@ static void probe_intel_uncore_frequency_cluster(void)
72387235 */
72397236 if BIC_IS_ENABLED
72407237 (BIC_UNCORE_MHZ )
7241- add_counter (0 , path , name_buf , 0 , SCOPE_PACKAGE , COUNTER_K2M , FORMAT_AVERAGE , 0 , package_id );
7238+ add_counter (0 , path , name_buf , 0 , SCOPE_PACKAGE , COUNTER_K2M , FORMAT_AVERAGE , 0 , unc_pkg_id );
72427239
72437240 if (quiet )
72447241 continue ;
@@ -7247,7 +7244,7 @@ static void probe_intel_uncore_frequency_cluster(void)
72477244 k = read_sysfs_int (path );
72487245 sprintf (path , "%s/max_freq_khz" , path_base );
72497246 l = read_sysfs_int (path );
7250- fprintf (outf , "Uncore Frequency package%d domain%d cluster%d: %d - %d MHz " , package_id , domain_id , cluster_id , k / 1000 , l / 1000 );
7247+ fprintf (outf , "Uncore Frequency package%d domain%d cluster%d: %d - %d MHz " , unc_pkg_id , domain_id , cluster_id , k / 1000 , l / 1000 );
72517248
72527249 sprintf (path , "%s/initial_min_freq_khz" , path_base );
72537250 k = read_sysfs_int (path );
@@ -8952,7 +8949,7 @@ void cstate_perf_init_(bool soft_c1)
89528949 continue ;
89538950
89548951 const int core_id = cpus [cpu ].physical_core_id ;
8955- const int pkg_id = cpus [cpu ].physical_package_id ;
8952+ const int pkg_id = cpus [cpu ].package_id ;
89568953
89578954 assert (core_id < cores_visited_elems );
89588955 assert (pkg_id < pkg_visited_elems );
@@ -9612,9 +9609,9 @@ void topology_probe(bool startup)
96129609 cpus [i ].logical_cpu_id = i ;
96139610
96149611 /* get package information */
9615- cpus [i ].physical_package_id = get_physical_package_id (i );
9616- if (cpus [i ].physical_package_id > max_package_id )
9617- max_package_id = cpus [i ].physical_package_id ;
9612+ cpus [i ].package_id = get_package_id (i );
9613+ if (cpus [i ].package_id > max_package_id )
9614+ max_package_id = cpus [i ].package_id ;
96189615
96199616 /* get die information */
96209617 cpus [i ].die_id = get_die_id (i );
@@ -9685,7 +9682,7 @@ void topology_probe(bool startup)
96859682 continue ;
96869683 fprintf (outf ,
96879684 "cpu %d pkg %d die %d l3 %d node %d lnode %d core %d thread %d\n" ,
9688- i , cpus [i ].physical_package_id , cpus [i ].die_id , cpus [i ].l3_id ,
9685+ i , cpus [i ].package_id , cpus [i ].die_id , cpus [i ].l3_id ,
96899686 cpus [i ].physical_node_id , cpus [i ].logical_node_id , cpus [i ].physical_core_id , cpus [i ].thread_id );
96909687 }
96919688
@@ -9717,10 +9714,8 @@ void allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_
97179714 if (* p == NULL )
97189715 goto error ;
97199716
9720- for (i = 0 ; i < topo .num_packages ; i ++ ) {
9721- (* p )[i ].package_id = i ;
9717+ for (i = 0 ; i < topo .num_packages ; i ++ )
97229718 (* p )[i ].first_cpu = -1 ;
9723- }
97249719
97259720 return ;
97269721error :
@@ -9734,7 +9729,7 @@ void allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_
97349729 */
97359730void init_counter (struct thread_data * thread_base , struct core_data * core_base , struct pkg_data * pkg_base , int cpu_id )
97369731{
9737- int pkg_id = cpus [cpu_id ].physical_package_id ;
9732+ int pkg_id = cpus [cpu_id ].package_id ;
97389733 int node_id = cpus [cpu_id ].logical_node_id ;
97399734 int core_id = cpus [cpu_id ].physical_core_id ;
97409735 int thread_id = cpus [cpu_id ].thread_id ;
@@ -9760,7 +9755,6 @@ void init_counter(struct thread_data *thread_base, struct core_data *core_base,
97609755 }
97619756
97629757 c -> core_id = core_id ;
9763- pkg_base [pkg_id ].package_id = pkg_id ;
97649758}
97659759
97669760int initialize_counters (int cpu_id )
0 commit comments