]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
tools/power turbostat: Delete core_data.core_id
authorLen Brown <len.brown@intel.com>
Sun, 8 Feb 2026 15:34:34 +0000 (09:34 -0600)
committerLen Brown <len.brown@intel.com>
Fri, 13 Feb 2026 14:53:17 +0000 (08:53 -0600)
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>
tools/power/x86/turbostat/turbostat.c

index 9f93efafbf942f777652a1c7b8b4eb3b4845b1ad..af6338460320f1ac4af4cfc5171649bab50eec87 100644 (file)
@@ -2143,7 +2143,6 @@ struct core_data {
        unsigned long long mc6_us;      /* duplicate as per-core for now, even though per module */
        unsigned int core_temp_c;
        struct rapl_counter core_energy;        /* MSR_CORE_ENERGY_STAT */
-       unsigned int core_id;
        unsigned long long core_throt_cnt;
        unsigned long long counter[MAX_ADDED_CORE_COUNTERS];
        unsigned long long perf_counter[MAX_ADDED_CORE_COUNTERS];
@@ -3178,7 +3177,7 @@ int dump_counters(PER_THREAD_PARAMS)
        }
 
        if (c && is_cpu_first_thread_in_core(t, c)) {
-               outp += sprintf(outp, "core: %d\n", c->core_id);
+               outp += sprintf(outp, "core: %d\n", cpus[t->cpu_id].core_id);
                outp += sprintf(outp, "c3: %016llX\n", c->c3);
                outp += sprintf(outp, "c6: %016llX\n", c->c6);
                outp += sprintf(outp, "c7: %016llX\n", c->c7);
@@ -3387,7 +3386,7 @@ int format_counters(PER_THREAD_PARAMS)
                }
                if (DO_BIC(BIC_Core)) {
                        if (c)
-                               outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), c->core_id);
+                               outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), cpus[t->cpu_id].core_id);
                        else
                                outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
                }
@@ -5284,7 +5283,7 @@ int get_counters(PER_THREAD_PARAMS)
                return -10;
 
        for (i = 0, pp = sys.pmt_cp; pp; i++, pp = pp->next)
-               c->pmt_counter[i] = pmt_read_counter(pp, c->core_id);
+               c->pmt_counter[i] = pmt_read_counter(pp, cpus[t->cpu_id].core_id);
 
        /* collect package counters only for 1st core in package */
        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_
        if (*c == NULL)
                goto error;
 
-       for (i = 0; i < num_cores; i++) {
-               (*c)[i].core_id = -1;
+       for (i = 0; i < num_cores; i++)
                (*c)[i].first_cpu = -1;
-       }
 
        *p = calloc(topo.num_packages, sizeof(struct pkg_data));
        if (*p == NULL)
@@ -9753,8 +9750,6 @@ void init_counter(struct thread_data *thread_base, struct core_data *core_base,
                if (pkg_base[pkg_id].first_cpu < 0)
                        pkg_base[pkg_id].first_cpu = t->cpu_id;
        }
-
-       c->core_id = core_id;
 }
 
 int initialize_counters(int cpu_id)