• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
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 struct perf_cpu_map *perf_cpu_map__merge(struct perf_cpu_map *orig,
16 						     struct perf_cpu_map *other);
17 LIBPERF_API void perf_cpu_map__put(struct perf_cpu_map *map);
18 LIBPERF_API int perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx);
19 LIBPERF_API int perf_cpu_map__nr(const struct perf_cpu_map *cpus);
20 LIBPERF_API bool perf_cpu_map__empty(const struct perf_cpu_map *map);
21 LIBPERF_API int perf_cpu_map__max(struct perf_cpu_map *map);
22 
23 #define perf_cpu_map__for_each_cpu(cpu, idx, cpus)		\
24 	for ((idx) = 0, (cpu) = perf_cpu_map__cpu(cpus, idx);	\
25 	     (idx) < perf_cpu_map__nr(cpus);			\
26 	     (idx)++, (cpu) = perf_cpu_map__cpu(cpus, idx))
27 
28 #endif /* __LIBPERF_CPUMAP_H */
29