aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-10-05 15:10:06 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-10-07 11:12:13 -0400
commit3f2728bdb6a4cad0d18b09d03e2008121c902751 (patch)
tree926f27a763d02bf75f43beb02b498d7bc43eb89f /tools/perf
parentef9dfe6ec3e409b68e35c05b882d636140bb3fa7 (diff)
perf report: Add option to show total period
Just like --show-nr-samples, to help in diagnosing problems in the tools. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-1lr7ejdjfvy2uwy2wkmatcpq@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/Documentation/perf-report.txt2
-rw-r--r--tools/perf/builtin-report.c2
-rw-r--r--tools/perf/util/hist.c19
-rw-r--r--tools/perf/util/symbol.h1
4 files changed, 24 insertions, 0 deletions
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 6349b6c0e3ec..4e82c19cbbbe 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -137,6 +137,8 @@ OPTIONS
137-M:: 137-M::
138--disassembler-style=:: Set disassembler style for objdump. 138--disassembler-style=:: Set disassembler style for objdump.
139 139
140--show-total-period:: Show a column with the sum of periods.
141
140SEE ALSO 142SEE ALSO
141-------- 143--------
142linkperf:perf-stat[1] 144linkperf:perf-stat[1]
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b125742e5cfd..c1cc7ab6f849 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -486,6 +486,8 @@ static const struct option options[] = {
486 OPT_STRING('c', "cpu", &cpu_list, "cpu", "list of cpus to profile"), 486 OPT_STRING('c', "cpu", &cpu_list, "cpu", "list of cpus to profile"),
487 OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style", 487 OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
488 "Specify disassembler style (e.g. -M intel for intel syntax)"), 488 "Specify disassembler style (e.g. -M intel for intel syntax)"),
489 OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
490 "Show a column with the sum of periods"),
489 OPT_END() 491 OPT_END()
490}; 492};
491 493
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 24cca0a7ffa3..32c90865940f 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -664,6 +664,13 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size,
664 ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events); 664 ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events);
665 } 665 }
666 666
667 if (symbol_conf.show_total_period) {
668 if (sep)
669 ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period);
670 else
671 ret += snprintf(s + ret, size - ret, " %12" PRIu64, period);
672 }
673
667 if (pair_hists) { 674 if (pair_hists) {
668 char bf[32]; 675 char bf[32];
669 double old_percent = 0, new_percent = 0, diff; 676 double old_percent = 0, new_percent = 0, diff;
@@ -770,6 +777,13 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
770 fputs(" Samples ", fp); 777 fputs(" Samples ", fp);
771 } 778 }
772 779
780 if (symbol_conf.show_total_period) {
781 if (sep)
782 ret += fprintf(fp, "%cPeriod", *sep);
783 else
784 ret += fprintf(fp, " Period ");
785 }
786
773 if (symbol_conf.show_cpu_utilization) { 787 if (symbol_conf.show_cpu_utilization) {
774 if (sep) { 788 if (sep) {
775 ret += fprintf(fp, "%csys", *sep); 789 ret += fprintf(fp, "%csys", *sep);
@@ -834,6 +848,8 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
834 fprintf(fp, "# ........"); 848 fprintf(fp, "# ........");
835 if (symbol_conf.show_nr_samples) 849 if (symbol_conf.show_nr_samples)
836 fprintf(fp, " .........."); 850 fprintf(fp, " ..........");
851 if (symbol_conf.show_total_period)
852 fprintf(fp, " ............");
837 if (pair) { 853 if (pair) {
838 fprintf(fp, " .........."); 854 fprintf(fp, " ..........");
839 if (show_displacement) 855 if (show_displacement)
@@ -917,6 +933,9 @@ unsigned int hists__sort_list_width(struct hists *hists)
917 if (symbol_conf.show_nr_samples) 933 if (symbol_conf.show_nr_samples)
918 ret += 11; 934 ret += 11;
919 935
936 if (symbol_conf.show_total_period)
937 ret += 13;
938
920 list_for_each_entry(se, &hist_entry__sort_list, list) 939 list_for_each_entry(se, &hist_entry__sort_list, list)
921 if (!se->elide) 940 if (!se->elide)
922 ret += 2 + hists__col_len(hists, se->se_width_idx); 941 ret += 2 + hists__col_len(hists, se->se_width_idx);
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 7733f0b3cd41..29f8d742e92f 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -72,6 +72,7 @@ struct symbol_conf {
72 use_modules, 72 use_modules,
73 sort_by_name, 73 sort_by_name,
74 show_nr_samples, 74 show_nr_samples,
75 show_total_period,
75 use_callchain, 76 use_callchain,
76 exclude_other, 77 exclude_other,
77 show_cpu_utilization, 78 show_cpu_utilization,