From: Jiri Olsa <jolsa@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
David Ahern <dsahern@gmail.com>, Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 2/8] perf tools: Add cpu_map__has function
Date: Tue, 12 Apr 2016 15:29:25 +0200 [thread overview]
Message-ID: <1460467771-26532-3-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1460467771-26532-1-git-send-email-jolsa@kernel.org>
Adding cpu_map__has function to return bool
of cpu presence in cpus map.
Link: http://lkml.kernel.org/n/tip-tygq9cdzleyl7kv4wsz32s8n@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
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 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;
+}
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
index 81a2562aaa2b..1a0a35073ce1 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 */
--
2.4.11
next prev parent reply other threads:[~2016-04-12 13:29 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-12 13:29 [PATCH 0/8] perf tools: Add sched map changes Jiri Olsa
2016-04-12 13:29 ` [PATCH 1/8] perf tools: Add thread_map__has function Jiri Olsa
2016-04-14 5:43 ` [tip:perf/core] perf thread_map: Add has() method tip-bot for Jiri Olsa
2016-04-12 13:29 ` Jiri Olsa [this message]
2016-04-14 5:43 ` [tip:perf/core] perf cpu_map: " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 3/8] perf tools sched: Add compact display option Jiri Olsa
2016-04-12 14:09 ` Arnaldo Carvalho de Melo
2016-04-12 14:18 ` Arnaldo Carvalho de Melo
2016-04-14 5:44 ` [tip:perf/core] perf " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 4/8] perf tools sched: Use color_fprintf for output Jiri Olsa
2016-04-14 5:44 ` [tip:perf/core] perf " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 5/8] perf tools sched: Make thread_map__new_by_tid_str global Jiri Olsa
2016-04-14 5:44 ` [tip:perf/core] perf thread_map: Make new_by_tid_str constructor public tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 6/8] perf tools sched: Collor given pids Jiri Olsa
2016-04-14 5:45 ` [tip:perf/core] perf sched map: Color " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 7/8] perf tools sched: Collor given cpus Jiri Olsa
2016-04-14 5:45 ` [tip:perf/core] perf sched map: Color " tip-bot for Jiri Olsa
2016-04-12 13:29 ` [PATCH 8/8] perf tools sched: Display only " Jiri Olsa
2016-04-14 5:46 ` [tip:perf/core] perf sched map: " tip-bot for Jiri Olsa
2016-04-12 14:38 ` [PATCH 0/8] perf tools: Add sched map changes Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460467771-26532-3-git-send-email-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=dsahern@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox