cpumap.h 938 B

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