From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
David Ahern <dsahern@gmail.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Mike Galbraith <efault@gmx.de>,
Namhyung Kim <namhyung@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>,
Waiman Long <Waiman.Long@hp.com>
Subject: [PATCH 07/10] perf symbols: Limit max callchain using max_stack on DWARF unwinding too
Date: Thu, 14 Nov 2013 17:25:12 -0300 [thread overview]
Message-ID: <1384460715-23198-8-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1384460715-23198-1-git-send-email-acme@infradead.org>
From: Arnaldo Carvalho de Melo <acme@redhat.com>
It was affecting only frame-pointer (fp) based callchain processing.
Usage example:
perf top --call-graph dwarf,1024 --max-stack 2
Works for any tool that does callchain resolving and provides a
--max-stack option.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Waiman Long <Waiman.Long@hp.com>
Link: http://lkml.kernel.org/n/tip-eu45v8s3tq9ruay8tpfyon79@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/machine.c | 2 +-
tools/perf/util/unwind.c | 9 +++++----
tools/perf/util/unwind.h | 5 +++--
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 0393912d8033..84cdb072ac83 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1368,7 +1368,7 @@ int machine__resolve_callchain(struct machine *machine,
return unwind__get_entries(unwind_entry, &callchain_cursor, machine,
thread, evsel->attr.sample_regs_user,
- sample);
+ sample, max_stack);
}
diff --git a/tools/perf/util/unwind.c b/tools/perf/util/unwind.c
index 5390d0b8862a..0efd5393de85 100644
--- a/tools/perf/util/unwind.c
+++ b/tools/perf/util/unwind.c
@@ -559,7 +559,7 @@ static unw_accessors_t accessors = {
};
static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
- void *arg)
+ void *arg, int max_stack)
{
unw_addr_space_t addr_space;
unw_cursor_t c;
@@ -575,7 +575,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
if (ret)
display_error(ret);
- while (!ret && (unw_step(&c) > 0)) {
+ while (!ret && (unw_step(&c) > 0) && max_stack--) {
unw_word_t ip;
unw_get_reg(&c, UNW_REG_IP, &ip);
@@ -588,7 +588,8 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct machine *machine, struct thread *thread,
- u64 sample_uregs, struct perf_sample *data)
+ u64 sample_uregs, struct perf_sample *data,
+ int max_stack)
{
unw_word_t ip;
struct unwind_info ui = {
@@ -610,5 +611,5 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
if (ret)
return -ENOMEM;
- return get_entries(&ui, cb, arg);
+ return get_entries(&ui, cb, arg, max_stack);
}
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index ec0c71a2ca2e..d5966f49e22c 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -18,7 +18,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct machine *machine,
struct thread *thread,
u64 sample_uregs,
- struct perf_sample *data);
+ struct perf_sample *data, int max_stack);
int unwind__arch_reg_id(int regnum);
#else
static inline int
@@ -27,7 +27,8 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
struct machine *machine __maybe_unused,
struct thread *thread __maybe_unused,
u64 sample_uregs __maybe_unused,
- struct perf_sample *data __maybe_unused)
+ struct perf_sample *data __maybe_unused,
+ int max_stack __maybe_unused)
{
return 0;
}
--
1.8.1.4
next prev parent reply other threads:[~2013-11-14 20:26 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-14 20:25 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-11-14 20:25 ` [PATCH 01/10] perf trace: Tweak summary output Arnaldo Carvalho de Melo
2013-11-14 20:25 ` [PATCH 02/10] perf tools: Remove trivial extra semincolon Arnaldo Carvalho de Melo
2013-11-14 20:25 ` [PATCH 03/10] perf top: Add missing newline if the 'uid' is invalid Arnaldo Carvalho de Melo
2013-11-14 20:25 ` [PATCH 04/10] perf tools: Synthesize anon MMAP records again Arnaldo Carvalho de Melo
2013-11-14 20:25 ` [PATCH 05/10] perf tools: Use perf_evlist__{first,last}, perf_evsel__next Arnaldo Carvalho de Melo
2013-11-14 20:25 ` [PATCH 06/10] perf evsel: Introduce perf_evsel__prev() method Arnaldo Carvalho de Melo
2013-11-14 20:25 ` Arnaldo Carvalho de Melo [this message]
2013-11-14 20:25 ` [PATCH 08/10] perf ui browser: Fix segfault caused by off by one handling END key Arnaldo Carvalho de Melo
2013-11-14 20:25 ` [PATCH 09/10] perf probe: Add '--demangle'/'--no-demangle' Arnaldo Carvalho de Melo
2013-11-14 20:25 ` [PATCH 10/10] perf record: Add an option to force per-cpu mmaps Arnaldo Carvalho de Melo
2013-11-15 6:06 ` Ingo Molnar
2013-11-15 11:00 ` Adrian Hunter
2013-11-15 11:10 ` Ingo Molnar
2013-11-15 11:27 ` Adrian Hunter
2013-11-15 11:56 ` Ingo Molnar
2013-11-15 12:03 ` Peter Zijlstra
2013-11-15 12:05 ` Ingo Molnar
2013-11-15 12:30 ` Peter Zijlstra
2013-11-15 12:33 ` Adrian Hunter
2013-11-15 12:52 ` Adrian Hunter
2013-11-15 12:53 ` Peter Zijlstra
2013-11-15 13:52 ` [PATCH V2] perf record: Make per-cpu mmaps the default Adrian Hunter
2013-11-30 12:50 ` [tip:perf/core] " tip-bot for Adrian Hunter
2013-11-15 6:38 ` [GIT PULL 00/10] 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=1384460715-23198-8-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=Waiman.Long@hp.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=dsahern@gmail.com \
--cc=efault@gmx.de \
--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=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;
as well as URLs for NNTP newsgroup(s).