summaryrefslogtreecommitdiffstats
path: root/tools/power
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2018-01-28 04:39:21 +0100
committerLen Brown <len.brown@intel.com>2018-06-01 23:15:09 +0200
commit94d6ab4b1171ae58c11cf892fc008dc4e967de37 (patch)
treec28e2f5c7e7957db96a0592a7113561cea136515 /tools/power
parenttools/power turbostat: a small C-states dump readability immprovement (diff)
downloadlinux-94d6ab4b1171ae58c11cf892fc008dc4e967de37.tar.xz
linux-94d6ab4b1171ae58c11cf892fc008dc4e967de37.zip
tools/power turbostat: remove blank lines
When the user reuests to collect and show columns that are not present on every row (eg. for every CPU) turbostat still prints an (empty) line for every CPU. Update so no blank lines are printed. old: # turbostat --quiet --show Pkg%pc6 Pkg%pc6 9.12 9.12 Pkg%pc6 9.12 9.12 new: # turbostat --quiet --show Pkg%pc6 Pkg%pc6 9.12 9.12 Pkg%pc6 9.12 9.12 Reported-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/turbostat/turbostat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 00a2a7ca5c47..29e9cd5fcd88 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -1028,7 +1028,8 @@ int format_counters(struct thread_data *t, struct core_data *c,
}
done:
- outp += sprintf(outp, "\n");
+ if (*(outp - 1) != '\n')
+ outp += sprintf(outp, "\n");
return 0;
}