1
2 #ifndef __LIBPERF_CPUMAP_H
3 #define __LIBPERF_CPUMAP_H
4
5 #include <perf/core.h>
6 #include <stdio.h>
7 #include <stdbool.h>
8
9 struct perf_cpu_map;
10
11 LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void);
12 LIBPERF_API struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list);
13 LIBPERF_API struct perf_cpu_map *perf_cpu_map__read(FILE *file);
14 LIBPERF_API struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map);
15 LIBPERF_API void perf_cpu_map__put(struct perf_cpu_map *map);
16 LIBPERF_API int perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx);
17 LIBPERF_API int perf_cpu_map__nr(const struct perf_cpu_map *cpus);
18 LIBPERF_API bool perf_cpu_map__empty(const struct perf_cpu_map *map);
19 LIBPERF_API int perf_cpu_map__max(struct perf_cpu_map *map);
20
21 #define perf_cpu_map__for_each_cpu(cpu, idx, cpus) \
22 for ((idx) = 0, (cpu) = perf_cpu_map__cpu(cpus, idx); \
23 (idx) < perf_cpu_map__nr(cpus); \
24 (idx)++, (cpu) = perf_cpu_map__cpu(cpus, idx))
25
26 #endif