13ce311afSJiri Olsa /* SPDX-License-Identifier: GPL-2.0 */ 23ce311afSJiri Olsa #ifndef __LIBPERF_INTERNAL_CPUMAP_H 33ce311afSJiri Olsa #define __LIBPERF_INTERNAL_CPUMAP_H 43ce311afSJiri Olsa 53ce311afSJiri Olsa #include <linux/refcount.h> 6*30d1c4d9SJiri Olsa #include <perf/cpumap.h> 76d18804bSIan Rogers 8818ab78cSIan Rogers /** 9818ab78cSIan Rogers * A sized, reference counted, sorted array of integers representing CPU 10818ab78cSIan Rogers * numbers. This is commonly used to capture which CPUs a PMU is associated 11818ab78cSIan Rogers * with. The indices into the cpumap are frequently used as they avoid having 12818ab78cSIan Rogers * gaps if CPU numbers were used. For events associated with a pid, rather than 13818ab78cSIan Rogers * a CPU, a single dummy map with an entry of -1 is used. 14818ab78cSIan Rogers */ 153ce311afSJiri Olsa struct perf_cpu_map { 163ce311afSJiri Olsa refcount_t refcnt; 17818ab78cSIan Rogers /** Length of the map array. */ 183ce311afSJiri Olsa int nr; 19818ab78cSIan Rogers /** The CPU values. */ 206d18804bSIan Rogers struct perf_cpu map[]; 213ce311afSJiri Olsa }; 223ce311afSJiri Olsa 233ce311afSJiri Olsa #ifndef MAX_NR_CPUS 243ce311afSJiri Olsa #define MAX_NR_CPUS 2048 253ce311afSJiri Olsa #endif 263ce311afSJiri Olsa 276d18804bSIan Rogers int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu); 283ce311afSJiri Olsa 293ce311afSJiri Olsa #endif /* __LIBPERF_INTERNAL_CPUMAP_H */ 30