]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
libperf: Move perf's cpu_map__idx() to perf_cpu_map__idx()
authorJiri Olsa <jolsa@kernel.org>
Thu, 22 Aug 2019 11:11:40 +0000 (13:11 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 22 Aug 2019 14:18:45 +0000 (11:18 -0300)
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
tools/perf/lib/include/internal/cpumap.h
tools/perf/util/cpumap.c
tools/perf/util/cpumap.h
tools/perf/util/evlist.c

index 63f7df7e47ffb8c0d62e22a9198583958ee70095..2834753576b2658b47c83c024f6e5cbffb4743bb 100644 (file)
@@ -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;
+}
index 3306319f7df86ca7b495ac0e590006afe33af66e..840d4032587b59bf0640debbd9ca81349a84ca31 100644 (file)
@@ -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 */
index 4402e67445a40ca4250531999016cc592d1299b4..8e6c2cbffedce353333595ceb36f039193b5aa76 100644 (file)
@@ -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)
index 3e068090612ffaa8dac95370f183f8347f5c701c..8dbedda7af45788b337e390a686938d05954ec2d 100644 (file)
@@ -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 */
index ba49b5ecffd067615d05dd149a7611794216a735..8582560b59afe202484f6bac8ed643ddcc6cfa8b 100644 (file)
@@ -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;