Skip to content

Commit cda2033

Browse files
committed
tools/power turbostat: Remember global max_die_id
This is necessary to gracefully handle sparse die_id's. no functional change Signed-off-by: Len Brown <[email protected]>
1 parent ae3326a commit cda2033

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,7 @@ struct topo_params {
14151415
int allowed_cpus;
14161416
int allowed_cores;
14171417
int max_cpu_num;
1418+
int max_die_id;
14181419
int max_node_num;
14191420
int nodes_per_pkg;
14201421
int cores_per_node;
@@ -6980,7 +6981,6 @@ void topology_probe(bool startup)
69806981
int i;
69816982
int max_core_id = 0;
69826983
int max_package_id = 0;
6983-
int max_die_id = 0;
69846984
int max_siblings = 0;
69856985

69866986
/* Initialize num_cpus, max_cpu_num */
@@ -7097,8 +7097,8 @@ void topology_probe(bool startup)
70977097

70987098
/* get die information */
70997099
cpus[i].die_id = get_die_id(i);
7100-
if (cpus[i].die_id > max_die_id)
7101-
max_die_id = cpus[i].die_id;
7100+
if (cpus[i].die_id > topo.max_die_id)
7101+
topo.max_die_id = cpus[i].die_id;
71027102

71037103
/* get numa node information */
71047104
cpus[i].physical_node_id = get_physical_node_id(&cpus[i]);
@@ -7124,9 +7124,9 @@ void topology_probe(bool startup)
71247124
if (!summary_only && topo.cores_per_node > 1)
71257125
BIC_PRESENT(BIC_Core);
71267126

7127-
topo.num_die = max_die_id + 1;
7127+
topo.num_die = topo.max_die_id + 1;
71287128
if (debug > 1)
7129-
fprintf(outf, "max_die_id %d, sizing for %d die\n", max_die_id, topo.num_die);
7129+
fprintf(outf, "max_die_id %d, sizing for %d die\n", topo.max_die_id, topo.num_die);
71307130
if (!summary_only && topo.num_die > 1)
71317131
BIC_PRESENT(BIC_Die);
71327132

0 commit comments

Comments
 (0)