Commit 139dd0e0 authored by Prarit Bhargava's avatar Prarit Bhargava Committed by Len Brown

tools/power turbostat: rename num_cores_per_pkg to num_cores_per_node

turbostat incorrectly assumes that there is one node per package.  As a
result num_cores_per_pkg is not correctly named and is actually
num_cores_per_node.

Rename num_cores_per_pkg to num_cores_per_node.
Signed-off-by: default avatarPrarit Bhargava <prarit@redhat.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 8cb48b32
...@@ -217,11 +217,11 @@ struct pkg_data { ...@@ -217,11 +217,11 @@ struct pkg_data {
#define EVEN_COUNTERS thread_even, core_even, package_even #define EVEN_COUNTERS thread_even, core_even, package_even
#define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \ #define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \
(thread_base + (pkg_no) * topo.num_cores_per_pkg * \ (thread_base + (pkg_no) * topo.num_cores_per_node * \
topo.num_threads_per_core + \ topo.num_threads_per_core + \
(core_no) * topo.num_threads_per_core + (thread_no)) (core_no) * topo.num_threads_per_core + (thread_no))
#define GET_CORE(core_base, core_no, pkg_no) \ #define GET_CORE(core_base, core_no, pkg_no) \
(core_base + (pkg_no) * topo.num_cores_per_pkg + (core_no)) (core_base + (pkg_no) * topo.num_cores_per_node + (core_no))
#define GET_PKG(pkg_base, pkg_no) (pkg_base + pkg_no) #define GET_PKG(pkg_base, pkg_no) (pkg_base + pkg_no)
enum counter_scope {SCOPE_CPU, SCOPE_CORE, SCOPE_PACKAGE}; enum counter_scope {SCOPE_CPU, SCOPE_CORE, SCOPE_PACKAGE};
...@@ -274,7 +274,7 @@ struct topo_params { ...@@ -274,7 +274,7 @@ struct topo_params {
int max_cpu_num; int max_cpu_num;
int max_node_num; int max_node_num;
int num_nodes_per_pkg; int num_nodes_per_pkg;
int num_cores_per_pkg; int num_cores_per_node;
int num_threads_per_core; int num_threads_per_core;
} topo; } topo;
...@@ -300,7 +300,8 @@ int for_all_cpus(int (func)(struct thread_data *, struct core_data *, struct pkg ...@@ -300,7 +300,8 @@ int for_all_cpus(int (func)(struct thread_data *, struct core_data *, struct pkg
int retval, pkg_no, core_no, thread_no; int retval, pkg_no, core_no, thread_no;
for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) { for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) {
for (core_no = 0; core_no < topo.num_cores_per_pkg; ++core_no) { for (core_no = 0; core_no < topo.num_cores_per_node;
++core_no) {
for (thread_no = 0; thread_no < for (thread_no = 0; thread_no <
topo.num_threads_per_core; ++thread_no) { topo.num_threads_per_core; ++thread_no) {
struct thread_data *t; struct thread_data *t;
...@@ -2491,7 +2492,8 @@ int for_all_cpus_2(int (func)(struct thread_data *, struct core_data *, ...@@ -2491,7 +2492,8 @@ int for_all_cpus_2(int (func)(struct thread_data *, struct core_data *,
int retval, pkg_no, core_no, thread_no; int retval, pkg_no, core_no, thread_no;
for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) { for (pkg_no = 0; pkg_no < topo.num_packages; ++pkg_no) {
for (core_no = 0; core_no < topo.num_cores_per_pkg; ++core_no) { for (core_no = 0; core_no < topo.num_cores_per_node;
++core_no) {
for (thread_no = 0; thread_no < for (thread_no = 0; thread_no <
topo.num_threads_per_core; ++thread_no) { topo.num_threads_per_core; ++thread_no) {
struct thread_data *t, *t2; struct thread_data *t, *t2;
...@@ -4728,11 +4730,11 @@ void topology_probe() ...@@ -4728,11 +4730,11 @@ void topology_probe()
cpus[i].thread_id); cpus[i].thread_id);
} }
topo.num_cores_per_pkg = max_core_id + 1; topo.num_cores_per_node = max_core_id + 1;
if (debug > 1) if (debug > 1)
fprintf(outf, "max_core_id %d, sizing for %d cores per package\n", fprintf(outf, "max_core_id %d, sizing for %d cores per package\n",
max_core_id, topo.num_cores_per_pkg); max_core_id, topo.num_cores_per_node);
if (!summary_only && topo.num_cores_per_pkg > 1) if (!summary_only && topo.num_cores_per_node > 1)
BIC_PRESENT(BIC_Core); BIC_PRESENT(BIC_Core);
topo.num_packages = max_package_id + 1; topo.num_packages = max_package_id + 1;
...@@ -4756,21 +4758,21 @@ allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_data ...@@ -4756,21 +4758,21 @@ allocate_counters(struct thread_data **t, struct core_data **c, struct pkg_data
{ {
int i; int i;
*t = calloc(topo.num_threads_per_core * topo.num_cores_per_pkg * *t = calloc(topo.num_threads_per_core * topo.num_cores_per_node *
topo.num_packages, sizeof(struct thread_data)); topo.num_packages, sizeof(struct thread_data));
if (*t == NULL) if (*t == NULL)
goto error; goto error;
for (i = 0; i < topo.num_threads_per_core * for (i = 0; i < topo.num_threads_per_core *
topo.num_cores_per_pkg * topo.num_packages; i++) topo.num_cores_per_node * topo.num_packages; i++)
(*t)[i].cpu_id = -1; (*t)[i].cpu_id = -1;
*c = calloc(topo.num_cores_per_pkg * topo.num_packages, *c = calloc(topo.num_cores_per_node * topo.num_packages,
sizeof(struct core_data)); sizeof(struct core_data));
if (*c == NULL) if (*c == NULL)
goto error; goto error;
for (i = 0; i < topo.num_cores_per_pkg * topo.num_packages; i++) for (i = 0; i < topo.num_cores_per_node * topo.num_packages; i++)
(*c)[i].core_id = -1; (*c)[i].core_id = -1;
*p = calloc(topo.num_packages, sizeof(struct pkg_data)); *p = calloc(topo.num_packages, sizeof(struct pkg_data));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment