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.

Dependency Surface

Detected Declarations

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

Implementation Notes