diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-04-12 16:29:24 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-13 16:11:50 +0300 |
commit | 3407df8bbc3a91d9aa4910130026ab6b3a261b87 (patch) | |
tree | 1aeb9641161948696175a4a1f806052b248c828e /tools/perf/util/thread_map.c | |
parent | 202ff9684a912c96e0f2fac65e34280a97ad3611 (diff) | |
download | linux-3407df8bbc3a91d9aa4910130026ab6b3a261b87.tar.xz |
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; +} |