Linux Perf
builtin-script.c File Reference
#include "builtin.h"
#include "perf.h"
#include "util/cache.h"
#include "util/debug.h"
#include <subcmd/exec-cmd.h>
#include "util/header.h"
#include <subcmd/parse-options.h>
#include "util/perf_regs.h"
#include "util/session.h"
#include "util/tool.h"
#include "util/symbol.h"
#include "util/thread.h"
#include "util/trace-event.h"
#include "util/util.h"
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/sort.h"
#include "util/data.h"
#include "util/auxtrace.h"
#include "util/cpumap.h"
#include "util/thread_map.h"
#include "util/stat.h"
#include "util/color.h"
#include "util/string2.h"
#include "util/thread-stack.h"
#include "util/time-utils.h"
#include "util/path.h"
#include "print_binary.h"
#include <linux/bitmap.h>
#include <linux/kernel.h>
#include <linux/stringify.h>
#include <linux/time64.h>
#include "asm/bug.h"
#include "util/mem-events.h"
#include "util/dump-insn.h"
#include <dirent.h>
#include <errno.h>
#include <inttypes.h>
#include <signal.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "sane_ctype.h"
Include dependency graph for builtin-script.c:

Go to the source code of this file.

Classes

struct  output_option
 
struct  perf_evsel_script
 
struct  printer_data
 
struct  perf_script
 
struct  metric_ctx
 
struct  script_spec
 
struct  script_desc
 

Macros

#define PRINT_FIELD(x)   (output[output_type(attr->type)].fields & PERF_OUTPUT_##x)
 
#define has(m)   (sample->misc & PERF_RECORD_MISC_##m) == PERF_RECORD_MISC_##m
 
#define MAXBB   16384UL
 
#define for_each_lang(scripts_path, scripts_dir, lang_dirent)
 
#define for_each_script(lang_path, lang_dir, script_dirent)
 
#define RECORD_SUFFIX   "-record"
 
#define REPORT_SUFFIX   "-report"
 
#define perf_script__process_auxtrace_info   0
 

Enumerations

enum  perf_output_field {
  PERF_OUTPUT_COMM = 1U << 0, PERF_OUTPUT_TID = 1U << 1, PERF_OUTPUT_PID = 1U << 2, PERF_OUTPUT_TIME = 1U << 3,
  PERF_OUTPUT_CPU = 1U << 4, PERF_OUTPUT_EVNAME = 1U << 5, PERF_OUTPUT_TRACE = 1U << 6, PERF_OUTPUT_IP = 1U << 7,
  PERF_OUTPUT_SYM = 1U << 8, PERF_OUTPUT_DSO = 1U << 9, PERF_OUTPUT_ADDR = 1U << 10, PERF_OUTPUT_SYMOFFSET = 1U << 11,
  PERF_OUTPUT_SRCLINE = 1U << 12, PERF_OUTPUT_PERIOD = 1U << 13, PERF_OUTPUT_IREGS = 1U << 14, PERF_OUTPUT_BRSTACK = 1U << 15,
  PERF_OUTPUT_BRSTACKSYM = 1U << 16, PERF_OUTPUT_DATA_SRC = 1U << 17, PERF_OUTPUT_WEIGHT = 1U << 18, PERF_OUTPUT_BPF_OUTPUT = 1U << 19,
  PERF_OUTPUT_CALLINDENT = 1U << 20, PERF_OUTPUT_INSN = 1U << 21, PERF_OUTPUT_INSNLEN = 1U << 22, PERF_OUTPUT_BRSTACKINSN = 1U << 23,
  PERF_OUTPUT_BRSTACKOFF = 1U << 24, PERF_OUTPUT_SYNTH = 1U << 25, PERF_OUTPUT_PHYS_ADDR = 1U << 26, PERF_OUTPUT_UREGS = 1U << 27,
  PERF_OUTPUT_METRIC = 1U << 28, PERF_OUTPUT_MISC = 1U << 29
}
 
enum  { OUTPUT_TYPE_SYNTH = PERF_TYPE_MAX, OUTPUT_TYPE_MAX }
 

Functions

static DECLARE_BITMAP (cpu_bitmap, MAX_NR_CPUS)
 
static struct perf_evsel_scriptevsel_script (struct perf_evsel *evsel)
 
static struct perf_evsel_scriptperf_evsel_script__new (struct perf_evsel *evsel, struct perf_data *data)
 
static void perf_evsel_script__delete (struct perf_evsel_script *es)
 
static int perf_evsel_script__fprintf (struct perf_evsel_script *es, FILE *fp)
 
static int output_type (unsigned int type)
 
static unsigned int attr_type (unsigned int type)
 
static bool output_set_by_user (void)
 
static const char * output_field2str (enum perf_output_field field)
 
static int perf_evsel__do_check_stype (struct perf_evsel *evsel, u64 sample_type, const char *sample_msg, enum perf_output_field field, bool allow_user_set)
 
