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 9struct perf_cpu_map; 10 11LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void); 12LIBPERF_API struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list); 13LIBPERF_API struct perf_cpu_map *perf_cpu_map__read(FILE *file); 14LIBPERF_API struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map); 15LIBPERF_API struct perf_cpu_map *perf_cpu_map__merge(struct perf_cpu_map *orig, 16 struct perf_cpu_map *other); 17LIBPERF_API void perf_cpu_map__put(struct perf_cpu_map *map); 18LIBPERF_API int perf_cpu_map__cpu(const struct perf_cpu_map *cpus, int idx); 19LIBPERF_API int perf_cpu_map__nr(const struct perf_cpu_map *cpus); 20LIBPERF_API bool perf_cpu_map__empty(const struct perf_cpu_map *map); 21LIBPERF_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