tools/perf/util/callchain.h

Source file repositories/reference/linux-study-clean/tools/perf/util/callchain.h

File Facts

System
Linux kernel
Corpus path
tools/perf/util/callchain.h
Extension
.h
Size
8743 bytes
Lines
319
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 callchain_node {
	struct callchain_node	*parent;
	struct list_head	val;
	struct list_head	parent_val;
	struct rb_node		rb_node_in; /* to insert nodes in an rbtree */
	struct rb_node		rb_node;    /* to sort nodes in an output tree */
	struct rb_root		rb_root_in; /* input tree of children */
	struct rb_root		rb_root;    /* sorted output tree of children */
	unsigned int		val_nr;
	unsigned int		count;
	unsigned int		children_count;
	u64			hit;
	u64			children_hit;
};

struct callchain_root {
	u64			max_depth;
	struct callchain_node	node;
};

struct callchain_param;

typedef void (*sort_chain_func_t)(struct rb_root *, struct callchain_root *,
				 u64, struct callchain_param *);

enum chain_key {
	CCKEY_FUNCTION,
	CCKEY_ADDRESS,
	CCKEY_SRCLINE
};

enum chain_value {
	CCVAL_PERCENT,
	CCVAL_PERIOD,
	CCVAL_COUNT,
};

extern bool dwarf_callchain_users;

struct callchain_param {
	bool			enabled;
	bool			defer;
	enum perf_call_graph_mode record_mode;
	u32			dump_size;
	enum chain_mode 	mode;
	u16			max_stack;
	u32			print_limit;
	double			min_percent;
	sort_chain_func_t	sort;
	enum chain_order	order;
	bool			order_set;
	enum chain_key		key;
	bool			branch_callstack;
	enum chain_value	value;
};

extern struct callchain_param callchain_param;
extern struct callchain_param callchain_param_default;

struct callchain_list {
	struct list_head	list;
	u64			ip;
	struct map_symbol	ms;
	const char		*srcline;
	u64			branch_count;
	u64			from_count;
	u64			cycles_count;
	u64			iter_count;
	u64			iter_cycles;
	struct branch_type_stat *brtype_stat;
	u64			predicted_count;
	u64			abort_count;
	struct /* for TUI */ {
		bool		unfolded;
		bool		has_children;
	};
};

/*
 * A callchain cursor is a single linked list that
 * let one feed a callchain progressively.
 * It keeps persistent allocated entries to minimize
 * allocations.
 */
struct callchain_cursor_node {
	u64				ip;
	struct map_symbol		ms;
	const char			*srcline;
	/* Indicate valid cursor node for LBR stitch */
	bool				valid;

Annotation

Implementation Notes