linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: linux-pm@vger.kernel.org
Cc: lenb@kernel.org, Prarit Bhargava <prarit@redhat.com>,
	Len Brown <len.brown@intel.com>
Subject: [PATCH 8/8 v2] turbostat: Add Node in output
Date: Fri, 18 Aug 2017 09:08:29 -0400	[thread overview]
Message-ID: <1503061709-4319-9-git-send-email-prarit@redhat.com> (raw)
In-Reply-To: <1503061709-4319-1-git-send-email-prarit@redhat.com>

Output a Node column if there is more than one node/socket.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Len Brown <len.brown@intel.com>
---
 tools/power/x86/turbostat/turbostat.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 219fc8a5c335..01e3e71ac52e 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -468,6 +468,7 @@ struct msr_counter bic[] = {
 #define	BIC_Any_c0	(1ULL << 40)
 #define	BIC_GFX_c0	(1ULL << 41)
 #define	BIC_CPUGFX	(1ULL << 42)
+#define	BIC_Node	(1ULL << 43)
 
 unsigned long long bic_enabled = 0xFFFFFFFFFFFFFFFFULL;
 unsigned long long bic_present = BIC_sysfs;
@@ -567,6 +568,8 @@ void print_header(char *delim)
 		outp += sprintf(outp, "usec %s", delim);
 	if (DO_BIC(BIC_Package))
 		outp += sprintf(outp, "%sPackage", (printed++ ? delim : ""));
+	if (DO_BIC(BIC_Node))
+		outp += sprintf(outp, "%sNode", (printed++ ? delim : ""));
 	if (DO_BIC(BIC_Core))
 		outp += sprintf(outp, "%sCore", (printed++ ? delim : ""));
 	if (DO_BIC(BIC_CPU))
@@ -833,6 +836,8 @@ int format_counters(struct thread_data *t, struct core_data *c,
 	if (t == &average.threads) {
 		if (DO_BIC(BIC_Package))
 			outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
+		if (DO_BIC(BIC_Node))
+			outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
 		if (DO_BIC(BIC_Core))
 			outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
 		if (DO_BIC(BIC_CPU))
@@ -844,6 +849,15 @@ int format_counters(struct thread_data *t, struct core_data *c,
 			else
 				outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
 		}
+		if (DO_BIC(BIC_Node)) {
+			if (t)
+				outp += sprintf(outp, "%s%d",
+						(printed++ ? delim : ""),
+					      cpus[t->cpu_id].physical_node_id);
+			else
+				outp += sprintf(outp, "%s-",
+						(printed++ ? delim : ""));
+		}
 		if (DO_BIC(BIC_Core)) {
 			if (c)
 				outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), c->core_id);
@@ -4524,6 +4538,8 @@ void topology_probe()
 	set_node_data();
 	if (debug > 1)
 		fprintf(outf, "nodes_per_pkg %d\n", topo.nodes_per_pkg);
+	if (!summary_only && topo.nodes_per_pkg > 1)
+		BIC_PRESENT(BIC_Node);
 
 	topo.threads_per_core = max_siblings;
 	if (debug > 1)
-- 
1.8.5.5

      parent reply	other threads:[~2017-08-18 13:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 13:08 [PATCH 0/8 v2]: turbostat: Fix AMD output by making turbostat aware of nodes Prarit Bhargava
2017-08-18 13:08 ` [PATCH 1/8 v2] turbostat: set max_num_cpus equal to the cpumask length Prarit Bhargava
2017-08-18 13:08 ` [PATCH 2/8 v2] turbostat: Fix node and siblings lookup data Prarit Bhargava
2017-08-18 13:08 ` [PATCH 3/8 v2] turbostat: Calculate additional node information for a package Prarit Bhargava
2017-08-18 13:08 ` [PATCH 4/8 v2] turbostat: track thread ID in cpu_topology Prarit Bhargava
2017-08-18 13:08 ` [PATCH 5/8 v2] turbostat: rename num_cores_per_pkg to num_cores_per_node Prarit Bhargava
2017-08-18 13:08 ` [PATCH 6/8 v2] turbostat: remove num_ from cpu_topology struct Prarit Bhargava
2017-08-18 13:08 ` [PATCH 7/8 v2] turbostat: add node information into turbostat calculations Prarit Bhargava
2017-08-18 13:08 ` Prarit Bhargava [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503061709-4319-9-git-send-email-prarit@redhat.com \
    --to=prarit@redhat.com \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-pm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).