perf thread_map: Add perf_event__fprintf_thread_map function
authorJiri Olsa <jolsa@kernel.org>
Sun, 25 Oct 2015 14:51:22 +0000 (15:51 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 17 Dec 2015 17:38:17 +0000 (14:38 -0300)
To display a thread_map event for a raw dump.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Kan Liang <kan.liang@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1445784728-21732-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/event.c
tools/perf/util/event.h

index b13373a60337936b4f87eddb706eba70b2f0b37b..938f006c758ed0a338519cbde0e4821ec29390c3 100644 (file)
@@ -820,6 +820,22 @@ size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp)
                       event->mmap2.filename);
 }
 
+size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp)
+{
+       struct thread_map *threads = thread_map__new_event(&event->thread_map);
+       size_t ret;
+
+       ret = fprintf(fp, " nr: ");
+
+       if (threads)
+               ret += thread_map__fprintf(threads, fp);
+       else
+               ret += fprintf(fp, "failed to get threads from event\n");
+
+       thread_map__put(threads);
+       return ret;
+}
+
 int perf_event__process_mmap(struct perf_tool *tool __maybe_unused,
                             union perf_event *event,
                             struct perf_sample *sample,
index 952dd4d83f81d75e9403c9e0385f90a337f0a9ff..b7ad896d13171f15415002f213c54b7bb790f2ad 100644 (file)
@@ -516,6 +516,7 @@ size_t perf_event__fprintf_task(union perf_event *event, FILE *fp);
 size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp);
 size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp);
 size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp);
+size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp);
 size_t perf_event__fprintf(union perf_event *event, FILE *fp);
 
 u64 kallsyms__get_function_start(const char *kallsyms_filename,