aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/thread_map.h
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2015-06-26 11:29:07 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-06-26 11:07:01 -0300
commit792402fd5c0a5a5300868e9dfc8ee569f3a39169 (patch)
treeebb6df248a2b15b81b7fe8a0ac5e9f02a4ad6412 /tools/perf/util/thread_map.h
parent62eea464380633b88902da35bf9cbd8515289703 (diff)
perf thrad_map: Add comm string into array
Adding support to hold comm name together with pids in 'struct thread_map'. It will be useful for --per-thread option to display task pid together with task name. Adding thread_map__read_comms function that reads/set comm string for the 'struct thread_map'. Getting the task name from /proc/$pid/comm. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1435310967-14570-3-git-send-email-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/thread_map.h')
-rw-r--r--tools/perf/util/thread_map.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h
index 6b0cd2dc006b..af679d8a50f8 100644
--- a/tools/perf/util/thread_map.h
+++ b/tools/perf/util/thread_map.h
@@ -7,6 +7,7 @@
struct thread_map_data {
pid_t pid;
+ char *comm;
};
struct thread_map {
@@ -44,4 +45,11 @@ thread_map__set_pid(struct thread_map *map, int thread, pid_t pid)
{
map->map[thread].pid = pid;
}
+
+static inline char *thread_map__comm(struct thread_map *map, int thread)
+{
+ return map->map[thread].comm;
+}
+
+void thread_map__read_comms(struct thread_map *threads);
#endif /* __PERF_THREAD_MAP_H */