linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 09/21] perf evsel: Add option to limit stack depth in callchain dumps
Date: Wed, 14 Aug 2013 15:25:03 -0300	[thread overview]
Message-ID: <1376504715-28107-10-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1376504715-28107-1-git-send-email-acme@infradead.org>

From: David Ahern <dsahern@gmail.com>

Option is used by upcoming timehist command.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1375930261-77273-12-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-script.c | 6 ++++--
 tools/perf/util/session.c   | 6 ++++--
 tools/perf/util/session.h   | 2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index ee5d6f8..33b2d83 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -402,7 +402,8 @@ static void print_sample_bts(union perf_event *event,
 		else
 			printf("\n");
 		perf_evsel__print_ip(evsel, event, sample, machine,
-				     output[attr->type].print_ip_opts);
+				     output[attr->type].print_ip_opts,
+				     PERF_MAX_STACK_DEPTH);
 	}
 
 	printf(" => ");
@@ -444,7 +445,8 @@ static void process_event(union perf_event *event, struct perf_sample *sample,
 			printf("\n");
 
 		perf_evsel__print_ip(evsel, event, sample, machine,
-				     output[attr->type].print_ip_opts);
+				     output[attr->type].print_ip_opts,
+				     PERF_MAX_STACK_DEPTH);
 	}
 
 	printf("\n");
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0d895e7..5a89964 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1489,7 +1489,7 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
 
 void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event,
 			  struct perf_sample *sample, struct machine *machine,
-			  unsigned int print_opts)
+			  unsigned int print_opts, unsigned int stack_depth)
 {
 	struct addr_location al;
 	struct callchain_cursor_node *node;
@@ -1517,7 +1517,7 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event,
 		}
 		callchain_cursor_commit(&callchain_cursor);
 
-		while (1) {
+		while (stack_depth) {
 			node = callchain_cursor_current(&callchain_cursor);
 			if (!node)
 				break;
@@ -1544,6 +1544,8 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event,
 				printf("\n");
 
 			callchain_cursor_advance(&callchain_cursor);
+
+			stack_depth--;
 		}
 
 	} else {
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 7c00ccb..3aa75fb 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -109,7 +109,7 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
 
 void perf_evsel__print_ip(struct perf_evsel *evsel, union perf_event *event,
 			  struct perf_sample *sample, struct machine *machine,
-			  unsigned int print_opts);
+			  unsigned int print_opts, unsigned int stack_depth);
 
 int perf_session__cpu_bitmap(struct perf_session *session,
 			     const char *cpu_list, unsigned long *cpu_bitmap);
-- 
1.8.1.4


  parent reply	other threads:[~2013-08-14 18:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-14 18:24 [GIT PULL 00/21] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-08-14 18:24 ` [PATCH 01/21] perf kvm: Option to print events that exceed a duration Arnaldo Carvalho de Melo
2013-08-14 18:24 ` [PATCH 02/21] perf kvm: Update documentation with live command Arnaldo Carvalho de Melo
2013-08-14 18:24 ` [PATCH 03/21] perf sched: Simplify arguments to read_events Arnaldo Carvalho de Melo
2013-08-14 18:24 ` [PATCH 04/21] perf sched: Remove thread lookup in sample handler Arnaldo Carvalho de Melo
2013-08-14 18:24 ` [PATCH 05/21] perf sched: Remove sched_process_exit tracepoint Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 06/21] perf sched: Remove sched_process_fork tracepoint Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 07/21] perf tool: Simplify options to perf_evsel__print_ip Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 08/21] perf evsel: Add option to print stack trace on single line Arnaldo Carvalho de Melo
2013-08-14 18:25 ` Arnaldo Carvalho de Melo [this message]
2013-08-14 18:25 ` [PATCH 10/21] perf session: Change perf_session__has_traces to actually check for tracepoints Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 11/21] perf machine: Add symbol filter to struct machine Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 12/21] perf top: Set the machines symbol filter Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 13/21] perf report: " Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 14/21] perf mem: Remove unused symbol filter member Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 15/21] perf annotate: Set the machines symbol filter Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 16/21] perf tools: Remove filter parameter of perf_event__preprocess_sample() Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 17/21] perf tools: Remove filter parameter of thread__find_addr_location() Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 18/21] perf tools: Remove filter parameter of thread__find_addr_map() Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 19/21] perf tests: Fix compile failure on do_sort_something Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 20/21] perf tools: Improve robustness of topology parsing code Arnaldo Carvalho de Melo
2013-08-14 18:25 ` [PATCH 21/21] perf trace: Allow specifying which syscalls to trace Arnaldo Carvalho de Melo
2013-08-15  7:52 ` [GIT PULL 00/21] perf/core improvements and fixes 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=1376504715-28107-10-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.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;
as well as URLs for NNTP newsgroup(s).