From 58d925dcede9e8765876707a33a3406011fe1c11 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 11 Nov 2013 11:28:02 -0300 Subject: perf machine: Introduce synthesize_threads method out of open coded equivalent Further simplifications to be done on following patch, as most tools don't use the callback, using instead just the canned machine__process_event one. Cc: Adrian Hunter Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Mike Galbraith Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-r1m0vuuj3cat4bampno9yc8d@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/machine.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tools/perf/util/machine.c') diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index ce034c183a7e..9f2c61d5a9ed 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -1394,3 +1394,15 @@ int machine__for_each_thread(struct machine *machine, } return rc; } + +int machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, + struct perf_target *target, struct thread_map *threads, + perf_event__handler_t process, bool data_mmap) +{ + if (perf_target__has_task(target)) + return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap); + else if (perf_target__has_cpu(target)) + return perf_event__synthesize_threads(tool, process, machine, data_mmap); + /* command specified */ + return 0; +} -- cgit v1.2.3