Path: blob/master/tools/lib/perf/include/internal/cpumap.h
26302 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef __LIBPERF_INTERNAL_CPUMAP_H2#define __LIBPERF_INTERNAL_CPUMAP_H34#include <linux/refcount.h>5#include <perf/cpumap.h>6#include <internal/rc_check.h>78/**9* A sized, reference counted, sorted array of integers representing CPU10* numbers. This is commonly used to capture which CPUs a PMU is associated11* with. The indices into the cpumap are frequently used as they avoid having12* gaps if CPU numbers were used. For events associated with a pid, rather than13* a CPU, a single dummy map with an entry of -1 is used.14*/15DECLARE_RC_STRUCT(perf_cpu_map) {16refcount_t refcnt;17/** Length of the map array. */18int nr;19/** The CPU values. */20struct perf_cpu map[];21};2223struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus);24int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu);25bool perf_cpu_map__is_subset(const struct perf_cpu_map *a, const struct perf_cpu_map *b);2627void perf_cpu_map__set_nr(struct perf_cpu_map *map, int nr_cpus);2829static inline refcount_t *perf_cpu_map__refcnt(struct perf_cpu_map *map)30{31return &RC_CHK_ACCESS(map)->refcnt;32}33#endif /* __LIBPERF_INTERNAL_CPUMAP_H */343536