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>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
3407df8bbc
commit
e632aa69c9
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user