summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-10-05 16:10:06 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-10-07 12:12:13 -0300
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
-M::
--disassembler-style=:: Set disassembler style for objdump.
+--show-total-period:: Show a column with the sum of periods.
+
SEE ALSO
--------
linkperf: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[] = {
OPT_STRING('c', "cpu", &cpu_list, "cpu", "list of cpus to profile"),
OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
"Specify disassembler style (e.g. -M intel for intel syntax)"),
+ OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
+ "Show a column with the sum of periods"),
OPT_END()
};
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,
ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events);
}
+ if (symbol_conf.show_total_period) {
+ if (sep)
+ ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period);
+ else
+ ret += snprintf(s + ret, size - ret, " %12" PRIu64, period);
+ }
+
if (pair_hists) {
char bf[32];
double old_percent = 0, new_percent = 0, diff;
@@ -770,6 +777,13 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
fputs(" Samples ", fp);
}
+ if (symbol_conf.show_total_period) {
+ if (sep)
+ ret += fprintf(fp, "%cPeriod", *sep);
+ else
+ ret += fprintf(fp, " Period ");
+ }
+
if (symbol_conf.show_cpu_utilization) {
if (sep) {
ret += fprintf(fp, "%csys", *sep);
@@ -834,6 +848,8 @@ size_t hists__fprintf(struct hists *hists, struct hists *pair,
fprintf(fp, "# ........");
if (symbol_conf.show_nr_samples)
fprintf(fp, " ..........");
+ if (symbol_conf.show_total_period)
+ fprintf(fp, " ............");
if (pair) {
fprintf(fp, " ..........");
if (show_displacement)
@@ -917,6 +933,9 @@ unsigned int hists__sort_list_width(struct hists *hists)
if (symbol_conf.show_nr_samples)
ret += 11;
+ if (symbol_conf.show_total_period)
+ ret += 13;
+
list_for_each_entry(se, &hist_entry__sort_list, list)
if (!se->elide)
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 {
use_modules,
sort_by_name,
show_nr_samples,
+ show_total_period,
use_callchain,
exclude_other,
show_cpu_utilization,