diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-09-02 15:12:53 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-09-10 16:33:32 +0300 |
commit | 4256d434935e9c85a731823be562785494ca364b (patch) | |
tree | 332664e6c61b1ea891cd2b3849b15a28361d1ab7 /tools/perf/lib/cpumap.c | |
parent | 227cb129858a3eb4b874937274b09834ffcc39b0 (diff) | |
download | linux-4256d434935e9c85a731823be562785494ca364b.tar.xz |
libperf: Adopt perf_cpu_map__max() function
From 'perf stat', so that it can be used from multiple places.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Joe Mario <jmario@redhat.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20190902121255.536-2-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/lib/cpumap.c')
-rw-r--r-- | tools/perf/lib/cpumap.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/lib/cpumap.c b/tools/perf/lib/cpumap.c index 1f0e6f334237..2ca1fafa620d 100644 --- a/tools/perf/lib/cpumap.c +++ b/tools/perf/lib/cpumap.c @@ -260,3 +260,15 @@ int perf_cpu_map__idx(struct perf_cpu_map *cpus, int cpu) return -1; } + +int perf_cpu_map__max(struct perf_cpu_map *map) +{ + int i, max = -1; + + for (i = 0; i < map->nr; i++) { + if (map->map[i] > max) + max = map->map[i]; + } + + return max; +} |