diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-23 15:42:19 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-10-29 08:32:46 -0400 |
| commit | dd8c17a5fe80148aab8844e8774cf341212a4eb1 (patch) | |
| tree | b1695fdf3535710ac32240d044b9df7db167981a | |
| parent | cc8b7c2bf553151a579a8009020875faa1d43e29 (diff) | |
perf callchains: Use thread->mg->machine
The unwind__get_entries() already receives the thread parameter, from where it can
obtain the matching machine structure, shorten the signature.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jean Pihet <jean.pihet@linaro.org>
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>
Link: http://lkml.kernel.org/n/tip-isjc6bm8mv4612mhi6af64go@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
| -rw-r--r-- | tools/perf/tests/dwarf-unwind.c | 18 | ||||
| -rw-r--r-- | tools/perf/util/machine.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/unwind-libdw.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/unwind-libunwind.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/unwind.h | 2 |
5 files changed, 14 insertions, 16 deletions
diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c index fc25e57f4a5d..ab28cca2cb97 100644 --- a/tools/perf/tests/dwarf-unwind.c +++ b/tools/perf/tests/dwarf-unwind.c | |||
| @@ -59,7 +59,7 @@ static int unwind_entry(struct unwind_entry *entry, void *arg) | |||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | __attribute__ ((noinline)) | 61 | __attribute__ ((noinline)) |
| 62 | static int unwind_thread(struct thread *thread, struct machine *machine) | 62 | static int unwind_thread(struct thread *thread) |
| 63 | { | 63 | { |
| 64 | struct perf_sample sample; | 64 | struct perf_sample sample; |
| 65 | unsigned long cnt = 0; | 65 | unsigned long cnt = 0; |
| @@ -72,7 +72,7 @@ static int unwind_thread(struct thread *thread, struct machine *machine) | |||
| 72 | goto out; | 72 | goto out; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | err = unwind__get_entries(unwind_entry, &cnt, machine, thread, | 75 | err = unwind__get_entries(unwind_entry, &cnt, thread, |
| 76 | &sample, MAX_STACK); | 76 | &sample, MAX_STACK); |
| 77 | if (err) | 77 | if (err) |
| 78 | pr_debug("unwind failed\n"); | 78 | pr_debug("unwind failed\n"); |
| @@ -89,21 +89,21 @@ static int unwind_thread(struct thread *thread, struct machine *machine) | |||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | __attribute__ ((noinline)) | 91 | __attribute__ ((noinline)) |
| 92 | static int krava_3(struct thread *thread, struct machine *machine) | 92 | static int krava_3(struct thread *thread) |
| 93 | { | 93 | { |
| 94 | return unwind_thread(thread, machine); | 94 | return unwind_thread(thread); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | __attribute__ ((noinline)) | 97 | __attribute__ ((noinline)) |
| 98 | static int krava_2(struct thread *thread, struct machine *machine) | 98 | static int krava_2(struct thread *thread) |
| 99 | { | 99 | { |
| 100 | return krava_3(thread, machine); | 100 | return krava_3(thread); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | __attribute__ ((noinline)) | 103 | __attribute__ ((noinline)) |
| 104 | static int krava_1(struct thread *thread, struct machine *machine) | 104 | static int krava_1(struct thread *thread) |
| 105 | { | 105 | { |
| 106 | return krava_2(thread, machine); | 106 | return krava_2(thread); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | int test__dwarf_unwind(void) | 109 | int test__dwarf_unwind(void) |
| @@ -137,7 +137,7 @@ int test__dwarf_unwind(void) | |||
| 137 | goto out; | 137 | goto out; |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | err = krava_1(thread, machine); | 140 | err = krava_1(thread); |
| 141 | 141 | ||
| 142 | out: | 142 | out: |
| 143 | machine__delete_threads(machine); | 143 | machine__delete_threads(machine); |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index fd192e4885cc..51a630301afa 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
| @@ -1486,7 +1486,7 @@ int thread__resolve_callchain(struct thread *thread, | |||
| 1486 | (!sample->user_stack.size)) | 1486 | (!sample->user_stack.size)) |
| 1487 | return 0; | 1487 | return 0; |
| 1488 | 1488 | ||
| 1489 | return unwind__get_entries(unwind_entry, &callchain_cursor, thread->mg->machine, | 1489 | return unwind__get_entries(unwind_entry, &callchain_cursor, |
| 1490 | thread, sample, max_stack); | 1490 | thread, sample, max_stack); |
| 1491 | 1491 | ||
| 1492 | } | 1492 | } |
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c index f24b350ab192..2dcfe9a7c8d0 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c | |||
| @@ -164,14 +164,14 @@ frame_callback(Dwfl_Frame *state, void *arg) | |||
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | 166 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, |
| 167 | struct machine *machine, struct thread *thread, | 167 | struct thread *thread, |
| 168 | struct perf_sample *data, | 168 | struct perf_sample *data, |
| 169 | int max_stack) | 169 | int max_stack) |
| 170 | { | 170 | { |
| 171 | struct unwind_info ui = { | 171 | struct unwind_info ui = { |
| 172 | .sample = data, | 172 | .sample = data, |
| 173 | .thread = thread, | 173 | .thread = thread, |
| 174 | .machine = machine, | 174 | .machine = thread->mg->machine, |
| 175 | .cb = cb, | 175 | .cb = cb, |
| 176 | .arg = arg, | 176 | .arg = arg, |
| 177 | .max_stack = max_stack, | 177 | .max_stack = max_stack, |
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index 29acc8cccb56..371219a6daf1 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c | |||
| @@ -592,14 +592,14 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb, | |||
| 592 | } | 592 | } |
| 593 | 593 | ||
| 594 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | 594 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, |
| 595 | struct machine *machine, struct thread *thread, | 595 | struct thread *thread, |
| 596 | struct perf_sample *data, int max_stack) | 596 | struct perf_sample *data, int max_stack) |
| 597 | { | 597 | { |
| 598 | u64 ip; | 598 | u64 ip; |
| 599 | struct unwind_info ui = { | 599 | struct unwind_info ui = { |
| 600 | .sample = data, | 600 | .sample = data, |
| 601 | .thread = thread, | 601 | .thread = thread, |
| 602 | .machine = machine, | 602 | .machine = thread->mg->machine, |
| 603 | }; | 603 | }; |
| 604 | int ret; | 604 | int ret; |
| 605 | 605 | ||
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h index f50b737235eb..12790cf94618 100644 --- a/tools/perf/util/unwind.h +++ b/tools/perf/util/unwind.h | |||
| @@ -16,7 +16,6 @@ typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg); | |||
| 16 | 16 | ||
| 17 | #ifdef HAVE_DWARF_UNWIND_SUPPORT | 17 | #ifdef HAVE_DWARF_UNWIND_SUPPORT |
| 18 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | 18 | int unwind__get_entries(unwind_entry_cb_t cb, void *arg, |
| 19 | struct machine *machine, | ||
| 20 | struct thread *thread, | 19 | struct thread *thread, |
| 21 | struct perf_sample *data, int max_stack); | 20 | struct perf_sample *data, int max_stack); |
| 22 | /* libunwind specific */ | 21 | /* libunwind specific */ |
| @@ -38,7 +37,6 @@ static inline void unwind__finish_access(struct thread *thread __maybe_unused) { | |||
| 38 | static inline int | 37 | static inline int |
| 39 | unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, | 38 | unwind__get_entries(unwind_entry_cb_t cb __maybe_unused, |
| 40 | void *arg __maybe_unused, | 39 | void *arg __maybe_unused, |
| 41 | struct machine *machine __maybe_unused, | ||
| 42 | struct thread *thread __maybe_unused, | 40 | struct thread *thread __maybe_unused, |
| 43 | struct perf_sample *data __maybe_unused, | 41 | struct perf_sample *data __maybe_unused, |
| 44 | int max_stack __maybe_unused) | 42 | int max_stack __maybe_unused) |
