aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2012-01-07 12:25:32 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-01-08 10:32:51 -0500
commit0ed35abc2b569e94498705d250c4767c5284f643 (patch)
tree2f33c5c2cc6646f2fc0a768a9c6fa2abbc071c1c /tools
parent6714a04114639350a7fed93edf8e1b995c5e8059 (diff)
perf report: Fix --stdio output alignment when --showcpuutilization used
Current perf report output is broken if --showcpuutilization is used. Combination with -n and/or --show-total-period make things worse. This patch fixes it as follows: before: 48.25% 48.25% 0.00% sleep [kernel.kallsyms] [k] trace_hardirqs_off 34.99% 34.99% 0.00% sleep [kernel.kallsyms] [k] __find_get_block_slow 15.99% 15.99% 0.00% sleep [kernel.kallsyms] [k] lock_release_holdtime 0.77% 0.77% 0.00% sleep [kernel.kallsyms] [k] native_write_msr_safe after: 48.25% 48.25% 0.00% sleep [kernel.kallsyms] [k] trace_hardirqs_off 34.99% 34.99% 0.00% sleep [kernel.kallsyms] [k] __find_get_block_slow 15.99% 15.99% 0.00% sleep [kernel.kallsyms] [k] lock_release_holdtime 0.77% 0.77% 0.00% sleep [kernel.kallsyms] [k] native_write_msr_safe Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1325957132-10600-8-git-send-email-namhyung@gmail.com Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/hist.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 4df449549b0c..6f505d1abac7 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -919,20 +919,6 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
919 919
920 fprintf(fp, "# %s", pair ? "Baseline" : "Overhead"); 920 fprintf(fp, "# %s", pair ? "Baseline" : "Overhead");
921 921
922 if (symbol_conf.show_nr_samples) {
923 if (sep)
924 fprintf(fp, "%cSamples", *sep);
925 else
926 fputs(" Samples ", fp);
927 }
928
929 if (symbol_conf.show_total_period) {
930 if (sep)
931 ret += fprintf(fp, "%cPeriod", *sep);
932 else
933 ret += fprintf(fp, " Period ");
934 }
935
936 if (symbol_conf.show_cpu_utilization) { 922 if (symbol_conf.show_cpu_utilization) {
937 if (sep) { 923 if (sep) {
938 ret += fprintf(fp, "%csys", *sep); 924 ret += fprintf(fp, "%csys", *sep);
@@ -942,8 +928,8 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
942 ret += fprintf(fp, "%cguest us", *sep); 928 ret += fprintf(fp, "%cguest us", *sep);
943 } 929 }
944 } else { 930 } else {
945 ret += fprintf(fp, " sys "); 931 ret += fprintf(fp, " sys ");
946 ret += fprintf(fp, " us "); 932 ret += fprintf(fp, " us ");
947 if (perf_guest) { 933 if (perf_guest) {
948 ret += fprintf(fp, " guest sys "); 934 ret += fprintf(fp, " guest sys ");
949 ret += fprintf(fp, " guest us "); 935 ret += fprintf(fp, " guest us ");
@@ -951,6 +937,20 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
951 } 937 }
952 } 938 }
953 939
940 if (symbol_conf.show_nr_samples) {
941 if (sep)
942 fprintf(fp, "%cSamples", *sep);
943 else
944 fputs(" Samples ", fp);
945 }
946
947 if (symbol_conf.show_total_period) {
948 if (sep)
949 ret += fprintf(fp, "%cPeriod", *sep);
950 else
951 ret += fprintf(fp, " Period ");
952 }
953
954 if (pair) { 954 if (pair) {
955 if (sep) 955 if (sep)
956 ret += fprintf(fp, "%cDelta", *sep); 956 ret += fprintf(fp, "%cDelta", *sep);
@@ -995,6 +995,8 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
995 goto print_entries; 995 goto print_entries;
996 996
997 fprintf(fp, "# ........"); 997 fprintf(fp, "# ........");
998 if (symbol_conf.show_cpu_utilization)
999 fprintf(fp, " ....... .......");
998 if (symbol_conf.show_nr_samples) 1000 if (symbol_conf.show_nr_samples)
999 fprintf(fp, " .........."); 1001 fprintf(fp, " ..........");
1000 if (symbol_conf.show_total_period) 1002 if (symbol_conf.show_total_period)