Linux Perf
callchain.h File Reference
#include "../perf.h"
#include <linux/list.h>
#include <linux/rbtree.h>
#include "event.h"
#include "map.h"
#include "symbol.h"
#include "branch.h"
Include dependency graph for callchain.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  callchain_node
 
struct  callchain_root
 
struct  callchain_param
 
struct  callchain_list
 
struct  callchain_cursor_node
 
struct  callchain_cursor
 

Macros

#define HELP_PAD   "\t\t\t\t"
 
#define CALLCHAIN_HELP   "setup and enables call-graph (stack chain/backtrace):\n\n"
 
#define RECORD_MODE_HELP   HELP_PAD "record_mode:\tcall graph recording mode (fp|dwarf|lbr)\n"
 
#define RECORD_SIZE_HELP
 
#define CALLCHAIN_RECORD_HELP   CALLCHAIN_HELP RECORD_MODE_HELP RECORD_SIZE_HELP
 
#define CALLCHAIN_REPORT_HELP
 

Typedefs

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

Enumerations

enum  perf_call_graph_mode {
  CALLCHAIN_NONE, CALLCHAIN_FP, CALLCHAIN_DWARF, CALLCHAIN_LBR,
  CALLCHAIN_MAX
}
 
enum  chain_mode {
  CHAIN_NONE, CHAIN_FLAT, CHAIN_GRAPH_ABS, CHAIN_GRAPH_REL,
  CHAIN_FOLDED
}
 
enum  chain_order { ORDER_CALLER, ORDER_CALLEE }
 
enum  chain_key { CCKEY_FUNCTION, CCKEY_ADDRESS, CCKEY_SRCLINE }
 
enum  chain_value { CCVAL_PERCENT, CCVAL_PERIOD, CCVAL_COUNT }
 

Functions

static void callchain_init (struct callchain_root *root)
 
static u64 callchain_cumul_hits (struct callchain_node *node)
 
static unsigned callchain_cumul_counts (struct callchain_node *node)
 
int callchain_register_param (struct callchain_param *param)
 
int callchain_append (struct callchain_root *root, struct callchain_cursor *cursor, u64 period)
 
int callchain_merge (struct callchain_cursor *cursor, struct callchain_root *dst, struct callchain_root *src)
 
static void callchain_cursor_reset (struct callchain_cursor *cursor)
 
int callchain_cursor_append (struct callchain_cursor *cursor, u64 ip, struct map *map, struct symbol *sym, bool branch, struct branch_flags *flags, int nr_loop_iter, u64 iter_cycles, u64 branch_from, const char *srcline)
 
static void callchain_cursor_commit (struct callchain_cursor *cursor)
 
static struct callchain_cursor_nodecallchain_cursor_current (struct callchain_cursor *cursor)
 
static void callchain_cursor_advance (struct callchain_cursor *cursor)
 
int callchain_cursor__copy (struct callchain_cursor *dst, struct callchain_cursor *src)
 
int record_parse_callchain_opt (const struct option *opt, const char *arg, int unset)
 
int record_callchain_opt (const struct option *opt, const char *arg, int unset)
 
int record_opts__parse_callchain (struct record_opts *record, struct callchain_param *callchain, const char *arg, bool unset)
 
int sample__resolve_callchain (struct perf_sample *sample, struct callchain_cursor *cursor, struct symbol **parent, struct perf_evsel *evsel, struct addr_location *al, int max_stack)
 
int hist_entry__append_callchain (struct hist_entry *he, struct perf_sample *sample)
 
int fill_callchain_info (struct addr_location *al, struct callchain_cursor_node *node, bool hide_unresolved)
 
int parse_callchain_record (const char *arg, struct callchain_param *param)
 
int parse_callchain_record_opt (const char *arg, struct callchain_param *param)
 
int parse_callchain_report_opt (const char *arg)
 
int parse_callchain_top_opt (const char *arg)
 
int perf_callchain_config (const char *var, const char *value)
 
