diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-11 09:36:12 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-11 13:56:40 -0500 |
commit | a33fbd56ec83b5421090b4d8f2032f635e6a9488 (patch) | |
tree | fe5cbc7363db903130b7c4922c7e6a5204c2f5ed /tools/perf/util | |
parent | 58d925dcede9e8765876707a33a3406011fe1c11 (diff) |
perf machine: Simplify synthesize_threads method
Several tools (top, kvm) don't need to be called back to process each of
the syntheiszed records, instead relying on the machine__process_event
function to change the per machine data structures that represent
threads and mmaps, so provide a way to ask for this common idiom.
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: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-pusqibp8n3c4ynegd1frn4zd@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/machine.c | 6 | ||||
-rw-r--r-- | tools/perf/util/machine.h | 14 |
2 files changed, 14 insertions, 6 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 9f2c61d5a9ed..680700b6d779 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1395,9 +1395,9 @@ int machine__for_each_thread(struct machine *machine, | |||
1395 | return rc; | 1395 | return rc; |
1396 | } | 1396 | } |
1397 | 1397 | ||
1398 | int machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, | 1398 | int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, |
1399 | struct perf_target *target, struct thread_map *threads, | 1399 | struct perf_target *target, struct thread_map *threads, |
1400 | perf_event__handler_t process, bool data_mmap) | 1400 | perf_event__handler_t process, bool data_mmap) |
1401 | { | 1401 | { |
1402 | if (perf_target__has_task(target)) | 1402 | if (perf_target__has_task(target)) |
1403 | return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap); | 1403 | return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap); |
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index 14a89d2aecaf..fedd1dfaf715 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h | |||
@@ -179,7 +179,15 @@ int machine__for_each_thread(struct machine *machine, | |||
179 | int (*fn)(struct thread *thread, void *p), | 179 | int (*fn)(struct thread *thread, void *p), |
180 | void *priv); | 180 | void *priv); |
181 | 181 | ||
182 | int machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, | 182 | int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, |
183 | struct perf_target *target, struct thread_map *threads, | 183 | struct perf_target *target, struct thread_map *threads, |
184 | perf_event__handler_t process, bool data_mmap); | 184 | perf_event__handler_t process, bool data_mmap); |
185 | static inline | ||
186 | int machine__synthesize_threads(struct machine *machine, struct perf_target *target, | ||
187 | struct thread_map *threads, bool data_mmap) | ||
188 | { | ||
189 | return __machine__synthesize_threads(machine, NULL, target, threads, | ||
190 | perf_event__process, data_mmap); | ||
191 | } | ||
192 | |||
185 | #endif /* __PERF_MACHINE_H */ | 193 | #endif /* __PERF_MACHINE_H */ |