diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-13 15:40:36 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-14 14:00:23 -0500 |
commit | 37676af15c8d5a9689c9d1220d2a27d510cbe238 (patch) | |
tree | ec331da7df85594a5793546e26d4a9d8460008c4 /tools | |
parent | d87fcb4a2d990ba2de9284ede84a816c5066d54b (diff) |
perf symbols: Limit max callchain using max_stack on DWARF unwinding too
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/machine.c | 2 | ||||
-rw-r--r-- | tools/perf/util/unwind.c | 9 | ||||
-rw-r--r-- | 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, | |||
1368 | 1368 | ||
1369 | return unwind__get_entries(unwind_entry, &callchain_cursor, machine, | 1369 | return unwind__get_entries(unwind_entry, &callchain_cursor, machine, |
1370 | thread, evsel->attr.sample_regs_user, | 1370 | thread, evsel->attr.sample_regs_user, |
1371 | sample); | 1371 | sample, max_stack); |
1372 | 1372 | ||
1373 | } | 1373 | } |
1374 | 1374 | ||
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 = { | |||
559 | }; | 559 | }; |
560 | 560 | ||
561 | static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, | 561 | static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, |
562 | void *arg) | 562 | void *arg, int max_stack) |
563 | { | 563 | { |
564 | unw_addr_space_t addr_space; | 564 | unw_addr_space_t addr_space; |
565 | unw_cursor_t c; | 565 | unw_cursor_t c; |
@@ -575,7 +575,7 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, | |||
575 | if (ret) | 575 | if (ret) |
576 | display_error(ret); | 576 | display_error(ret); |
577 | 577 | ||
578 | while (!ret && (unw_step(&c) > 0)) { | 578 | while (!ret && (unw_step(&c) > 0) && max_stack--) { |
579 | unw_word_t ip; | 579 | unw_word_t ip; |
580 | 580 | ||
581 | unw_get_reg(&c, UNW_REG_IP, &ip); | 581 | 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, | |||
588 | 588 | ||
589 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | 589 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, |
590 | struct machine *machine, struct thread *thread, | 590 | struct machine *machine, struct thread *thread, |
591 | u64 sample_uregs, struct perf_sample *data) | 591 | u64 sample_uregs, struct perf_sample *data, |
592 | int max_stack) | ||
592 | { | 593 | { |
593 | unw_word_t ip; | 594 | unw_word_t ip; |
594 | struct unwind_info ui = { | 595 | struct unwind_info ui = { |
@@ -610,5 +611,5 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | |||
610 | if (ret) | 611 | if (ret) |
611 | return -ENOMEM; | 612 | return -ENOMEM; |
612 | 613 | ||
613 | return get_entries(&ui, cb, arg); | 614 | return get_entries(&ui, cb, arg, max_stack); |
614 | } | 615 | } |
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, | |||
18 | struct machine *machine, | 18 | struct machine *machine, |
19 | struct thread *thread, | 19 | struct thread *thread, |
20 | u64 sample_uregs, | 20 | u64 sample_uregs, |
21 | struct perf_sample *data); | 21 | struct perf_sample *data, int max_stack); |
22 | int unwind__arch_reg_id(int regnum); | 22 | int unwind__arch_reg_id(int regnum); |
23 | #else | 23 | #else |
24 | static inline int | 24 | static inline int |
@@ -27,7 +27,8 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, | |||
27 | struct machine *machine __maybe_unused, | 27 | struct machine *machine __maybe_unused, |
28 | struct thread *thread __maybe_unused, | 28 | struct thread *thread __maybe_unused, |
29 | u64 sample_uregs __maybe_unused, | 29 | u64 sample_uregs __maybe_unused, |
30 | struct perf_sample *data __maybe_unused) | 30 | struct perf_sample *data __maybe_unused, |
31 | int max_stack __maybe_unused) | ||
31 | { | 32 | { |
32 | return 0; | 33 | return 0; |
33 | } | 34 | } |