mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Mike Galbraith <efault@gmx.de>, Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 03/15] perf report: Add option to show total period
Date: Thu,  6 Oct 2011 14:22:26 -0300	[thread overview]
Message-ID: <1317921758-4154-4-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1317921758-4154-1-git-send-email-acme@infradead.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

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>
---
 tools/perf/Documentation/perf-report.txt |    2 ++
 tools/perf/builtin-report.c              |    2 ++
 tools/perf/util/hist.c                   |   19 +++++++++++++++++++
 tools/perf/util/symbol.h                 |    1 +
 4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 6349b6c..4e82c19 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 b125742..c1cc7ab 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 24cca0a..32c9086 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 7733f0b..29f8d74 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,
-- 
1.6.2.5


  parent reply	other threads:[~2011-10-06 17:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-06 17:22 [GIT PULL 00/15] perf/core improvements Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 01/15] perf hists: Stop using 'self' for struct hists Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 02/15] perf hists: Allow limiting the number of rows and columns in fprintf Arnaldo Carvalho de Melo
2011-10-06 17:22 ` Arnaldo Carvalho de Melo [this message]
2011-10-06 17:22 ` [PATCH 04/15] perf hists: Threaded addition and sorting of entries Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 05/15] perf browsers: Add live mode to the hists, annotate browsers Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 06/15] perf top: Reuse the 'report' hist_entry/hists classes Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 07/15] perf top: Add callgraph support Arnaldo Carvalho de Melo
2011-10-06 21:47   ` David Ahern
2011-10-06 23:02     ` Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 08/15] perf annotate browser: Allow navigation to called functions Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 09/15] perf top: Use the TUI interface by default Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 10/15] perf tools: Fix broken number of samples for perf report -n Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 11/15] perf annotate browser: Use -> to navigate on assembly lines Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 12/15] perf hists browser: Don't offer symbol actions when symbols not on --sort Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 13/15] perf hists browser: Fix TAB/UNTAB use with multiple events Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 14/15] perf hists browser: Update the browser.nr_entries after the timer Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 15/15] perf tools: Make perf.data more self-descriptive (v8) Arnaldo Carvalho de Melo
2011-10-10  5:11 ` [GIT PULL 00/15] perf/core improvements Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1317921758-4154-4-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®