tools/perf/util/cpumap.h
Source file repositories/reference/linux-study-clean/tools/perf/util/cpumap.h
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/cpumap.h- Extension
.h- Size
- 5918 bytes
- Lines
- 163
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdbool.hstdio.hperf/cpumap.h
Detected Declarations
struct aggr_cpu_idstruct cpu_aggr_mapstruct perf_record_cpu_map_datafunction cpu_map__is_dummy
Annotated Snippet
struct aggr_cpu_id {
/** A value in the range 0 to number of threads. */
int thread_idx;
/** The numa node X as read from /sys/devices/system/node/nodeX. */
int node;
/**
* The socket number as read from
* /sys/devices/system/cpu/cpuX/topology/physical_package_id.
*/
int socket;
/** The die id as read from /sys/devices/system/cpu/cpuX/topology/die_id. */
int die;
/** The cluster id as read from /sys/devices/system/cpu/cpuX/topology/cluster_id */
int cluster;
/** The cache level as read from /sys/devices/system/cpu/cpuX/cache/indexY/level */
int cache_lvl;
/**
* The cache instance ID, which is the first CPU in the
* /sys/devices/system/cpu/cpuX/cache/indexY/shared_cpu_list
*/
int cache;
/** The core id as read from /sys/devices/system/cpu/cpuX/topology/core_id. */
int core;
/** CPU aggregation, note there is one CPU for each SMT thread. */
struct perf_cpu cpu;
};
/** A collection of aggr_cpu_id values, the "built" version is sorted and uniqued. */
struct cpu_aggr_map {
/** Number of valid entries. */
int nr;
/** The entries. */
struct aggr_cpu_id map[];
};
#define cpu_aggr_map__for_each_idx(idx, aggr_map) \
for ((idx) = 0; (idx) < aggr_map->nr; (idx)++)
struct perf_record_cpu_map_data;
bool perf_record_cpu_map_data__test_bit(int i, const struct perf_record_cpu_map_data *data);
struct perf_cpu_map *perf_cpu_map__empty_new(int nr);
struct perf_cpu_map *cpu_map__new_data(const struct perf_record_cpu_map_data *data);
size_t cpu_map__snprint(struct perf_cpu_map *map, char *buf, size_t size);
size_t cpu_map__snprint_mask(struct perf_cpu_map *map, char *buf, size_t size);
size_t cpu_map__fprintf(struct perf_cpu_map *map, FILE *fp);
struct perf_cpu_map *cpu_map__online(void); /* thread unsafe */
int cpu__setup_cpunode_map(void);
int cpu__max_node(void);
struct perf_cpu cpu__max_cpu(void);
struct perf_cpu cpu__max_present_cpu(void);
/**
* cpu_map__is_dummy - Events associated with a pid, rather than a CPU, use a single dummy map with an entry of -1.
*/
static inline bool cpu_map__is_dummy(const struct perf_cpu_map *cpus)
{
return perf_cpu_map__nr(cpus) == 1 && perf_cpu_map__cpu(cpus, 0).cpu == -1;
}
/**
* cpu__get_node - Returns the numa node X as read from
* /sys/devices/system/node/nodeX for the given CPU.
*/
int cpu__get_node(struct perf_cpu cpu);
/**
* cpu__get_socket_id - Returns the socket number as read from
* /sys/devices/system/cpu/cpuX/topology/physical_package_id for the given CPU.
*/
int cpu__get_socket_id(struct perf_cpu cpu);
/**
* cpu__get_die_id - Returns the die id as read from
* /sys/devices/system/cpu/cpuX/topology/die_id for the given CPU.
*/
int cpu__get_die_id(struct perf_cpu cpu);
/**
* cpu__get_cluster_id - Returns the cluster id as read from
* /sys/devices/system/cpu/cpuX/topology/cluster_id for the given CPU
*/
int cpu__get_cluster_id(struct perf_cpu cpu);
/**
* cpu__get_core_id - Returns the core id as read from
* /sys/devices/system/cpu/cpuX/topology/core_id for the given CPU.
*/
int cpu__get_core_id(struct perf_cpu cpu);
Annotation
- Immediate include surface: `stdbool.h`, `stdio.h`, `perf/cpumap.h`.
- Detected declarations: `struct aggr_cpu_id`, `struct cpu_aggr_map`, `struct perf_record_cpu_map_data`, `function cpu_map__is_dummy`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.