static int perf_evsel__check_stype (struct perf_evsel *evsel, u64 sample_type, const char *sample_msg, enum perf_output_field field)
 
static int perf_evsel__check_attr (struct perf_evsel *evsel, struct perf_session *session)
 
static void set_print_ip_opts (struct perf_event_attr *attr)
 
static int perf_session__check_output_opt (struct perf_session *session)
 
static int perf_sample__fprintf_iregs (struct perf_sample *sample, struct perf_event_attr *attr, FILE *fp)
 
static int perf_sample__fprintf_uregs (struct perf_sample *sample, struct perf_event_attr *attr, FILE *fp)
 
static int perf_sample__fprintf_start (struct perf_sample *sample, struct thread *thread, struct perf_evsel *evsel, u32 type, FILE *fp)
 
static char mispred_str (struct branch_entry *br)
 
static int perf_sample__fprintf_brstack (struct perf_sample *sample, struct thread *thread, struct perf_event_attr *attr, FILE *fp)
 
static int perf_sample__fprintf_brstacksym (struct perf_sample *sample, struct thread *thread, struct perf_event_attr *attr, FILE *fp)
 
static int perf_sample__fprintf_brstackoff (struct perf_sample *sample, struct thread *thread, struct perf_event_attr *attr, FILE *fp)
 
static int grab_bb (u8 *buffer, u64 start, u64 end, struct machine *machine, struct thread *thread, bool *is64bit, u8 *cpumode, bool last)
 
static int ip__fprintf_jump (uint64_t ip, struct branch_entry *en, struct perf_insn *x, u8 *inbuf, int len, int insn, FILE *fp)
 
static int ip__fprintf_sym (uint64_t addr, struct thread *thread, u8 cpumode, int cpu, struct symbol **lastsym, struct perf_event_attr *attr, FILE *fp)
 
static int perf_sample__fprintf_brstackinsn (struct perf_sample *sample, struct thread *thread, struct perf_event_attr *attr, struct machine *machine, FILE *fp)
 
static int perf_sample__fprintf_addr (struct perf_sample *sample, struct thread *thread, struct perf_event_attr *attr, FILE *fp)
 
static int perf_sample__fprintf_callindent (struct perf_sample *sample, struct perf_evsel *evsel, struct thread *thread, struct addr_location *al, FILE *fp)
 
static int perf_sample__fprintf_insn (struct perf_sample *sample, struct perf_event_attr *attr, struct thread *thread, struct machine *machine, FILE *fp)
 
static int perf_sample__fprintf_bts (struct perf_sample *sample, struct perf_evsel *evsel, struct thread *thread, struct addr_location *al, struct machine *machine, FILE *fp)
 
static int perf_sample__fprintf_flags (u32 flags, FILE *fp)
 
static int sample__fprintf_bpf_output (enum binary_printer_ops op, unsigned int val, void *extra, FILE *fp)
 
static int perf_sample__fprintf_bpf_output (struct perf_sample *sample, FILE *fp)
 
static int perf_sample__fprintf_spacing (int len, int spacing, FILE *fp)
 
static int perf_sample__fprintf_pt_spacing (int len, FILE *fp)
 
static int perf_sample__fprintf_synth_ptwrite (struct perf_sample *sample, FILE *fp)
 
static int perf_sample__fprintf_synth_mwait (struct perf_sample *sample, FILE *fp)
 
static int perf_sample__fprintf_synth_pwre (struct perf_sample *sample, FILE *fp)
 
static int perf_sample__fprintf_synth_exstop (struct perf_sample *sample, FILE *fp)
 
static int perf_sample__fprintf_synth_pwrx (struct perf_sample *sample, FILE *fp)
 
static int perf_sample__fprintf_synth_cbr (struct perf_sample *sample, FILE *fp)
 
static int perf_sample__fprintf_synth (struct perf_sample *sample, struct perf_evsel *evsel, FILE *fp)
 
static int perf_evlist__max_name_len (struct perf_evlist *evlist)
 
static int data_src__fprintf (u64 data_src, FILE *fp)
 
static void script_print_metric (void *ctx, const char *color, const char *fmt, const char *unit, double val)
 
static void script_new_line (void *ctx)
 
static void perf_sample__fprint_metric (struct perf_script *script, struct thread *thread, struct perf_evsel *evsel, struct perf_sample *sample, FILE *fp)
 
static void process_event (struct perf_script *script, struct perf_sample *sample, struct perf_evsel *evsel, struct addr_location *al, struct machine *machine)
 
static void __process_stat (struct perf_evsel *counter, u64 tstamp)
 
static void process_stat (struct perf_evsel *counter, u64 tstamp)
 
static void process_stat_interval (u64 tstamp)
 
static void setup_scripting (void)
 
static int flush_scripting (void)
 
