From: tip-bot2 for Jiri Olsa <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Jiri Olsa <jolsa@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Michael Petlan <mpetlan@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [tip: perf/core] libperf: Move perf's cpu_map__idx() to perf_cpu_map__idx()
Date: Fri, 23 Aug 2019 12:21:39 -0000 [thread overview]
Message-ID: <156656289921.31546.5483240567773794836.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20190822111141.25823-5-jolsa@kernel.org>
The following commit has been merged into the perf/core branch of tip:
Commit-ID: b4df75de3b3930703415aa053a269ae07c78d9b2
Gitweb: https://git.kernel.org/tip/b4df75de3b3930703415aa053a269ae07c78d9b2
Author: Jiri Olsa <jolsa@kernel.org>
AuthorDate: Thu, 22 Aug 2019 13:11:40 +02:00
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Thu, 22 Aug 2019 11:18:45 -03:00
libperf: Move perf's cpu_map__idx() to perf_cpu_map__idx()
As an internal function that will be used by both perf and libperf, but
is not exported at this point.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190822111141.25823-5-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/lib/cpumap.c | 12 ++++++++++++
tools/perf/lib/include/internal/cpumap.h | 2 ++
tools/perf/util/cpumap.c | 14 +-------------
tools/perf/util/cpumap.h | 1 -
tools/perf/util/evlist.c | 2 +-
5 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/tools/perf/lib/cpumap.c b/tools/perf/lib/cpumap.c
index 63f7df7..2834753 100644
--- a/tools/perf/lib/cpumap.c
+++ b/tools/perf/lib/cpumap.c
@@ -242,3 +242,15 @@ bool perf_cpu_map__empty(const struct perf_cpu_map *map)
{
return map ? map->map[0] == -1 : true;
}
+
+int perf_cpu_map__idx(struct perf_cpu_map *cpus, int cpu)
+{
+ int i;
+
+ for (i = 0; i < cpus->nr; ++i) {
+ if (cpus->map[i] == cpu)
+ return i;
+ }
+
+ return -1;
+}
diff --git a/tools/perf/lib/include/internal/cpumap.h b/tools/perf/lib/include/internal/cpumap.h
index 3306319..840d403 100644
--- a/tools/perf/lib/include/internal/cpumap.h
+++ b/tools/perf/lib/include/internal/cpumap.h
@@ -14,4 +14,6 @@ struct perf_cpu_map {
#define MAX_NR_CPUS 2048
#endif
+int perf_cpu_map__idx(struct perf_cpu_map *cpus, int cpu);
+
#endif /* __LIBPERF_INTERNAL_CPUMAP_H */
diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
index 4402e67..8e6c2cb 100644
--- a/tools/perf/util/cpumap.c
+++ b/tools/perf/util/cpumap.c
@@ -458,19 +458,7 @@ int cpu__setup_cpunode_map(void)
bool cpu_map__has(struct perf_cpu_map *cpus, int cpu)
{
- return cpu_map__idx(cpus, cpu) != -1;
-}
-
-int cpu_map__idx(struct perf_cpu_map *cpus, int cpu)
-{
- int i;
-
- for (i = 0; i < cpus->nr; ++i) {
- if (cpus->map[i] == cpu)
- return i;
- }
-
- return -1;
+ return perf_cpu_map__idx(cpus, cpu) != -1;
}
int cpu_map__cpu(struct perf_cpu_map *cpus, int idx)
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
index 3e06809..8dbedda 100644
--- a/tools/perf/util/cpumap.h
+++ b/tools/perf/util/cpumap.h
@@ -62,5 +62,4 @@ int cpu_map__build_map(struct perf_cpu_map *cpus, struct perf_cpu_map **res,
int cpu_map__cpu(struct perf_cpu_map *cpus, int idx);
bool cpu_map__has(struct perf_cpu_map *cpus, int cpu);
-int cpu_map__idx(struct perf_cpu_map *cpus, int cpu);
#endif /* __PERF_CPUMAP_H */
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index ba49b5e..8582560 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -758,7 +758,7 @@ static int perf_evlist__mmap_per_evsel(struct evlist *evlist, int idx,
if (evsel->system_wide && thread)
continue;
- cpu = cpu_map__idx(evsel->core.cpus, evlist_cpu);
+ cpu = perf_cpu_map__idx(evsel->core.cpus, evlist_cpu);
if (cpu == -1)
continue;
next prev parent reply other threads:[~2019-08-23 12:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-22 11:11 [PATCH 0/5] tools,libperf: Assorted fixes Jiri Olsa
2019-08-22 11:11 ` [PATCH 1/5] tools: Add missing perf_event.h include Jiri Olsa
2019-08-22 14:13 ` Arnaldo Carvalho de Melo
2019-08-22 11:11 ` [PATCH 2/5] libperf: Use perf_cpu_map__nr instead of cpu_map__nr Jiri Olsa
2019-08-22 11:11 ` [PATCH 3/5] libperf: Move cpu_map__empty to perf_cpu_map__empty Jiri Olsa
2019-08-23 12:21 ` [tip: perf/core] libperf: Move perf's cpu_map__empty() to perf_cpu_map__empty() tip-bot2 for Jiri Olsa
2019-08-22 11:11 ` [PATCH 4/5] libperf: Move cpu_map__idx to perf_cpu_map__idx Jiri Olsa
2019-08-23 12:21 ` tip-bot2 for Jiri Olsa [this message]
2019-08-22 11:11 ` [PATCH 5/5] libperf: Add perf_thread_map__nr/perf_thread_map__pid functions Jiri Olsa
2019-08-22 15:18 ` Arnaldo Carvalho de Melo
2019-08-23 12:29 ` [tip: perf/core] " tip-bot2 for Jiri Olsa
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=156656289921.31546.5483240567773794836.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mpetlan@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).