Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LIBPERF_INTERNAL_CPUMAP_H
3#define __LIBPERF_INTERNAL_CPUMAP_H
4
5#include <linux/refcount.h>
6
7/** A wrapper around a CPU to avoid confusion with the perf_cpu_map's map's indices. */
8struct perf_cpu {
9 int cpu;
10};
11
12/**
13 * A sized, reference counted, sorted array of integers representing CPU
14 * numbers. This is commonly used to capture which CPUs a PMU is associated
15 * with. The indices into the cpumap are frequently used as they avoid having
16 * gaps if CPU numbers were used. For events associated with a pid, rather than
17 * a CPU, a single dummy map with an entry of -1 is used.
18 */
19struct perf_cpu_map {
20 refcount_t refcnt;
21 /** Length of the map array. */
22 int nr;
23 /** The CPU values. */
24 struct perf_cpu map[];
25};
26
27#ifndef MAX_NR_CPUS
28#define MAX_NR_CPUS 2048
29#endif
30
31int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu);
32
33#endif /* __LIBPERF_INTERNAL_CPUMAP_H */