tools/perf/util/machine.h
Source file repositories/reference/linux-study-clean/tools/perf/util/machine.h
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/machine.h- Extension
.h- Size
- 11028 bytes
- Lines
- 337
- 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
sys/types.hlinux/rbtree.hmaps.hdsos.hrwsem.hthreads.h
Detected Declarations
struct addr_locationstruct branch_stackstruct dsostruct dso_idstruct evselstruct perf_samplestruct symbolstruct targetstruct threadstruct machinesstruct vdso_infostruct machinestruct machinesstruct callchain_cursorstruct thread_liststruct extra_kernel_mapfunction kernelfunction kernelfunction machine__kernel_startfunction machine__kernel_ipfunction thread__resolve_callchainfunction machine__is_default_guestfunction machine__is_host
Annotated Snippet
struct machine {
struct rb_node rb_node;
pid_t pid;
u16 id_hdr_size;
bool comm_exec;
bool kptr_restrict_warned;
bool single_address_space;
char *root_dir;
char *mmap_name;
char *kallsyms_filename;
struct threads threads;
struct vdso_info *vdso_info;
struct perf_env *env;
struct dsos dsos;
struct maps *kmaps;
struct map *vmlinux_map;
u64 kernel_start;
struct {
u64 text_start;
u64 text_end;
} sched, lock, traceiter, trace;
/*
* The current parallelism level (number of threads that run on CPUs).
* This value can be less than 1, or larger than the total number
* of CPUs, if events are poorly ordered.
*/
int parallelism;
pid_t *current_tid;
size_t current_tid_sz;
union { /* Tool specific area */
void *priv;
u64 db_id;
};
struct machines *machines;
bool trampolines_mapped;
};
/*
* The main kernel (vmlinux) map
*/
static inline
struct map *machine__kernel_map(struct machine *machine)
{
return machine->vmlinux_map;
}
/*
* kernel (the one returned by machine__kernel_map()) plus kernel modules maps
*/
static inline
struct maps *machine__kernel_maps(struct machine *machine)
{
return machine->kmaps;
}
int machine__get_kernel_start(struct machine *machine);
static inline u64 machine__kernel_start(struct machine *machine)
{
if (!machine->kernel_start)
machine__get_kernel_start(machine);
return machine->kernel_start;
}
static inline bool machine__kernel_ip(struct machine *machine, u64 ip)
{
u64 kernel_start = machine__kernel_start(machine);
return ip >= kernel_start;
}
u8 machine__addr_cpumode(struct machine *machine, u8 cpumode, u64 addr);
struct thread *machine__find_thread(struct machine *machine, pid_t pid,
pid_t tid);
struct thread *machine__idle_thread(struct machine *machine);
struct comm *machine__thread_exec_comm(struct machine *machine,
struct thread *thread);
int machine__process_comm_event(struct machine *machine, union perf_event *event,
struct perf_sample *sample);
int machine__process_exit_event(struct machine *machine, union perf_event *event,
struct perf_sample *sample);
int machine__process_fork_event(struct machine *machine, union perf_event *event,
struct perf_sample *sample);
int machine__process_lost_event(struct machine *machine, union perf_event *event,
struct perf_sample *sample);
int machine__process_lost_samples_event(struct machine *machine, union perf_event *event,
struct perf_sample *sample);
int machine__process_aux_event(struct machine *machine,
Annotation
- Immediate include surface: `sys/types.h`, `linux/rbtree.h`, `maps.h`, `dsos.h`, `rwsem.h`, `threads.h`.
- Detected declarations: `struct addr_location`, `struct branch_stack`, `struct dso`, `struct dso_id`, `struct evsel`, `struct perf_sample`, `struct symbol`, `struct target`, `struct thread`, `struct machines`.
- 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.