Skip to content

Commit 70a9c6e

Browse files
praritlenb
authored andcommitted
tools/power turbostat: remove num_ from cpu_topology struct
Cleanup, remove num_ from num_nodes_per_pkg, num_cores_per_node, and num_threads_per_node. Signed-off-by: Prarit Bhargava <[email protected]> Signed-off-by: Len Brown <[email protected]>
1 parent 139dd0e commit 70a9c6e

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ struct pkg_data {
217217
#define EVEN_COUNTERS thread_even, core_even, package_even
218218

219219
#define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \
220-
(thread_base + (pkg_no) * topo.num_cores_per_node * \
221-
topo.num_threads_per_core + \
222-
(core_no) * topo.num_threads_per_core + (thread_no))
220+
(thread_base + (pkg_no) * topo.cores_per_node * \
221+
topo.threads_per_core + \
222+
(core_no) * topo.threads_per_core + (thread_no))
223223
#define GET_CORE(core_base, core_no, pkg_no) \
224-
(core_base + (pkg_no) * topo.num_cores_per_node + (core_no))
224+
(core_base + (pkg_no) * topo.cores_per_node + (core_no))
225225
#define GET_PKG(pkg_base, pkg_no) (pkg_base + pkg_no)
226226

227227
enum counter_scope {SCOPE_CPU, SCOPE_CORE, SCOPE_PACKAGE};
@@ -273,9 +273,9 @@ struct topo_params {
273273
int num_cores;
274274
int max_cpu_num;
275275
int max_node_num;
276-
int num_nodes_per_pkg;
277-
int num_cores_per_node;
278-
int num_threads_per_core;
276+
int nodes_per_pkg;
277+
int cores_per_node;
278+
int threads_per_core;
279279
} topo;
280280

281281
struct timeval tv_even, tv_odd, tv_delta;
@@ -300,10 +300,9 @@ int for_all_cpus(int (func)(struct thread_data *, struct core_data *, struct pkg
300300
int retval, pkg_no, core_no, thread_no;
301301

302302
for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) {
303-
for (core_no = 0; core_no < topo.num_cores_per_node;
304-
++core_no) {
303+
for (core_no = 0; core_no < topo.cores_per_node; ++core_no) {
305304
for (thread_no = 0; thread_no <
306-
topo.num_threads_per_core; ++thread_no) {
305+
topo.threads_per_core; ++thread_no) {
307306
struct thread_data *t;
308307
struct core_data *c;
309308
struct pkg_data *p;
@@ -2401,8 +2400,8 @@ void set_node_data(void)
24012400
}
24022401

24032402
for (pkg = 0; pkg < topo.num_packages; pkg++)
2404-
if (pni[pkg].count > topo.num_nodes_per_pkg)
2405-
topo.num_nodes_per_pkg = pni[0].count;
2403+
if (pni[pkg].count > topo.nodes_per_pkg)
2404+
topo.nodes_per_pkg = pni[0].count;
24062405

24072406
for (cpu = 0; cpu < topo.num_cpus; cpu++) {
24082407
pkg = cpus[cpu].physical_package_id;
@@ -2492,10 +2491,9 @@ int for_all_cpus_2(int (func)(struct thread_data *, struct core_data *,
24922491
int retval, pkg_no, core_no, thread_no;
24932492

24942493
for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) {
2495-
for (core_no = 0; core_no < topo.num_cores_per_node;
2496-
++core_no) {
2494+
for (core_no = 0; core_no < topo.cores_per_node; ++core_no) {
24972495
for (thread_no = 0; thread_no <
2498-
topo.num_threads_per_core; ++thread_no) {
2496+
topo.threads_per_core; ++thread_no) {
24992497
struct thread_data *t, *t2;
25002498
struct core_data *c, *c2;
25012499
struct pkg_data *p, *p2;
@@ -4730,11 +4728,11 @@ void topology_probe()
47304728
cpus[i].thread_id);
47314729
}
47324730

4733-
topo.num_cores_per_node = max_core_id + 1;
4731+
topo.cores_per_node = max_core_id + 1;
47344732
if (debug > 1)
47354733
fprintf(outf, "max_core_id %d, sizing for %d cores per package\n",
4736-
max_core_id, topo.num_cores_per_node);
4737-
if (!summary_only && topo.num_cores_per_node > 1)
4734+
max_core_id, topo.cores_per_node);
4735+
if (!summary_only && topo.cores_per_node > 1)
47384736
BIC_PRESENT(BIC_Core);
47394737

47404738
topo.num_packages = max_package_id + 1;
@@ -4746,9 +4744,9 @@ void topology_probe()
47464744

47474745
set_node_data();
47484746
if (debug > 1)
4749-
fprintf(outf, "num_nodes_per_pkg %d\n", topo.num_nodes_per_pkg);
4747+
fprintf(outf, "nodes_per_pkg %d\n", topo.nodes_per_pkg);
47504748

4751-
topo.num_threads_per_core = max_siblings;
4749+
topo.threads_per_core = max_siblings;
47524750
if (debug > 1)
47534751
fprintf(outf, "max_siblings %d\n", max_siblings);
47544752
}
@@ -4758,21 +4756,21 @@ allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_data
47584756
{
47594757
int i;
47604758

4761-
*t = calloc(topo.num_threads_per_core * topo.num_cores_per_node *
4759+
*t = calloc(topo.threads_per_core * topo.cores_per_node *
47624760
topo.num_packages, sizeof(struct thread_data));
47634761
if (*t == NULL)
47644762
goto error;
47654763

4766-
for (i = 0; i < topo.num_threads_per_core *
4767-
topo.num_cores_per_node * topo.num_packages; i++)
4764+
for (i = 0; i < topo.threads_per_core *
4765+
topo.cores_per_node * topo.num_packages; i++)
47684766
(*t)[i].cpu_id = -1;
47694767

4770-
*c = calloc(topo.num_cores_per_node * topo.num_packages,
4768+
*c = calloc(topo.cores_per_node * topo.num_packages,
47714769
sizeof(struct core_data));
47724770
if (*c == NULL)
47734771
goto error;
47744772

4775-
for (i = 0; i < topo.num_cores_per_node * topo.num_packages; i++)
4773+
for (i = 0; i < topo.cores_per_node * topo.num_packages; i++)
47764774
(*c)[i].core_id = -1;
47774775

47784776
*p = calloc(topo.num_packages, sizeof(struct pkg_data));

0 commit comments

Comments
 (0)