static void callchain_cursor_snapshot (struct callchain_cursor *dest, struct callchain_cursor *src)
 
static int arch_skip_callchain_idx (struct thread *thread __maybe_unused, struct ip_callchain *chain __maybe_unused)
 
char * callchain_list__sym_name (struct callchain_list *cl, char *bf, size_t bfsize, bool show_dso)
 
char * callchain_node__scnprintf_value (struct callchain_node *node, char *bf, size_t bfsize, u64 total)
 
int callchain_node__fprintf_value (struct callchain_node *node, FILE *fp, u64 total)
 
int callchain_list_counts__printf_value (struct callchain_list *clist, FILE *fp, char *bf, int bfsize)
 
void free_callchain (struct callchain_root *root)
 
void decay_callchain (struct callchain_root *root)
 
int callchain_node__make_parent_list (struct callchain_node *node)
 
int callchain_branch_counts (struct callchain_root *root, u64 *branch_count, u64 *predicted_count, u64 *abort_count, u64 *cycles_count)
 

Variables

bool dwarf_callchain_users
 
struct callchain_param callchain_param
 
struct callchain_param callchain_param_default
 
__thread struct callchain_cursor callchain_cursor
 
const char record_callchain_help []
 

Macro Definition Documentation

◆ CALLCHAIN_HELP

#define CALLCHAIN_HELP   "setup and enables call-graph (stack chain/backtrace):\n\n"

Definition at line 15 of file callchain.h.

◆ CALLCHAIN_RECORD_HELP

#define CALLCHAIN_RECORD_HELP   CALLCHAIN_HELP RECORD_MODE_HELP RECORD_SIZE_HELP

Definition at line 23 of file callchain.h.

◆ CALLCHAIN_REPORT_HELP

#define CALLCHAIN_REPORT_HELP
Value:
HELP_PAD "print_type:\tcall graph printing style (graph|flat|fractal|folded|none)\n" \
HELP_PAD "threshold:\tminimum call graph inclusion threshold (<percent>)\n" \
HELP_PAD "print_limit:\tmaximum number of call graph entry (<number>)\n" \
HELP_PAD "order:\t\tcall graph order (caller|callee)\n" \
HELP_PAD "sort_key:\tcall graph sort key (function|address)\n" \
HELP_PAD "branch:\t\tinclude last branch info to call graph (branch)\n" \
HELP_PAD "value:\t\tcall graph value (percent|period|count)\n"
#define HELP_PAD
Definition: callchain.h:13

Definition at line 25 of file callchain.h.

◆ HELP_PAD

#define HELP_PAD   "\t\t\t\t"

Definition at line 13 of file callchain.h.

◆ RECORD_MODE_HELP

#define RECORD_MODE_HELP   HELP_PAD "record_mode:\tcall graph recording mode (fp|dwarf|lbr)\n"

Definition at line 17 of file callchain.h.

◆ RECORD_SIZE_HELP

#define RECORD_SIZE_HELP
Value:
HELP_PAD "record_size:\tif record_mode is 'dwarf', max size of stack recording (<bytes>)\n" \
HELP_PAD "\t\tdefault: 8192 (bytes)\n"
#define HELP_PAD
Definition: callchain.h:13

Definition at line 19 of file callchain.h.

Typedef Documentation

◆ sort_chain_func_t

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

Definition at line 77 of file callchain.h.

Enumeration Type Documentation

◆ chain_key

enum chain_key
Enumerator
CCKEY_FUNCTION 
CCKEY_ADDRESS 
CCKEY_SRCLINE 

Definition at line 80 of file callchain.h.

◆ chain_mode

enum chain_mode
Enumerator
CHAIN_NONE 
CHAIN_FLAT 
CHAIN_GRAPH_ABS 
CHAIN_GRAPH_REL 
CHAIN_FOLDED 

Definition at line 42 of file callchain.h.

◆ chain_order

Enumerator
ORDER_CALLER 
ORDER_CALLEE 

