Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __LIBPERF_INTERNAL_CPUMAP_H
0003 #define __LIBPERF_INTERNAL_CPUMAP_H
0004 
0005 #include <linux/refcount.h>
0006 #include <perf/cpumap.h>
0007 
0008 /**
0009  * A sized, reference counted, sorted array of integers representing CPU
0010  * numbers. This is commonly used to capture which CPUs a PMU is associated
0011  * with. The indices into the cpumap are frequently used as they avoid having
0012  * gaps if CPU numbers were used. For events associated with a pid, rather than
0013  * a CPU, a single dummy map with an entry of -1 is used.
0014  */
0015 struct perf_cpu_map {
0016     refcount_t  refcnt;
0017     /** Length of the map array. */
0018     int     nr;
0019     /** The CPU values. */
0020     struct perf_cpu map[];
0021 };
0022 
0023 #ifndef MAX_NR_CPUS
0024 #define MAX_NR_CPUS 2048
0025 #endif
0026 
0027 int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu);
0028 bool perf_cpu_map__is_subset(const struct perf_cpu_map *a, const struct perf_cpu_map *b);
0029 
0030 #endif /* __LIBPERF_INTERNAL_CPUMAP_H */