Skip to content

Commit 439632c

Browse files
committed
tools/power turbostat: Delete core_data.core_id
Delete redundant core_data.core_id. Use cpus[].core_id as the single copy of the truth. No functional change. Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 5e16064 commit 439632c

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

tools/power/x86/turbostat/turbostat.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,6 @@ struct core_data {
21432143
unsigned long long mc6_us; /* duplicate as per-core for now, even though per module */
21442144
unsigned int core_temp_c;
21452145
struct rapl_counter core_energy; /* MSR_CORE_ENERGY_STAT */
2146-
unsigned int core_id;
21472146
unsigned long long core_throt_cnt;
21482147
unsigned long long counter[MAX_ADDED_CORE_COUNTERS];
21492148
unsigned long long perf_counter[MAX_ADDED_CORE_COUNTERS];
@@ -3178,7 +3177,7 @@ int dump_counters(PER_THREAD_PARAMS)
31783177
}
31793178

31803179
if (c && is_cpu_first_thread_in_core(t, c)) {
3181-
outp += sprintf(outp, "core: %d\n", c->core_id);
3180+
outp += sprintf(outp, "core: %d\n", cpus[t->cpu_id].core_id);
31823181
outp += sprintf(outp, "c3: %016llX\n", c->c3);
31833182
outp += sprintf(outp, "c6: %016llX\n", c->c6);
31843183
outp += sprintf(outp, "c7: %016llX\n", c->c7);
@@ -3387,7 +3386,7 @@ int format_counters(PER_THREAD_PARAMS)
33873386
}
33883387
if (DO_BIC(BIC_Core)) {
33893388
if (c)
3390-
outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), c->core_id);
3389+
outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), cpus[t->cpu_id].core_id);
33913390
else
33923391
outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
33933392
}
@@ -5284,7 +5283,7 @@ int get_counters(PER_THREAD_PARAMS)
52845283
return -10;
52855284

52865285
for (i = 0, pp = sys.pmt_cp; pp; i++, pp = pp->next)
5287-
c->pmt_counter[i] = pmt_read_counter(pp, c->core_id);
5286+
c->pmt_counter[i] = pmt_read_counter(pp, cpus[t->cpu_id].core_id);
52885287

52895288
/* collect package counters only for 1st core in package */
52905289
if (!is_cpu_first_core_in_package(t, p))
@@ -9705,10 +9704,8 @@ void allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_
97059704
if (*c == NULL)
97069705
goto error;
97079706

9708-
for (i = 0; i < num_cores; i++) {
9709-
(*c)[i].core_id = -1;
9707+
for (i = 0; i < num_cores; i++)
97109708
(*c)[i].first_cpu = -1;
9711-
}
97129709

97139710
*p = calloc(topo.num_packages, sizeof(struct pkg_data));
97149711
if (*p == NULL)
@@ -9753,8 +9750,6 @@ void init_counter(struct thread_data *thread_base, struct core_data *core_base,
97539750
if (pkg_base[pkg_id].first_cpu < 0)
97549751
pkg_base[pkg_id].first_cpu = t->cpu_id;
97559752
}
9756-
9757-
c->core_id = core_id;
97589753
}
97599754

97609755
int initialize_counters(int cpu_id)

0 commit comments

Comments
 (0)