diff options
author | 2016-04-12 15:29:24 +0200 | |
---|---|---|
committer | 2016-04-13 10:11:50 -0300 | |
commit | 3407df8bbc3a91d9aa4910130026ab6b3a261b87 (patch) | |
tree | 1aeb9641161948696175a4a1f806052b248c828e /tools/perf/util/thread_map.c | |
parent | perf trace: Support callchains for --event too (diff) | |
download | linux-3407df8bbc3a91d9aa4910130026ab6b3a261b87.tar.gz linux-3407df8bbc3a91d9aa4910130026ab6b3a261b87.tar.bz2 linux-3407df8bbc3a91d9aa4910130026ab6b3a261b87.zip |
perf thread_map: Add has() method
Adding thread_map__has() to return bool of pid presence in threads map.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
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/1460467771-26532-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/thread_map.c')
-rw-r--r-- | tools/perf/util/thread_map.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c index 267112b4e3db..878ac0687b0a 100644 --- a/tools/perf/util/thread_map.c +++ b/tools/perf/util/thread_map.c @@ -436,3 +436,15 @@ struct thread_map *thread_map__new_event(struct thread_map_event *event) return threads; } + +bool thread_map__has(struct thread_map *threads, pid_t pid) +{ + int i; + + for (i = 0; i < threads->nr; ++i) { + if (threads->map[i].pid == pid) + return true; + } + + return false; +} |