static int cleanup_scripting (void)
 
static int process_sample_event (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine)
 
static int process_attr (struct perf_tool *tool, union perf_event *event, struct perf_evlist **pevlist)
 
static int process_comm_event (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
 
static int process_namespaces_event (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
 
static int process_fork_event (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
 
static int process_exit_event (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
 
static int process_mmap_event (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
 
static int process_mmap2_event (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
 
static int process_switch_event (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
 
static int process_lost_event (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
 
static int process_finished_round_event (struct perf_tool *tool __maybe_unused, union perf_event *event, struct ordered_events *oe __maybe_unused)
 
static void sig_handler (int sig __maybe_unused)
 
static void perf_script__fclose_per_event_dump (struct perf_script *script)
 
static int perf_script__fopen_per_event_dump (struct perf_script *script)
 
static int perf_script__setup_per_event_dump (struct perf_script *script)
 
static void perf_script__exit_per_event_dump_stats (struct perf_script *script)
 
static int __cmd_script (struct perf_script *script)
 
static LIST_HEAD (script_specs)
 
static struct script_specscript_spec__new (const char *spec, struct scripting_ops *ops)
 
static void script_spec__add (struct script_spec *s)
 
static struct script_specscript_spec__find (const char *spec)
 
int script_spec_register (const char *spec, struct scripting_ops *ops)
 
static struct scripting_opsscript_spec__lookup (const char *spec)
 
static void list_available_languages (void)
 
static int parse_scriptname (const struct option *opt __maybe_unused, const char *str, int unset __maybe_unused)
 
static int parse_output_fields (const struct option *opt __maybe_unused, const char *arg, int unset __maybe_unused)
 
static LIST_HEAD (script_descs)
 
static struct script_descscript_desc__new (const char *name)
 
static void script_desc__delete (struct script_desc *s)
 
static void script_desc__add (struct script_desc *s)
 
static struct script_descscript_desc__find (const char *name)
 
static struct script_descscript_desc__findnew (const char *name)
 
static const char * ends_with (const char *str, const char *suffix)
 
static int read_script_info (struct script_desc *desc, const char *filename)
 
static char * get_script_root (struct dirent *script_dirent, const char *suffix)
 
static int list_available_scripts (const struct option *opt __maybe_unused, const char *s __maybe_unused, int unset __maybe_unused)
 
static int check_ev_match (char *dir_name, char *scriptname, struct perf_session *session)
 
int find_scripts (char **scripts_array, char **scripts_path_array)
 
static char * get_script_path (const char *script_root, const char *suffix)
 
static bool is_top_script (const char *script_path)
 
static int has_required_arg (char *script_path)
 
static int have_cmd (int argc, const char **argv)
 
static void script__setup_sample_type (struct perf_script *script)
 
static int process_stat_round_event (struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_session *session)
 
static int process_stat_config_event (struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_session *session __maybe_unused)
 
static int set_maps (struct perf_script *script)
 
static int process_thread_map_event (struct perf_tool *tool, union perf_event *event, struct perf_session *session __maybe_unused)
 
static int process_cpu_map_event (struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_session *session __maybe_unused)
 
int cmd_script (int argc, const char **argv)
 

Variables

static char const * script_name
 
static char const * generate_script_lang
 
static bool debug_mode
 
static u64 last_timestamp
 
static u64 nr_unordered
 
static bool no_callchain
 
static bool latency_format
 
static bool system_wide
 
static bool print_flags
 
static bool nanosecs
 
static const char * cpu_list
 
static struct perf_stat_config stat_config
 
static int max_blocks
 
unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH
 
struct output_option all_output_options []
 
struct {
   bool   user_set
 
   bool   wildcard_set
 
   unsigned int   print_ip_opts
 
   u64   fields
 
   u64   invalid_fields
 
output [OUTPUT_TYPE_MAX]
 
struct {
   u32   flags
 
   const char *   name
 
sample_flags []
 
static struct scripting_opsscripting_ops
 

Macro Definition Documentation

◆ for_each_lang

#define for_each_lang (   scripts_path,
  scripts_dir,
  lang_dirent 
)
Value:
while ((lang_dirent = readdir(scripts_dir)) != NULL) \
if ((lang_dirent->d_type == DT_DIR || \
(lang_dirent->d_type == DT_UNKNOWN && \
is_directory(scripts_path, lang_dirent))) && \
(strcmp(lang_dirent->d_name, ".")) && \
(strcmp(lang_dirent->d_name, "..")))
bool is_directory(const char *base_path, const struct dirent *dent)
Definition: path.c:83

Definition at line 2496 of file builtin-script.c.

◆ for_each_script

#define for_each_script (   lang_path,
  lang_dir,
  script_dirent 
)
Value:
while ((script_dirent = readdir(lang_dir)) != NULL) \
if (script_dirent->d_type != DT_DIR && \
(script_dirent->d_type != DT_UNKNOWN || \
!is_directory(lang_path, script_dirent)))
bool is_directory(const char *base_path, const struct dirent *dent)
Definition: path.c:83

Definition at line 2504 of file builtin-script.c.

◆ has

#define has (   m)    (sample->misc & PERF_RECORD_MISC_##m) == PERF_RECORD_MISC_##m

◆ MAXBB

#define MAXBB   16384UL

Definition at line 839 of file builtin-script.c.

◆ perf_script__process_auxtrace_info

#define perf_script__process_auxtrace_info   0

Definition at line 3037 of file builtin-script.c.

◆ PRINT_FIELD

#define PRINT_FIELD (   x)    (output[output_type(attr->type)].fields & PERF_OUTPUT_##x)

Definition at line 318 of file builtin-script.c.

◆ RECORD_SUFFIX

#define RECORD_SUFFIX   "-record"

Definition at line 2511 of file builtin-script.c.

◆ REPORT_SUFFIX

#define REPORT_SUFFIX   "-report"

Definition at line 2512 of file builtin-script.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
OUTPUT_TYPE_SYNTH 
OUTPUT_TYPE_MAX 

Definition at line 136 of file builtin-script.c.

◆ perf_output_field

Enumerator
PERF_OUTPUT_COMM 
PERF_OUTPUT_TID 
PERF_OUTPUT_PID 
PERF_OUTPUT_TIME 
PERF_OUTPUT_CPU 
PERF_OUTPUT_EVNAME 
PERF_OUTPUT_TRACE 
PERF_OUTPUT_IP 
PERF_OUTPUT_SYM 
PERF_OUTPUT_DSO 
PERF_OUTPUT_ADDR 
PERF_OUTPUT_SYMOFFSET 
PERF_OUTPUT_SRCLINE 
PERF_OUTPUT_PERIOD 
PERF_OUTPUT_IREGS 
PERF_OUTPUT_BRSTACK 
PERF_OUTPUT_BRSTACKSYM 
PERF_OUTPUT_DATA_SRC 
PERF_OUTPUT_WEIGHT 
PERF_OUTPUT_BPF_OUTPUT 
PERF_OUTPUT_CALLINDENT 
PERF_OUTPUT_INSN 
PERF_OUTPUT_INSNLEN 
PERF_OUTPUT_BRSTACKINSN 
PERF_OUTPUT_BRSTACKOFF 
PERF_OUTPUT_SYNTH 
PERF_OUTPUT_PHYS_ADDR 
PERF_OUTPUT_UREGS 
PERF_OUTPUT_METRIC 
PERF_OUTPUT_MISC 

Definition at line 67 of file builtin-script.c.

Function Documentation

◆ __cmd_script()

static int __cmd_script ( struct perf_script script)
static

Definition at line 2185 of file builtin-script.c.

Here is the call graph for this function:

◆ __process_stat()

static void __process_stat ( struct perf_evsel counter,
u64  tstamp 
)
static

Definition at line 1705 of file builtin-script.c.

Here is the call graph for this function:

◆ attr_type()

static unsigned int attr_type ( unsigned int  type)
inlinestatic

Definition at line 284 of file builtin-script.c.

◆ check_ev_match()

static int check_ev_match ( char *  dir_name,
char *  scriptname,
struct perf_session session 
)
static

Definition at line 2708 of file builtin-script.c.

Here is the call graph for this function:

◆ cleanup_scripting()

static int cleanup_scripting ( void  )
static

Definition at line 1764 of file builtin-script.c.

◆ cmd_script()

int cmd_script ( int  argc,
const char **  argv 
)

Definition at line 3040 of file builtin-script.c.

◆ data_src__fprintf()

static int data_src__fprintf ( u64  data_src,
FILE *  fp 
)
static

Definition at line 1511 of file builtin-script.c.

Here is the call graph for this function:

◆ DECLARE_BITMAP()

static DECLARE_BITMAP ( cpu_bitmap  ,
MAX_NR_CPUS   
)
static

◆ ends_with()

static const char* ends_with ( const char *  str,
const char *  suffix 
)
static

Definition at line 2572 of file builtin-script.c.

◆ evsel_script()

static struct perf_evsel_script* evsel_script ( struct perf_evsel evsel)
static

Definition at line 231 of file builtin-script.c.

◆ find_scripts()

int find_scripts ( char **  scripts_array,
char **  scripts_path_array 
)

Definition at line 2767 of file builtin-script.c.

Here is the call graph for this function:

◆ flush_scripting()

static int flush_scripting ( void  )
static

Definition at line 1759 of file builtin-script.c.

◆ get_script_path()

static char* get_script_path ( const char *  script_root,
const char *  suffix 
)
static

Definition at line 2835 of file builtin-script.c.

Here is the call graph for this function:

◆ get_script_root()

static char* get_script_root ( struct dirent *  script_dirent,
const char *  suffix 
)
static

Definition at line 2627 of file builtin-script.c.

Here is the call graph for this function:

◆ grab_bb()

static int grab_bb ( u8 *  buffer,
u64  start,
u64  end,
struct machine machine,
struct thread thread,
bool *  is64bit,
u8 *  cpumode,
bool  last 
)
static

Definition at line 841 of file builtin-script.c.

Here is the call graph for this function:

◆ has_required_arg()

static int has_required_arg ( char *  script_path)
static

Definition at line 2881 of file builtin-script.c.

Here is the call graph for this function:

◆ have_cmd()

static int have_cmd ( int  argc,
const char **  argv 
)
static

Definition at line 2904 of file builtin-script.c.

Here is the call graph for this function:

◆ ip__fprintf_jump()

static int ip__fprintf_jump ( uint64_t  ip,
struct branch_entry en,
struct perf_insn x,
u8 *  inbuf,
int  len,
int  insn,
FILE *  fp 
)
static

Definition at line 901 of file builtin-script.c.

Here is the call graph for this function:

◆ ip__fprintf_sym()

static int ip__fprintf_sym ( uint64_t  addr,
struct thread thread,
u8  cpumode,
int  cpu,
struct symbol **  lastsym,
struct perf_event_attr *  attr,
FILE *  fp 
)
static

Definition at line 919 of file builtin-script.c.

Here is the call graph for this function:

◆ is_top_script()

static bool is_top_script ( const char *  script_path)
static

Definition at line 2876 of file builtin-script.c.

Here is the call graph for this function:

◆ list_available_languages()

static void list_available_languages ( void  )
static

Definition at line 2290 of file builtin-script.c.

◆ list_available_scripts()

static int list_available_scripts ( const struct option *opt  __maybe_unused,
const char *s  __maybe_unused,
int unset  __maybe_unused 
)
static

Definition at line 2645 of file builtin-script.c.

Here is the call graph for this function:

◆ LIST_HEAD() [1/2]

static LIST_HEAD ( script_specs  )
static

◆ LIST_HEAD() [2/2]

static LIST_HEAD ( script_descs  )
static

◆ mispred_str()

static char mispred_str ( struct branch_entry br)
inlinestatic

Definition at line 691 of file builtin-script.c.

◆ output_field2str()

static const char* output_field2str ( enum perf_output_field  field)
static

Definition at line 304 of file builtin-script.c.

◆ output_set_by_user()

static bool output_set_by_user ( void  )
static

Definition at line 294 of file builtin-script.c.

◆ output_type()

static int output_type ( unsigned int  type)
inlinestatic

Definition at line 274 of file builtin-script.c.

◆ parse_output_fields()

static int parse_output_fields ( const struct option *opt  __maybe_unused,
const char *  arg,
int unset  __maybe_unused 
)
static

Definition at line 2350 of file builtin-script.c.

Here is the call graph for this function:

◆ parse_scriptname()

static int parse_scriptname ( const struct option *opt  __maybe_unused,
const char *  str,
int unset  __maybe_unused 
)
static

Definition at line 2304 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_evlist__max_name_len()

static int perf_evlist__max_name_len ( struct perf_evlist evlist)
static

Definition at line 1497 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_evsel__check_attr()

static int perf_evsel__check_attr ( struct perf_evsel evsel,
struct perf_session session 
)
static

Definition at line 360 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_evsel__check_stype()

static int perf_evsel__check_stype ( struct perf_evsel evsel,
u64  sample_type,
const char *  sample_msg,
enum perf_output_field  field 
)
static

Definition at line 352 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_evsel__do_check_stype()

static int perf_evsel__do_check_stype ( struct perf_evsel evsel,
u64  sample_type,
const char *  sample_msg,
enum perf_output_field  field,
bool  allow_user_set 
)
static

Definition at line 320 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_evsel_script__delete()

static void perf_evsel_script__delete ( struct perf_evsel_script es)
static

Definition at line 257 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_evsel_script__fprintf()

static int perf_evsel_script__fprintf ( struct perf_evsel_script es,
FILE *  fp 
)
static

Definition at line 265 of file builtin-script.c.

◆ perf_evsel_script__new()

static struct perf_evsel_script* perf_evsel_script__new ( struct perf_evsel evsel,
struct perf_data data 
)
static

Definition at line 236 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprint_metric()

static void perf_sample__fprint_metric ( struct perf_script script,
struct thread thread,
struct perf_evsel evsel,
struct perf_sample sample,
FILE *  fp 
)
static

Definition at line 1562 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_addr()

static int perf_sample__fprintf_addr ( struct perf_sample sample,
struct thread thread,
struct perf_event_attr *  attr,
FILE *  fp 
)
static

Definition at line 1066 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_bpf_output()

static int perf_sample__fprintf_bpf_output ( struct perf_sample sample,
FILE *  fp 
)
static

Definition at line 1345 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_brstack()

static int perf_sample__fprintf_brstack ( struct perf_sample sample,
struct thread thread,
struct perf_event_attr *  attr,
FILE *  fp 
)
static

Definition at line 699 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_brstackinsn()

static int perf_sample__fprintf_brstackinsn ( struct perf_sample sample,
struct thread thread,
struct perf_event_attr *  attr,
struct machine machine,
FILE *  fp 
)
static

Definition at line 957 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_brstackoff()

static int perf_sample__fprintf_brstackoff ( struct perf_sample sample,
struct thread thread,
struct perf_event_attr *  attr,
FILE *  fp 
)
static

Definition at line 791 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_brstacksym()

static int perf_sample__fprintf_brstacksym ( struct perf_sample sample,
struct thread thread,
struct perf_event_attr *  attr,
FILE *  fp 
)
static

Definition at line 746 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_bts()

static int perf_sample__fprintf_bts ( struct perf_sample sample,
struct perf_evsel evsel,
struct thread thread,
struct addr_location al,
struct machine machine,
FILE *  fp 
)
static

Definition at line 1175 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_callindent()

static int perf_sample__fprintf_callindent ( struct perf_sample sample,
struct perf_evsel evsel,
struct thread thread,
struct addr_location al,
FILE *  fp 
)
static

Definition at line 1095 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_flags()

static int perf_sample__fprintf_flags ( u32  flags,
FILE *  fp 
)
static

Definition at line 1246 of file builtin-script.c.

◆ perf_sample__fprintf_insn()

static int perf_sample__fprintf_insn ( struct perf_sample sample,
struct perf_event_attr *  attr,
struct thread thread,
struct machine machine,
FILE *  fp 
)
static

Definition at line 1153 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_iregs()

static int perf_sample__fprintf_iregs ( struct perf_sample sample,
struct perf_event_attr *  attr,
FILE *  fp 
)
static

Definition at line 556 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_pt_spacing()

static int perf_sample__fprintf_pt_spacing ( int  len,
FILE *  fp 
)
static

Definition at line 1366 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_spacing()

static int perf_sample__fprintf_spacing ( int  len,
int  spacing,
FILE *  fp 
)
static

Definition at line 1358 of file builtin-script.c.

◆ perf_sample__fprintf_start()

static int perf_sample__fprintf_start ( struct perf_sample sample,
struct thread thread,
struct perf_evsel evsel,
u32  type,
FILE *  fp 
)
static

Definition at line 596 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_synth()

static int perf_sample__fprintf_synth ( struct perf_sample sample,
struct perf_evsel evsel,
FILE *  fp 
)
static

Definition at line 1454 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_synth_cbr()

static int perf_sample__fprintf_synth_cbr ( struct perf_sample sample,
FILE *  fp 
)
static

Definition at line 1436 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_synth_exstop()

static int perf_sample__fprintf_synth_exstop ( struct perf_sample sample,
FILE *  fp 
)
static

Definition at line 1410 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_synth_mwait()

static int perf_sample__fprintf_synth_mwait ( struct perf_sample sample,
FILE *  fp 
)
static

Definition at line 1384 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_synth_ptwrite()

static int perf_sample__fprintf_synth_ptwrite ( struct perf_sample sample,
FILE *  fp 
)
static

Definition at line 1371 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_synth_pwre()

static int perf_sample__fprintf_synth_pwre ( struct perf_sample sample,
FILE *  fp 
)
static

Definition at line 1397 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_synth_pwrx()

static int perf_sample__fprintf_synth_pwrx ( struct perf_sample sample,
FILE *  fp 
)
static

Definition at line 1422 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_sample__fprintf_uregs()

static int perf_sample__fprintf_uregs ( struct perf_sample sample,
struct perf_event_attr *  attr,
FILE *  fp 
)
static

Definition at line 575 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_script__exit_per_event_dump_stats()

static void perf_script__exit_per_event_dump_stats ( struct perf_script script)
static

Definition at line 2172 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_script__fclose_per_event_dump()

static void perf_script__fclose_per_event_dump ( struct perf_script script)
static

Definition at line 2116 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_script__fopen_per_event_dump()

static int perf_script__fopen_per_event_dump ( struct perf_script script)
static

Definition at line 2129 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_script__setup_per_event_dump()

static int perf_script__setup_per_event_dump ( struct perf_script script)
static

Definition at line 2156 of file builtin-script.c.

Here is the call graph for this function:

◆ perf_session__check_output_opt()

static int perf_session__check_output_opt ( struct perf_session session)
static

Definition at line 484 of file builtin-script.c.

Here is the call graph for this function:

◆ process_attr()

static int process_attr ( struct perf_tool tool,
union perf_event event,
struct perf_evlist **  pevlist 
)
static

Definition at line 1818 of file builtin-script.c.

Here is the call graph for this function:

◆ process_comm_event()

static int process_comm_event ( struct perf_tool tool,
union perf_event event,
struct perf_sample sample,
struct machine machine 
)
static

Definition at line 1850 of file builtin-script.c.

Here is the call graph for this function:

◆ process_cpu_map_event()

static int process_cpu_map_event ( struct perf_tool *tool  __maybe_unused,
union perf_event event,
struct perf_session *session  __maybe_unused 
)
static

Definition at line 3003 of file builtin-script.c.

Here is the call graph for this function:

◆ process_event()

static void process_event ( struct perf_script script,
struct perf_sample sample,
struct perf_evsel evsel,
struct addr_location al,
struct machine machine 
)
static

Definition at line 1610 of file builtin-script.c.

Here is the call graph for this function:

◆ process_exit_event()

static int process_exit_event ( struct perf_tool tool,
union perf_event event,
struct perf_sample sample,
struct machine machine 
)
static

Definition at line 1953 of file builtin-script.c.

Here is the call graph for this function:

◆ process_finished_round_event()

static int process_finished_round_event ( struct perf_tool *tool  __maybe_unused,
union perf_event event,
struct ordered_events *oe  __maybe_unused 
)
static

Definition at line 2102 of file builtin-script.c.

Here is the call graph for this function:

◆ process_fork_event()

static int process_fork_event ( struct perf_tool tool,
union perf_event event,
struct perf_sample sample,
struct machine machine 
)
static

Definition at line 1921 of file builtin-script.c.

Here is the call graph for this function:

◆ process_lost_event()

static int process_lost_event ( struct perf_tool tool,
union perf_event event,
struct perf_sample sample,
struct machine machine 
)
static

Definition at line 2079 of file builtin-script.c.

Here is the call graph for this function:

◆ process_mmap2_event()

static int process_mmap2_event ( struct perf_tool tool,
union perf_event event,
struct perf_sample sample,
struct machine machine 
)
static

Definition at line 2019 of file builtin-script.c.

Here is the call graph for this function:

◆ process_mmap_event()

static int process_mmap_event ( struct perf_tool tool,
union perf_event event,
struct perf_sample sample,
struct machine machine 
)
static

Definition at line 1987 of file builtin-script.c.

Here is the call graph for this function:

◆ process_namespaces_event()

static int process_namespaces_event ( struct perf_tool tool,
union perf_event event,
struct perf_sample sample,
struct machine machine 
)
static

Definition at line 1885 of file builtin-script.c.

Here is the call graph for this function:

◆ process_sample_event()

static int process_sample_event ( struct perf_tool tool,
union perf_event event,
struct perf_sample sample,
struct perf_evsel evsel,
struct machine machine 
)
static

Definition at line 1771 of file builtin-script.c.

Here is the call graph for this function:

◆ process_stat()

static void process_stat ( struct perf_evsel counter,
u64  tstamp 
)
static

Definition at line 1739 of file builtin-script.c.

Here is the call graph for this function:

◆ process_stat_config_event()

static int process_stat_config_event ( struct perf_tool *tool  __maybe_unused,
union perf_event event,
struct perf_session *session  __maybe_unused 
)
static

Definition at line 2956 of file builtin-script.c.

Here is the call graph for this function:

◆ process_stat_interval()

static void process_stat_interval ( u64  tstamp)
static

Definition at line 1747 of file builtin-script.c.

◆ process_stat_round_event()

static int process_stat_round_event ( struct perf_tool *tool  __maybe_unused,
union perf_event event,
struct perf_session session 
)
static

Definition at line 2940 of file builtin-script.c.

Here is the call graph for this function:

◆ process_switch_event()

static int process_switch_event ( struct perf_tool tool,
union perf_event event,
struct perf_sample sample,
struct machine machine 
)
static

Definition at line 2051 of file builtin-script.c.

Here is the call graph for this function:

◆ process_thread_map_event()

static int process_thread_map_event ( struct perf_tool tool,
union perf_event event,
struct perf_session *session  __maybe_unused 
)
static

Definition at line 2984 of file builtin-script.c.

Here is the call graph for this function:

◆ read_script_info()

static int read_script_info ( struct script_desc desc,
const char *  filename 
)
static

Definition at line 2586 of file builtin-script.c.

Here is the call graph for this function:

◆ sample__fprintf_bpf_output()

static int sample__fprintf_bpf_output ( enum binary_printer_ops  op,
unsigned int  val,
void *  extra,
FILE *  fp 
)
static

Definition at line 1284 of file builtin-script.c.

◆ script__setup_sample_type()

static void script__setup_sample_type ( struct perf_script script)
static

Definition at line 2923 of file builtin-script.c.

Here is the call graph for this function:

◆ script_desc__add()

static void script_desc__add ( struct script_desc s)
static

Definition at line 2541 of file builtin-script.c.

◆ script_desc__delete()

static void script_desc__delete ( struct script_desc s)
static

Definition at line 2533 of file builtin-script.c.

Here is the call graph for this function:

◆ script_desc__find()

static struct script_desc* script_desc__find ( const char *  name)
static

Definition at line 2546 of file builtin-script.c.

◆ script_desc__findnew()

static struct script_desc* script_desc__findnew ( const char *  name)
static

Definition at line 2556 of file builtin-script.c.

Here is the call graph for this function:

◆ script_desc__new()

static struct script_desc* script_desc__new ( const char *  name)
static

Definition at line 2523 of file builtin-script.c.

Here is the call graph for this function:

◆ script_new_line()

static void script_new_line ( void *  ctx)
static

Definition at line 1553 of file builtin-script.c.

Here is the call graph for this function:

◆ script_print_metric()

static void script_print_metric ( void *  ctx,
const char *  color,
const char *  fmt,
const char *  unit,
double  val 
)
static

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

Here is the call graph for this function:

◆ script_spec__add()

static void script_spec__add ( struct script_spec s)
static

Definition at line 2249 of file builtin-script.c.

◆ script_spec__find()

static struct script_spec* script_spec__find ( const char *  spec)
static

Definition at line 2254 of file builtin-script.c.

◆ script_spec__lookup()

static struct scripting_ops* script_spec__lookup ( const char *  spec)
static

Definition at line 2281 of file builtin-script.c.

Here is the call graph for this function:

◆ script_spec__new()

static struct script_spec* script_spec__new ( const char *  spec,
struct scripting_ops ops 
)
static

Definition at line 2236 of file builtin-script.c.

Here is the call graph for this function:

◆ script_spec_register()

int script_spec_register ( const char *  spec,
struct scripting_ops ops 
)

Definition at line 2264 of file builtin-script.c.

Here is the call graph for this function:

◆ set_maps()

static int set_maps ( struct perf_script script)
static

Definition at line 2964 of file builtin-script.c.

Here is the call graph for this function:

◆ set_print_ip_opts()

static void set_print_ip_opts ( struct perf_event_attr *  attr)
static

Definition at line 459 of file builtin-script.c.

Here is the call graph for this function:

◆ setup_scripting()

static void setup_scripting ( void  )
static

Definition at line 1753 of file builtin-script.c.

Here is the call graph for this function:

◆ sig_handler()

static void sig_handler ( int sig  __maybe_unused)
static

Definition at line 2111 of file builtin-script.c.

Variable Documentation

◆ all_output_options

struct output_option all_output_options[]

◆ cpu_list

const char* cpu_list
static

Definition at line 60 of file builtin-script.c.

◆ debug_mode

bool debug_mode
static

Definition at line 52 of file builtin-script.c.

◆ fields

u64 fields

Definition at line 146 of file builtin-script.c.

◆ flags

u32 flags

Definition at line 1227 of file builtin-script.c.

◆ generate_script_lang

char const* generate_script_lang
static

Definition at line 51 of file builtin-script.c.

◆ invalid_fields

u64 invalid_fields

Definition at line 147 of file builtin-script.c.

◆ last_timestamp

u64 last_timestamp
static

Definition at line 53 of file builtin-script.c.

◆ latency_format

bool latency_format
static

Definition at line 56 of file builtin-script.c.

◆ max_blocks

int max_blocks
static

Definition at line 63 of file builtin-script.c.

◆ name

const char* name

Definition at line 1228 of file builtin-script.c.

◆ nanosecs

bool nanosecs
static

Definition at line 59 of file builtin-script.c.

◆ no_callchain

bool no_callchain
static

Definition at line 55 of file builtin-script.c.

◆ nr_unordered

u64 nr_unordered
static

Definition at line 54 of file builtin-script.c.

◆ output

struct { ... } output[OUTPUT_TYPE_MAX]

◆ print_flags

bool print_flags
static

Definition at line 58 of file builtin-script.c.

◆ print_ip_opts

unsigned int print_ip_opts

Definition at line 145 of file builtin-script.c.

◆ sample_flags

◆ script_name

char const* script_name
static

Definition at line 50 of file builtin-script.c.

◆ scripting_max_stack

unsigned int scripting_max_stack = PERF_MAX_STACK_DEPTH

Definition at line 65 of file builtin-script.c.

◆ scripting_ops

struct scripting_ops* scripting_ops
static

Definition at line 1703 of file builtin-script.c.

◆ stat_config

struct perf_stat_config stat_config
static

Definition at line 62 of file builtin-script.c.

◆ system_wide

bool system_wide
static

Definition at line 57 of file builtin-script.c.

◆ user_set

bool user_set

Definition at line 143 of file builtin-script.c.

◆ wildcard_set

bool wildcard_set

Definition at line 144 of file builtin-script.c.