Definition at line 50 of file callchain.h.

◆ chain_value

Enumerator
CCVAL_PERCENT 
CCVAL_PERIOD 
CCVAL_COUNT 

Definition at line 86 of file callchain.h.

◆ perf_call_graph_mode

Enumerator
CALLCHAIN_NONE 
CALLCHAIN_FP 
CALLCHAIN_DWARF 
CALLCHAIN_LBR 
CALLCHAIN_MAX 

Definition at line 34 of file callchain.h.

Function Documentation

◆ arch_skip_callchain_idx()

static int arch_skip_callchain_idx ( struct thread *thread  __maybe_unused,
struct ip_callchain *chain  __maybe_unused 
)
inlinestatic

Definition at line 276 of file callchain.h.

Here is the call graph for this function:

◆ callchain_append()

int callchain_append ( struct callchain_root root,
struct callchain_cursor cursor,
u64  period 
)

Definition at line 969 of file callchain.c.

Here is the call graph for this function:

◆ callchain_branch_counts()

int callchain_branch_counts ( struct callchain_root root,
u64 *  branch_count,
u64 *  predicted_count,
u64 *  abort_count,
u64 *  cycles_count 
)

Definition at line 1271 of file callchain.c.

Here is the call graph for this function:

◆ callchain_cumul_counts()

static unsigned callchain_cumul_counts ( struct callchain_node node)
inlinestatic

Definition at line 177 of file callchain.h.

Here is the call graph for this function:

◆ callchain_cumul_hits()

static u64 callchain_cumul_hits ( struct callchain_node node)
inlinestatic

Definition at line 172 of file callchain.h.

◆ callchain_cursor__copy()

int callchain_cursor__copy ( struct callchain_cursor dst,
struct callchain_cursor src 
)

Definition at line 1544 of file callchain.c.

Here is the call graph for this function:

◆ callchain_cursor_advance()

static void callchain_cursor_advance ( struct callchain_cursor cursor)
inlinestatic

Definition at line 228 of file callchain.h.

Here is the call graph for this function:

◆ callchain_cursor_append()

int callchain_cursor_append ( struct callchain_cursor cursor,
u64  ip,
struct map map,
struct symbol sym,
bool  branch,
struct branch_flags flags,
int  nr_loop_iter,
u64  iter_cycles,
u64  branch_from,
const char *  srcline 
)

Definition at line 1038 of file callchain.c.

Here is the call graph for this function:

◆ callchain_cursor_commit()

static void callchain_cursor_commit ( struct callchain_cursor cursor)
inlinestatic

Definition at line 212 of file callchain.h.

◆ callchain_cursor_current()

static struct callchain_cursor_node* callchain_cursor_current ( struct callchain_cursor cursor)
static

Definition at line 220 of file callchain.h.

◆ callchain_cursor_reset()

static void callchain_cursor_reset ( struct callchain_cursor cursor)
inlinestatic

Definition at line 194 of file callchain.h.

Here is the call graph for this function:

◆ callchain_cursor_snapshot()

static void callchain_cursor_snapshot ( struct callchain_cursor dest,
struct callchain_cursor src 
)
inlinestatic

Definition at line 264 of file callchain.h.

Here is the call graph for this function:

◆ callchain_init()

static void callchain_init ( struct callchain_root root)
inlinestatic

Definition at line 160 of file callchain.h.

◆ callchain_list__sym_name()

char* callchain_list__sym_name ( struct callchain_list cl,
char *  bf,
size_t  bfsize,
bool  show_dso 
)

Definition at line 1139 of file callchain.c.

◆ callchain_list_counts__printf_value()

int callchain_list_counts__printf_value ( struct callchain_list clist,
FILE *  fp,
char *  bf,
int  bfsize 
)

Definition at line 1419 of file callchain.c.

Here is the call graph for this function:

◆ callchain_merge()

int callchain_merge ( struct callchain_cursor cursor,
struct callchain_root dst,
struct callchain_root src 
)

