Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1378492
| From | tip-bot for Jiri Olsa <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:perf/core] perf cpu_map: Add has() method |
| Date | 2016-04-14 07:50 +0200 |
| Message-ID | <rnIkb-5eG-17@gated-at.bofh.it> (permalink) |
| References | <rn6yf-83Y-35@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: e632aa69c919462a7f93c8799b97c8a9ddd48fc2
Gitweb: http://git.kernel.org/tip/e632aa69c919462a7f93c8799b97c8a9ddd48fc2
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Tue, 12 Apr 2016 15:29:25 +0200
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 13 Apr 2016 10:11:50 -0300
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>
---
tools/perf/util/cpumap.c | 12 ++++++++++++
tools/perf/util/cpumap.h | 2 ++
2 files changed, 14 insertions(+)
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index 9bcf2be..02d8016 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;
+}
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
index 81a2562..1a0a350 100644
--- a/tools/perf/util/cpumap.h
+++ b/tools/perf/util/cpumap.h
@@ -66,4 +66,6 @@ int cpu__get_node(int cpu);
int cpu_map__build_map(struct cpu_map *cpus, struct cpu_map **res,
int (*f)(struct cpu_map *map, int cpu, void *data),
void *data);
+
+bool cpu_map__has(struct cpu_map *cpus, int cpu);
#endif /* __PERF_CPUMAP_H */
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/8] perf tools: Add sched map changes Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:30 +0200
[PATCH 2/8] perf tools: Add cpu_map__has function Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:30 +0200
[tip:perf/core] perf cpu_map: Add has() method tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
[PATCH 1/8] perf tools: Add thread_map__has function Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:30 +0200
[tip:perf/core] perf thread_map: Add has() method tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
[PATCH 6/8] perf tools sched: Collor given pids Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
[tip:perf/core] perf sched map: Color given pids tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
[PATCH 7/8] perf tools sched: Collor given cpus Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
[tip:perf/core] perf sched map: Color given cpus tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
[PATCH 4/8] perf tools sched: Use color_fprintf for output Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
[tip:perf/core] perf sched: Use color_fprintf for output tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
[PATCH 8/8] perf tools sched: Display only given cpus Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
[tip:perf/core] perf sched map: Display only given cpus tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
[PATCH 5/8] perf tools sched: Make thread_map__new_by_tid_str global Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
[tip:perf/core] perf thread_map: Make new_by_tid_str constructor public tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
[PATCH 3/8] perf tools sched: Add compact display option Jiri Olsa <jolsa@kernel.org> - 2016-04-12 15:40 +0200
Re: [PATCH 3/8] perf tools sched: Add compact display option Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-12 16:20 +0200
Re: [PATCH 3/8] perf tools sched: Add compact display option Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-12 16:20 +0200
[tip:perf/core] perf sched: Add compact display option tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-04-14 07:50 +0200
Re: [PATCH 0/8] perf tools: Add sched map changes Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-12 16:40 +0200
csiph-web