diff options
author | Prarit Bhargava <prarit@redhat.com> | 2018-06-01 10:04:33 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2018-06-01 23:12:47 -0400 |
commit | 70a9c6e8ed28d974f10251920ccc0ce22f69afa2 (patch) | |
tree | 10326701ce5b52689aec3d90ffd8770457db9eb8 | |
parent | 139dd0e07c1c116949aed75c2c067873c6f91e50 (diff) |
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 <prarit@redhat.com>
Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 154c55530671..fa7e836cdfef 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -217,11 +217,11 @@ struct pkg_data { | |||
217 | #define EVEN_COUNTERS thread_even, core_even, package_even | 217 | #define EVEN_COUNTERS thread_even, core_even, package_even |
218 | 218 | ||
219 | #define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \ | 219 | #define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \ |
220 | (thread_base + (pkg_no) * topo.num_cores_per_node * \ | 220 | (thread_base + (pkg_no) * topo.cores_per_node * \ |
221 | topo.num_threads_per_core + \ | 221 | topo.threads_per_core + \ |
222 | (core_no) * topo.num_threads_per_core + (thread_no)) | 222 | (core_no) * topo.threads_per_core + (thread_no)) |
223 | #define GET_CORE(core_base, core_no, pkg_no) \ | 223 | #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)) |
225 | #define GET_PKG(pkg_base, pkg_no) (pkg_base + pkg_no) | 225 | #define GET_PKG(pkg_base, pkg_no) (pkg_base + pkg_no) |
226 | 226 | ||
227 | enum counter_scope {SCOPE_CPU, SCOPE_CORE, SCOPE_PACKAGE}; | 227 | enum counter_scope {SCOPE_CPU, SCOPE_CORE, SCOPE_PACKAGE}; |
@@ -273,9 +273,9 @@ struct topo_params { | |||
273 | int num_cores; | 273 | int num_cores; |
274 | int max_cpu_num; | 274 | int max_cpu_num; |
275 | int max_node_num; | 275 | int max_node_num; |
276 | int num_nodes_per_pkg; | 276 | int nodes_per_pkg; |
277 | int num_cores_per_node; | 277 | int cores_per_node; |
278 | int num_threads_per_core; | 278 | int threads_per_core; |
279 | } topo; | 279 | } topo; |
280 | 280 | ||
281 | struct timeval tv_even, tv_odd, tv_delta; | 281 | 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 | |||
300 | int retval, pkg_no, core_no, thread_no; | 300 | int retval, pkg_no, core_no, thread_no; |
301 | 301 | ||
302 | for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) { | 302 | for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) { |
303 | for (core_no = 0; core_no < topo.num_cores_per_node; | 303 | for (core_no = 0; core_no < topo.cores_per_node; ++core_no) { |
304 | ++core_no) { | ||
305 | for (thread_no = 0; thread_no < | 304 | for (thread_no = 0; thread_no < |
306 | topo.num_threads_per_core; ++thread_no) { | 305 | topo.threads_per_core; ++thread_no) { |
307 | struct thread_data *t; | 306 | struct thread_data *t; |
308 | struct core_data *c; | 307 | struct core_data *c; |
309 | struct pkg_data *p; | 308 | struct pkg_data *p; |
@@ -2401,8 +2400,8 @@ void set_node_data(void) | |||
2401 | } | 2400 | } |
2402 | 2401 | ||
2403 | for (pkg = 0; pkg < topo.num_packages; pkg++) | 2402 | for (pkg = 0; pkg < topo.num_packages; pkg++) |
2404 | if (pni[pkg].count > topo.num_nodes_per_pkg) | 2403 | if (pni[pkg].count > topo.nodes_per_pkg) |
2405 | topo.num_nodes_per_pkg = pni[0].count; | 2404 | topo.nodes_per_pkg = pni[0].count; |
2406 | 2405 | ||
2407 | for (cpu = 0; cpu < topo.num_cpus; cpu++) { | 2406 | for (cpu = 0; cpu < topo.num_cpus; cpu++) { |
2408 | pkg = cpus[cpu].physical_package_id; | 2407 | pkg = cpus[cpu].physical_package_id; |
@@ -2492,10 +2491,9 @@ int for_all_cpus_2(int (func)(struct thread_data *, struct core_data *, | |||
2492 | int retval, pkg_no, core_no, thread_no; | 2491 | int retval, pkg_no, core_no, thread_no; |
2493 | 2492 | ||
2494 | for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) { | 2493 | for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) { |
2495 | for (core_no = 0; core_no < topo.num_cores_per_node; | 2494 | for (core_no = 0; core_no < topo.cores_per_node; ++core_no) { |
2496 | ++core_no) { | ||
2497 | for (thread_no = 0; thread_no < | 2495 | for (thread_no = 0; thread_no < |
2498 | topo.num_threads_per_core; ++thread_no) { | 2496 | topo.threads_per_core; ++thread_no) { |
2499 | struct thread_data *t, *t2; | 2497 | struct thread_data *t, *t2; |
2500 | struct core_data *c, *c2; | 2498 | struct core_data *c, *c2; |
2501 | struct pkg_data *p, *p2; | 2499 | struct pkg_data *p, *p2; |
@@ -4730,11 +4728,11 @@ void topology_probe() | |||
4730 | cpus[i].thread_id); | 4728 | cpus[i].thread_id); |
4731 | } | 4729 | } |
4732 | 4730 | ||
4733 | topo.num_cores_per_node = max_core_id + 1; | 4731 | topo.cores_per_node = max_core_id + 1; |
4734 | if (debug > 1) | 4732 | if (debug > 1) |
4735 | fprintf(outf, "max_core_id %d, sizing for %d cores per package\n", | 4733 | fprintf(outf, "max_core_id %d, sizing for %d cores per package\n", |
4736 | max_core_id, topo.num_cores_per_node); | 4734 | max_core_id, topo.cores_per_node); |
4737 | if (!summary_only && topo.num_cores_per_node > 1) | 4735 | if (!summary_only && topo.cores_per_node > 1) |
4738 | BIC_PRESENT(BIC_Core); | 4736 | BIC_PRESENT(BIC_Core); |
4739 | 4737 | ||
4740 | topo.num_packages = max_package_id + 1; | 4738 | topo.num_packages = max_package_id + 1; |
@@ -4746,9 +4744,9 @@ void topology_probe() | |||
4746 | 4744 | ||
4747 | set_node_data(); | 4745 | set_node_data(); |
4748 | if (debug > 1) | 4746 | 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); |
4750 | 4748 | ||
4751 | topo.num_threads_per_core = max_siblings; | 4749 | topo.threads_per_core = max_siblings; |
4752 | if (debug > 1) | 4750 | if (debug > 1) |
4753 | fprintf(outf, "max_siblings %d\n", max_siblings); | 4751 | fprintf(outf, "max_siblings %d\n", max_siblings); |
4754 | } | 4752 | } |
@@ -4758,21 +4756,21 @@ allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_data | |||
4758 | { | 4756 | { |
4759 | int i; | 4757 | int i; |
4760 | 4758 | ||
4761 | *t = calloc(topo.num_threads_per_core * topo.num_cores_per_node * | 4759 | *t = calloc(topo.threads_per_core * topo.cores_per_node * |
4762 | topo.num_packages, sizeof(struct thread_data)); | 4760 | topo.num_packages, sizeof(struct thread_data)); |
4763 | if (*t == NULL) | 4761 | if (*t == NULL) |
4764 | goto error; | 4762 | goto error; |
4765 | 4763 | ||
4766 | for (i = 0; i < topo.num_threads_per_core * | 4764 | for (i = 0; i < topo.threads_per_core * |
4767 | topo.num_cores_per_node * topo.num_packages; i++) | 4765 | topo.cores_per_node * topo.num_packages; i++) |
4768 | (*t)[i].cpu_id = -1; | 4766 | (*t)[i].cpu_id = -1; |
4769 | 4767 | ||
4770 | *c = calloc(topo.num_cores_per_node * topo.num_packages, | 4768 | *c = calloc(topo.cores_per_node * topo.num_packages, |
4771 | sizeof(struct core_data)); | 4769 | sizeof(struct core_data)); |
4772 | if (*c == NULL) | 4770 | if (*c == NULL) |
4773 | goto error; | 4771 | goto error; |
4774 | 4772 | ||
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++) |
4776 | (*c)[i].core_id = -1; | 4774 | (*c)[i].core_id = -1; |
4777 | 4775 | ||
4778 | *p = calloc(topo.num_packages, sizeof(struct pkg_data)); | 4776 | *p = calloc(topo.num_packages, sizeof(struct pkg_data)); |