diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-10-05 20:46:00 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-15 16:38:23 -0400 |
commit | 66f066d8994bd146304bab72fa09c1e644c4b3ff (patch) | |
tree | 9e958638fe69c2df70107aab7015be8bc36da4f3 /tools/perf/util/unwind.h | |
parent | 0cdccac6fe4b1316f04f0dbfcc4efab51932014a (diff) |
perf callchain: Create an address space per thread
The unw_addr_space_t in libunwind represents an address space to be used
for stack unwinding. It doesn't need to be create/destory everytime to
unwind callchain (as in get_entries) and can have a same lifetime as
thread (unless exec called).
So move the address space construction/destruction logic to the thread
lifetime handling functions. This is a preparation to enable caching in
the unwind library.
Note that it saves unw_addr_space_t object using thread__set_priv(). It
seems currently only used by perf trace and perf kvm stat commands which
don't use callchain.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jean Pihet <jean.pihet@linaro.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Arun Sharma <asharma@fb.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1412556363-26229-3-git-send-email-namhyung@kernel.org
[ Fixup unwind-libunwind.c missing CALLCHAIN_DWARF definition, added
missing __maybe_unused on unused parameters in stubs at util/unwind.h ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/unwind.h')
-rw-r--r-- | tools/perf/util/unwind.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h index f03061260b4e..c17c4855bdbc 100644 --- a/tools/perf/util/unwind.h +++ b/tools/perf/util/unwind.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include "event.h" | 5 | #include "event.h" |
6 | #include "symbol.h" | 6 | #include "symbol.h" |
7 | #include "thread.h" | ||
7 | 8 | ||
8 | struct unwind_entry { | 9 | struct unwind_entry { |
9 | struct map *map; | 10 | struct map *map; |
@@ -21,6 +22,15 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | |||
21 | /* libunwind specific */ | 22 | /* libunwind specific */ |
22 | #ifdef HAVE_LIBUNWIND_SUPPORT | 23 | #ifdef HAVE_LIBUNWIND_SUPPORT |
23 | int libunwind__arch_reg_id(int regnum); | 24 | int libunwind__arch_reg_id(int regnum); |
25 | int unwind__prepare_access(struct thread *thread); | ||
26 | void unwind__finish_access(struct thread *thread); | ||
27 | #else | ||
28 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused) | ||
29 | { | ||
30 | return 0; | ||
31 | } | ||
32 | |||
33 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} | ||
24 | #endif | 34 | #endif |
25 | #else | 35 | #else |
26 | static inline int | 36 | static inline int |
@@ -33,5 +43,12 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, | |||
33 | { | 43 | { |
34 | return 0; | 44 | return 0; |
35 | } | 45 | } |
46 | |||
47 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused) | ||
48 | { | ||
49 | return 0; | ||
50 | } | ||
51 | |||
52 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} | ||
36 | #endif /* HAVE_DWARF_UNWIND_SUPPORT */ | 53 | #endif /* HAVE_DWARF_UNWIND_SUPPORT */ |
37 | #endif /* __UNWIND_H */ | 54 | #endif /* __UNWIND_H */ |