diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-04-12 15:29:25 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-13 15:11:50 +0200 |
commit | e632aa69c919462a7f93c8799b97c8a9ddd48fc2 (patch) | |
tree | 270631decb16effe6e052ac82785737227d92e15 /tools/perf/util/cpumap.c | |
parent | perf thread_map: Add has() method (diff) | |
download | linux-e632aa69c919462a7f93c8799b97c8a9ddd48fc2.tar.xz linux-e632aa69c919462a7f93c8799b97c8a9ddd48fc2.zip |
perf cpu_map: Add has() method
Adding cpu_map__has() to return bool of cpu presence in cpus 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-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/cpumap.c')
-rw-r--r-- | tools/perf/util/cpumap.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c index 9bcf2bed3a6d..02d801670f30 100644 --- a/tools/perf/util/cpumap.c +++ b/tools/perf/util/cpumap.c @@ -587,3 +587,15 @@ int cpu__setup_cpunode_map(void) closedir(dir1); return 0; } + +bool cpu_map__has(struct cpu_map *cpus, int cpu) +{ + int i; + + for (i = 0; i < cpus->nr; ++i) { + if (cpus->map[i] == cpu) + return true; + } + + return false; +} |