Skip to content

Commit 0123504

Browse files
praritlenb
authored andcommitted
tools/power turbostat: Add Node in output
Output a Node column if there is more than one node/socket. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 40f5cfe commit 0123504

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tools/power/x86/turbostat/turbostat.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ struct msr_counter bic[] = {
485485
#define BIC_Any_c0 (1ULL << 42)
486486
#define BIC_GFX_c0 (1ULL << 43)
487487
#define BIC_CPUGFX (1ULL << 44)
488+
#define BIC_Node (1ULL << 45)
488489

489490
#define BIC_DISABLED_BY_DEFAULT (BIC_USEC | BIC_TOD)
490491

@@ -594,6 +595,8 @@ void print_header(char *delim)
594595
outp += sprintf(outp, "%sTime_Of_Day_Seconds", (printed++ ? delim : ""));
595596
if (DO_BIC(BIC_Package))
596597
outp += sprintf(outp, "%sPackage", (printed++ ? delim : ""));
598+
if (DO_BIC(BIC_Node))
599+
outp += sprintf(outp, "%sNode", (printed++ ? delim : ""));
597600
if (DO_BIC(BIC_Core))
598601
outp += sprintf(outp, "%sCore", (printed++ ? delim : ""));
599602
if (DO_BIC(BIC_CPU))
@@ -871,6 +874,8 @@ int format_counters(struct thread_data *t, struct core_data *c,
871874
if (t == &average.threads) {
872875
if (DO_BIC(BIC_Package))
873876
outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
877+
if (DO_BIC(BIC_Node))
878+
outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
874879
if (DO_BIC(BIC_Core))
875880
outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
876881
if (DO_BIC(BIC_CPU))
@@ -882,6 +887,15 @@ int format_counters(struct thread_data *t, struct core_data *c,
882887
else
883888
outp += sprintf(outp, "%s-", (printed++ ? delim : ""));
884889
}
890+
if (DO_BIC(BIC_Node)) {
891+
if (t)
892+
outp += sprintf(outp, "%s%d",
893+
(printed++ ? delim : ""),
894+
cpus[t->cpu_id].physical_node_id);
895+
else
896+
outp += sprintf(outp, "%s-",
897+
(printed++ ? delim : ""));
898+
}
885899
if (DO_BIC(BIC_Core)) {
886900
if (c)
887901
outp += sprintf(outp, "%s%d", (printed++ ? delim : ""), c->core_id);
@@ -4770,6 +4784,8 @@ void topology_probe()
47704784
set_node_data();
47714785
if (debug > 1)
47724786
fprintf(outf, "nodes_per_pkg %d\n", topo.nodes_per_pkg);
4787+
if (!summary_only && topo.nodes_per_pkg > 1)
4788+
BIC_PRESENT(BIC_Node);
47734789

47744790
topo.threads_per_core = max_siblings;
47754791
if (debug > 1)

0 commit comments

Comments
 (0)