Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1695687
| From | Prarit Bhargava <prarit@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 5/7] turbostat: rename num_cores_per_pkg to num_cores_per_node |
| Date | 2017-07-25 14:30 +0200 |
| Message-ID | <u778m-2J2-31@gated-at.bofh.it> (permalink) |
| References | <u778l-2J2-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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: Prarit Bhargava <prarit@redhat.com>
Cc: Len Brown <len.brown@intel.com>
---
tools/power/x86/turbostat/turbostat.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 124d9fbbaab6..db690ef4bfb0 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -206,11 +206,11 @@ struct pkg_data {
#define EVEN_COUNTERS thread_even, core_even, package_even
#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 + \
(core_no) * topo.num_threads_per_core + (thread_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)
enum counter_scope {SCOPE_CPU, SCOPE_CORE, SCOPE_PACKAGE};
@@ -263,7 +263,7 @@ struct topo_params {
int max_cpu_num;
int max_node_num;
int num_nodes_per_pkg;
- int num_cores_per_pkg;
+ int num_cores_per_node;
int num_threads_per_core;
} topo;
@@ -289,7 +289,7 @@ int for_all_cpus(int (func)(struct thread_data *, struct core_data *, struct pkg
int retval, pkg_no, core_no, thread_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 <
topo.num_threads_per_core; ++thread_no) {
struct thread_data *t;
@@ -2400,7 +2400,7 @@ int for_all_cpus_2(int (func)(struct thread_data *, struct core_data *,
int retval, pkg_no, core_no, thread_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 <
topo.num_threads_per_core; ++thread_no) {
struct thread_data *t, *t2;
@@ -4468,11 +4468,11 @@ void topology_probe()
cpus[i].physical_core_id);
}
- topo.num_cores_per_pkg = max_core_id + 1;
+ topo.num_cores_per_node = max_core_id + 1;
if (debug > 1)
fprintf(outf, "max_core_id %d, sizing for %d cores per package\n",
- max_core_id, topo.num_cores_per_pkg);
- if (!summary_only && topo.num_cores_per_pkg > 1)
+ max_core_id, topo.num_cores_per_node);
+ if (!summary_only && topo.num_cores_per_node > 1)
BIC_PRESENT(BIC_Core);
topo.num_packages = max_package_id + 1;
@@ -4496,21 +4496,21 @@ void topology_probe()
{
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));
if (*t == NULL)
goto error;
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;
- *c = calloc(topo.num_cores_per_pkg * topo.num_packages,
+ *c = calloc(topo.num_cores_per_node * topo.num_packages,
sizeof(struct core_data));
if (*c == NULL)
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;
*p = calloc(topo.num_packages, sizeof(struct pkg_data));
--
1.8.5.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/7 RESEND] turbostat: Fix AMD output by making turbostat aware of nodes Prarit Bhargava <prarit@redhat.com> - 2017-07-25 14:30 +0200 [PATCH 4/7] turbostat: track thread ID in cpu_topology Prarit Bhargava <prarit@redhat.com> - 2017-07-25 14:30 +0200 [PATCH 3/7] turbostat: Calculate additional node information for a package Prarit Bhargava <prarit@redhat.com> - 2017-07-25 14:30 +0200 [PATCH 7/7] turbostat: add node information into turbostat calculations Prarit Bhargava <prarit@redhat.com> - 2017-07-25 14:30 +0200 [PATCH 6/7] turbostat: remove num_ from cpu_topology struct Prarit Bhargava <prarit@redhat.com> - 2017-07-25 14:30 +0200 [PATCH 1/7] turbostat: set max_num_cpus equal to the cpumask length Prarit Bhargava <prarit@redhat.com> - 2017-07-25 14:30 +0200 [PATCH 5/7] turbostat: rename num_cores_per_pkg to num_cores_per_node Prarit Bhargava <prarit@redhat.com> - 2017-07-25 14:30 +0200 [PATCH 2/7] turbostat: Fix node and siblings lookup data Prarit Bhargava <prarit@redhat.com> - 2017-07-25 14:30 +0200
csiph-web