[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-3407df8bbc3a91d9aa4910130026ab6b3a261b87@git.kernel.org>
Date: Wed, 13 Apr 2016 22:43:13 -0700
From: tip-bot for Jiri Olsa <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: a.p.zijlstra@...llo.nl, hpa@...or.com, mingo@...nel.org,
acme@...hat.com, namhyung@...nel.org, jolsa@...nel.org,
linux-kernel@...r.kernel.org, dsahern@...il.com, tglx@...utronix.de
Subject: [tip:perf/core] perf thread_map: Add has() method
Commit-ID: 3407df8bbc3a91d9aa4910130026ab6b3a261b87
Gitweb: http://git.kernel.org/tip/3407df8bbc3a91d9aa4910130026ab6b3a261b87
Author: Jiri Olsa <jolsa@...nel.org>
AuthorDate: Tue, 12 Apr 2016 15:29:24 +0200
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 13 Apr 2016 10:11:50 -0300
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@...nel.org>
Cc: David Ahern <dsahern@...il.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Link: http://lkml.kernel.org/r/1460467771-26532-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/thread_map.c | 12 ++++++++++++
tools/perf/util/thread_map.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index 267112b..878ac06 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;
+}
diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h
index 85e4c7c..9a065ea 100644
--- a/tools/perf/util/thread_map.h
+++ b/tools/perf/util/thread_map.h
@@ -55,4 +55,5 @@ static inline char *thread_map__comm(struct thread_map *map, int thread)
}
void thread_map__read_comms(struct thread_map *threads);
+bool thread_map__has(struct thread_map *threads, pid_t pid);
#endif /* __PERF_THREAD_MAP_H */
Powered by blists - more mailing lists