diff options
Diffstat (limited to 'tools/perf/lib')
-rw-r--r-- | tools/perf/lib/cpumap.c | 5 | ||||
-rw-r--r-- | tools/perf/lib/include/perf/cpumap.h | 2 | ||||
-rw-r--r-- | tools/perf/lib/libperf.map | 1 |
3 files changed, 8 insertions, 0 deletions
diff --git a/tools/perf/lib/cpumap.c b/tools/perf/lib/cpumap.c index 1ddb69e796e5..63f7df7e47ff 100644 --- a/tools/perf/lib/cpumap.c +++ b/tools/perf/lib/cpumap.c @@ -237,3 +237,8 @@ int perf_cpu_map__nr(const struct perf_cpu_map *cpus) { return cpus ? cpus->nr : 1; } + +bool perf_cpu_map__empty(const struct perf_cpu_map *map) +{ + return map ? map->map[0] == -1 : true; +} diff --git a/tools/perf/lib/include/perf/cpumap.h b/tools/perf/lib/include/perf/cpumap.h index 1b6e7db3fa2b..8aa995c59498 100644 --- a/tools/perf/lib/include/perf/cpumap.h +++ b/tools/perf/lib/include/perf/cpumap.h @@ -4,6 +4,7 @@ #include <perf/core.h> #include <stdio.h> +#include <stdbool.h> struct perf_cpu_map; @@ -14,6 +15,7 @@ LIBPERF_API struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map); LIBPERF_API void perf_cpu_map__put(struct perf_cpu_map *map); LIBPERF_API int perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx); LIBPERF_API int perf_cpu_map__nr(const struct perf_cpu_map *cpus); +LIBPERF_API bool perf_cpu_map__empty(const struct perf_cpu_map *map); #define perf_cpu_map__for_each_cpu(cpu, idx, cpus) \ for ((idx) = 0, (cpu) = perf_cpu_map__cpu(cpus, idx); \ diff --git a/tools/perf/lib/libperf.map b/tools/perf/lib/libperf.map index e24d3cec01c1..3373dd51fcda 100644 --- a/tools/perf/lib/libperf.map +++ b/tools/perf/lib/libperf.map @@ -8,6 +8,7 @@ LIBPERF_0.0.1 { perf_cpu_map__read; perf_cpu_map__nr; perf_cpu_map__cpu; + perf_cpu_map__empty; perf_thread_map__new_dummy; perf_thread_map__set_pid; perf_thread_map__comm; |