Definition at line 1032 of file callchain.c.

Here is the call graph for this function:

◆ callchain_node__fprintf_value()

int callchain_node__fprintf_value ( struct callchain_node node,
FILE *  fp,
u64  total 
)

Definition at line 1197 of file callchain.c.

Here is the call graph for this function:

◆ callchain_node__make_parent_list()

int callchain_node__make_parent_list ( struct callchain_node node)

Definition at line 1504 of file callchain.c.

Here is the call graph for this function:

◆ callchain_node__scnprintf_value()

char* callchain_node__scnprintf_value ( struct callchain_node node,
char *  bf,
size_t  bfsize,
u64  total 
)

Definition at line 1168 of file callchain.c.

Here is the call graph for this function:

◆ callchain_register_param()

int callchain_register_param ( struct callchain_param param)

Definition at line 494 of file callchain.c.

Here is the call graph for this function:

◆ decay_callchain()

void decay_callchain ( struct callchain_root root)

Definition at line 1496 of file callchain.c.

Here is the call graph for this function:

◆ fill_callchain_info()

int fill_callchain_info ( struct addr_location al,
struct callchain_cursor_node node,
bool  hide_unresolved 
)

Definition at line 1099 of file callchain.c.

Here is the call graph for this function:

◆ free_callchain()

void free_callchain ( struct callchain_root root)

Definition at line 1468 of file callchain.c.

Here is the call graph for this function:

◆ hist_entry__append_callchain()

int hist_entry__append_callchain ( struct hist_entry he,
struct perf_sample sample 
)

Definition at line 1091 of file callchain.c.

Here is the call graph for this function:

◆ parse_callchain_record()

int parse_callchain_record ( const char *  arg,
struct callchain_param param 
)

Definition at line 243 of file callchain.c.

Here is the call graph for this function:

◆ parse_callchain_record_opt()

int parse_callchain_record_opt ( const char *  arg,
struct callchain_param param 
)

Definition at line 55 of file callchain.c.

Here is the call graph for this function:

◆ parse_callchain_report_opt()

int parse_callchain_report_opt ( const char *  arg)

Definition at line 233 of file callchain.c.

Here is the call graph for this function:

◆ parse_callchain_top_opt()

int parse_callchain_top_opt ( const char *  arg)

Definition at line 238 of file callchain.c.

Here is the call graph for this function:

◆ perf_callchain_config()

int perf_callchain_config ( const char *  var,
const char *  value 
)

Definition at line 306 of file callchain.c.

Here is the call graph for this function:

◆ record_callchain_opt()

int record_callchain_opt ( const struct option *  opt,
const char *  arg,
int  unset 
)

◆ record_opts__parse_callchain()

int record_opts__parse_callchain ( struct record_opts record,
struct callchain_param callchain,
const char *  arg,
bool  unset 
)

Definition at line 1224 of file builtin-record.c.

Here is the call graph for this function:

◆ record_parse_callchain_opt()

int record_parse_callchain_opt ( const struct option *  opt,
const char *  arg,
int  unset 
)

Definition at line 1249 of file builtin-record.c.

Here is the call graph for this function:

◆ sample__resolve_callchain()

int sample__resolve_callchain ( struct perf_sample sample,
struct callchain_cursor cursor,
struct symbol **  parent,
struct perf_evsel evsel,
struct addr_location al,
int  max_stack 
)

Definition at line 1075 of file callchain.c.

Here is the call graph for this function:

Variable Documentation

◆ callchain_cursor

Definition at line 53 of file callchain.c.

◆ callchain_param

Definition at line 36 of file callchain.c.

◆ callchain_param_default

struct callchain_param callchain_param_default

Definition at line 49 of file callchain.c.

◆ dwarf_callchain_users

bool dwarf_callchain_users

Definition at line 47 of file callchain.c.

◆ record_callchain_help

const char record_callchain_help[]

Definition at line 1535 of file builtin-record.c.