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.
- 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
linux/list.hlinux/rbtree.hmap_symbol.hbranch.h
Detected Declarations
struct addr_locationstruct evselstruct hist_entrystruct histsstruct ip_callchainstruct mapstruct perf_samplestruct record_optsstruct threadstruct callchain_nodestruct callchain_rootstruct callchain_paramstruct callchain_paramstruct callchain_liststruct callchain_cursor_nodestruct stitch_liststruct callchain_cursorenum perf_call_graph_modeenum chain_modeenum chain_orderenum chain_keyenum chain_valuefunction callchain_initfunction callchain_cumul_hitsfunction callchain_cumul_countsfunction callchain_cursor_commitfunction callchain_cursor_currentfunction callchain_cursor_advancefunction callchain_cursor_snapshotfunction arch_skip_callchain_idx
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
- Immediate include surface: `linux/list.h`, `linux/rbtree.h`, `map_symbol.h`, `branch.h`.
- Detected declarations: `struct addr_location`, `struct evsel`, `struct hist_entry`, `struct hists`, `struct ip_callchain`, `struct map`, `struct perf_sample`, `struct record_opts`, `struct thread`, `struct callchain_node`.
- 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.