Linux Perf
builtin-trace.c File Reference
#include <traceevent/event-parse.h>
#include <api/fs/tracing_path.h>
#include "builtin.h"
#include "util/cgroup.h"
#include "util/color.h"
#include "util/debug.h"
#include "util/env.h"
#include "util/event.h"
#include "util/evlist.h"
#include <subcmd/exec-cmd.h>
#include "util/machine.h"
#include "util/path.h"
#include "util/session.h"
#include "util/thread.h"
#include <subcmd/parse-options.h>
#include "util/strlist.h"
#include "util/intlist.h"
#include "util/thread_map.h"
#include "util/stat.h"
#include "trace/beauty/beauty.h"
#include "trace-event.h"
#include "util/parse-events.h"
#include "util/bpf-loader.h"
#include "callchain.h"
#include "print_binary.h"
#include "string2.h"
#include "syscalltbl.h"
#include "rb_resort.h"
#include <errno.h>
#include <inttypes.h>
#include <poll.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <linux/err.h>
#include <linux/filter.h>
#include <linux/kernel.h>
#include <linux/random.h>
#include <linux/stringify.h>
#include <linux/time64.h>
#include <fcntl.h>
#include "sane_ctype.h"
#include "trace/beauty/arch_errno_names.c"
#include "trace/beauty/eventfd.c"
#include "trace/beauty/futex_op.c"
#include "trace/beauty/futex_val3.c"
#include "trace/beauty/mmap.c"
#include "trace/beauty/mode_t.c"
#include "trace/beauty/msg_flags.c"
#include "trace/beauty/open_flags.c"
#include "trace/beauty/perf_event_open.c"
#include "trace/beauty/pid.c"
#include "trace/beauty/sched_policy.c"
#include "trace/beauty/seccomp.c"
#include "trace/beauty/signum.c"
#include "trace/beauty/socket_type.c"
#include "trace/beauty/waitid_options.c"

Go to the source code of this file.

Classes

struct  trace
 
struct  tp_field
 
struct  syscall_tp
 
struct  strarrays
 
struct  syscall_arg_fmt
 
struct  syscall_fmt
 
struct  syscall
 
struct  thread_trace
 

Macros

#define F_LINUX_SPECIFIC_BASE   1024
 
#define TP_UINT_FIELD(bits)
 
#define TP_UINT_FIELD__SWAPPED(bits)
 
#define perf_evsel__init_sc_tp_uint_field(evsel, name)
 
#define perf_evsel__init_sc_tp_ptr_field(evsel, name)
 
#define perf_evsel__sc_tp_uint(evsel, name, sample)
 
#define perf_evsel__sc_tp_ptr(evsel, name, sample)
 
#define SCA_STRARRAY   syscall_arg__scnprintf_strarray
 
#define DEFINE_STRARRAYS(array)
 
#define AT_FDCWD   -100
 
#define SCA_FDAT   syscall_arg__scnprintf_fd_at
 
#define SCA_CLOSE_FD   syscall_arg__scnprintf_close_fd
 
#define P_MODE(n)
 
#define SCA_ACCMODE   syscall_arg__scnprintf_access_mode
 
#define SCA_FILENAME   syscall_arg__scnprintf_filename
 
#define P_FLAG(n)
 
#define SCA_PIPE_FLAGS   syscall_arg__scnprintf_pipe_flags
 
#define GRND_NONBLOCK   0x0001
 
#define GRND_RANDOM   0x0002
 
#define P_FLAG(n)
 
#define SCA_GETRANDOM_FLAGS   syscall_arg__scnprintf_getrandom_flags
 
#define STRARRAY(name, array)
 
#define TRACE_PFMAJ   (1 << 0)
 
#define TRACE_PFMIN   (1 << 1)
 

Typedefs

typedef int(* tracepoint_handler) (struct trace *trace, struct perf_evsel *evsel, union perf_event *event, struct perf_sample *sample)
 

Functions

 TP_UINT_FIELD (8)
 
 TP_UINT_FIELD (16)
 
 TP_UINT_FIELD (32)
 
 TP_UINT_FIELD (64)
 
 TP_UINT_FIELD__SWAPPED (16)
 
 TP_UINT_FIELD__SWAPPED (32)
 
 TP_UINT_FIELD__SWAPPED (64)
 
static int tp_field__init_uint (struct tp_field *field, struct format_field *format_field, bool needs_swap)
 
static void * tp_field__ptr (struct tp_field *field, struct perf_sample *sample)
 
static int tp_field__init_ptr (struct tp_field *field, struct format_field *format_field)
 
static int perf_evsel__init_tp_uint_field (struct perf_evsel *evsel, struct tp_field *field, const char *name)
 
static int perf_evsel__init_tp_ptr_field (struct perf_evsel *evsel, struct tp_field *field, const char *name)
 
static void perf_evsel__delete_priv (struct perf_evsel *evsel)
 
static int perf_evsel__init_syscall_tp (struct perf_evsel *evsel, void *handler)
 
static struct perf_evselperf_evsel__syscall_newtp (const char *direction, void *handler)
 
size_t strarray__scnprintf (struct strarray *sa, char *bf, size_t size, const char *intfmt, int val)
 
static size_t __syscall_arg__scnprintf_strarray (char *bf, size_t size, const char *intfmt, struct syscall_arg *arg)
 
static size_t syscall_arg__scnprintf_strarray (char *bf, size_t size, struct syscall_arg *arg)
 
size_t syscall_arg__scnprintf_strarrays (char *bf, size_t size, struct syscall_arg *arg)
 
static size_t syscall_arg__scnprintf_fd_at (char *bf, size_t size, struct syscall_arg *arg)
 
static size_t syscall_arg__scnprintf_close_fd (char *bf, size_t size, struct syscall_arg *arg)
 
size_t syscall_arg__scnprintf_hex (char *bf, size_t size, struct syscall_arg *arg)
 
size_t syscall_arg__scnprintf_int (char *bf, size_t size, struct syscall_arg *arg)
 
size_t syscall_arg__scnprintf_long (char *bf, size_t size, struct syscall_arg *arg)
 
static DEFINE_STRARRAY (bpf_cmd)
 
static DEFINE_STRARRAY_OFFSET (epoll_ctl_ops, 1)
 
static DEFINE_STRARRAY (itimers)
 
static DEFINE_STRARRAY (keyctl_options)
 
static DEFINE_STRARRAY (whences)
 
static DEFINE_STRARRAY (fcntl_cmds)
 
static DEFINE_STRARRAY_OFFSET (fcntl_linux_specific_cmds, F_LINUX_SPECIFIC_BASE)
 
static DEFINE_STRARRAYS (fcntl_cmds_arrays)
 
static DEFINE_STRARRAY (rlimit_resources)
 
static DEFINE_STRARRAY (sighow)
 
static DEFINE_STRARRAY (clockid)
 
static DEFINE_STRARRAY (socket_families)
 
static size_t syscall_arg__scnprintf_access_mode (char *bf, size_t size, struct syscall_arg *arg)
 
static size_t syscall_arg__scnprintf_filename (char *bf, size_t size, struct syscall_arg *arg)
 
static size_t syscall_arg__scnprintf_pipe_flags (char *bf, size_t size, struct syscall_arg *arg)
 
static size_t syscall_arg__scnprintf_getrandom_flags (char *bf, size_t size, struct syscall_arg *arg)
 
static int syscall_fmt__cmp (const void *name, const void *fmtp)
 
static struct syscall_fmtsyscall_fmt__find (const char *name)
 
static size_t fprintf_duration (unsigned long t, bool calculated, FILE *fp)
 
static struct thread_tracethread_trace__new (void)
 
static struct thread_tracethread__trace (struct thread *thread, FILE *fp)
 
void syscall_arg__set_ret_scnprintf (struct syscall_arg *arg, size_t(*ret_scnprintf)(char *bf, size_t size, struct syscall_arg *arg))
 
static int trace__set_fd_pathname (struct thread *thread, int fd, const char *pathname)
 
static int thread__read_fd_path (struct thread *thread, int fd)
 
static const char * thread__fd_path (struct thread *thread, int fd, struct trace *trace)
 
size_t syscall_arg__scnprintf_fd (char *bf, size_t size, struct syscall_arg *arg)
 
size_t pid__scnprintf_fd (struct trace *trace, pid_t pid, int fd, char *bf, size_t size)
 
static void thread__set_filename_pos (struct thread *thread, const char *bf, unsigned long ptr)
 
static bool trace__filter_duration (struct trace *trace, double t)
 
static size_t __trace__fprintf_tstamp (struct trace *trace, u64 tstamp, FILE *fp)
 
static size_t trace__fprintf_tstamp (struct trace *trace, u64 tstamp, FILE *fp)
 
static void sig_handler (int sig)
 
static size_t trace__fprintf_entry_head (struct trace *trace, struct thread *thread, u64 duration, bool duration_calculated, u64 tstamp, FILE *fp)
 
static int trace__process_event (struct trace *trace, struct machine *machine, union perf_event *event, struct perf_sample *sample)
 
static int trace__tool_process (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine)
 
static char * trace__machine__resolve_kernel_addr (void *vmachine, unsigned long long *addrp, char **modp)
 
static int trace__symbols_init (struct trace *trace, struct perf_evlist *evlist)
 
static void trace__symbols__exit (struct trace *trace)
 
static int syscall__alloc_arg_fmts (struct syscall *sc, int nr_args)
 
static int syscall__set_arg_fmts (struct syscall *sc)
 
static int trace__read_syscall_info (struct trace *trace, int id)
 
static int trace__validate_ev_qualifier (struct trace *trace)
 
unsigned long syscall_arg__val (struct syscall_arg *arg, u8 idx)
 
static size_t syscall__scnprintf_name (struct syscall *sc, char *bf, size_t size, struct syscall_arg *arg)
 
static size_t syscall__scnprintf_val (struct syscall *sc, char *bf, size_t size, struct syscall_arg *arg, unsigned long val)
 
static size_t syscall__scnprintf_args (struct syscall *sc, char *bf, size_t size, unsigned char *args, struct trace *trace, struct thread *thread)
 
static struct syscalltrace__syscall_info (struct trace *trace, struct perf_evsel *evsel, int id)
 
static void thread__update_stats (struct thread_trace *ttrace, int id, struct perf_sample *sample)
 
static int trace__printf_interrupted_entry (struct trace *trace)
 
static int trace__fprintf_sample (struct trace *trace, struct perf_evsel *evsel, struct perf_sample *sample, struct thread *thread)
 
static int trace__sys_enter (struct trace *trace, struct perf_evsel *evsel, union perf_event *event __maybe_unused, struct perf_sample *sample)
 
static int trace__resolve_callchain (struct trace *trace, struct perf_evsel *evsel, struct perf_sample *sample, struct callchain_cursor *cursor)
 
static int trace__fprintf_callchain (struct trace *trace, struct perf_sample *sample)
 
static const char * errno_to_name (struct perf_evsel *evsel, int err)
 
static int trace__sys_exit (struct trace *trace, struct perf_evsel *evsel, union perf_event *event __maybe_unused, struct perf_sample *sample)
 
static int trace__vfs_getname (struct trace *trace, struct perf_evsel *evsel, union perf_event *event __maybe_unused, struct perf_sample *sample)
 
static int trace__sched_stat_runtime (struct trace *trace, struct perf_evsel *evsel, union perf_event *event __maybe_unused, struct perf_sample *sample)
 
static int bpf_output__printer (enum binary_printer_ops op, unsigned int val, void *extra __maybe_unused, FILE *fp)
 
static void bpf_output__fprintf (struct trace *trace, struct perf_sample *sample)
 
static int trace__event_handler (struct trace *trace, struct perf_evsel *evsel, union perf_event *event __maybe_unused, struct perf_sample *sample)
 
static void print_location (FILE *f, struct perf_sample *sample, struct addr_location *al, bool print_dso, bool print_sym)
 
static int trace__pgfault (struct trace *trace, struct perf_evsel *evsel, union perf_event *event __maybe_unused, struct perf_sample *sample)
 
static void trace__set_base_time (struct trace *trace, struct perf_evsel *evsel, struct perf_sample *sample)
 
static int trace__process_sample (struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine __maybe_unused)
 
static int trace__record (struct trace *trace, int argc, const char **argv)
 
static size_t trace__fprintf_thread_summary (struct trace *trace, FILE *fp)
 
static bool perf_evlist__add_vfs_getname (struct perf_evlist *evlist)
 
static struct perf_evselperf_evsel__new_pgfault (u64 config)
 
static void trace__handle_event (struct trace *trace, union perf_event *event, struct perf_sample *sample)
 
static int trace__add_syscall_newtp (struct trace *trace)
 
static int trace__set_ev_qualifier_filter (struct trace *trace)
 
static int trace__set_filter_loop_pids (struct trace *trace)
 
static int trace__run (struct trace *trace, int argc, const char **argv)
 
static int trace__replay (struct trace *trace)
 
static size_t trace__fprintf_threads_header (FILE *fp)
 
 DEFINE_RESORT_RB (syscall_stats, a->msecs > b->msecs, struct stats *stats;double msecs;int syscall;)
 
static size_t thread__dump_stats (struct thread_trace *ttrace, struct trace *trace, FILE *fp)
 
static size_t trace__fprintf_thread (FILE *fp, struct thread *thread, struct trace *trace)
 
static unsigned long thread__nr_events (struct thread_trace *ttrace)
 
 DEFINE_RESORT_RB (threads,(thread__nr_events(a->thread->priv)< thread__nr_events(b->thread->priv)), struct thread *thread;)
 
static int trace__set_duration (const struct option *opt, const char *str, int unset __maybe_unused)
 
static int trace__set_filter_pids (const struct option *opt, const char *str, int unset __maybe_unused)
 
static int trace__open_output (struct trace *trace, const char *filename)
 
static int parse_pagefaults (const struct option *opt, const char *str, int unset __maybe_unused)
 
static void evlist__set_evsel_handler (struct perf_evlist *evlist, void *handler)
 
static int trace__parse_events_option (const struct option *opt, const char *str, int unset __maybe_unused)
 
static int trace__parse_cgroups (const struct option *opt, const char *str, int unset)
 
int cmd_trace (int argc, const char **argv)
 

Variables

static const char * bpf_cmd []
 
static const char * epoll_ctl_ops [] = { "ADD", "DEL", "MOD", }
 
static const char * itimers [] = { "REAL", "VIRTUAL", "PROF", }
 
static const char * keyctl_options []
 
static const char * whences []
 
static const char * fcntl_cmds []
 
static const char * fcntl_linux_specific_cmds []
 
static struct strarrayfcntl_cmds_arrays []
 
static const char * rlimit_resources []
 
static const char * sighow [] = { "BLOCK", "UNBLOCK", "SETMASK", }
 
static const char * clockid []
 
static const char * socket_families []
 
static struct syscall_fmt syscall_fmts []
 
static const size_t trace__entry_str_size = 2048
 
static bool done = false
 
static bool interrupted = false
 

Macro Definition Documentation

◆ AT_FDCWD

#define AT_FDCWD   -100

Definition at line 346 of file builtin-trace.c.

◆ DEFINE_STRARRAYS

#define DEFINE_STRARRAYS (   array)
Value:
struct strarrays strarrays__##array = { \
.nr_entries = ARRAY_SIZE(array), \
.entries = array, \
}
#define array

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

◆ F_LINUX_SPECIFIC_BASE

#define F_LINUX_SPECIFIC_BASE   1024

Definition at line 69 of file builtin-trace.c.

◆ GRND_NONBLOCK

#define GRND_NONBLOCK   0x0001

Definition at line 519 of file builtin-trace.c.

◆ GRND_RANDOM

#define GRND_RANDOM   0x0002

Definition at line 522 of file builtin-trace.c.

◆ P_FLAG [1/2]

#define P_FLAG (   n)
Value:
if (flags & O_##n) { \
printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
flags &= ~O_##n; \
}
size_t size
Definition: evsel.c:60
u32 flags

◆ P_FLAG [2/2]

#define P_FLAG (   n)
Value:
if (flags & GRND_##n) { \
printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
flags &= ~GRND_##n; \
}
size_t size
Definition: evsel.c:60
u32 flags

◆ P_MODE

#define P_MODE (   n)
Value:
if (mode & n##_OK) { \
printed += scnprintf(bf + printed, size - printed, "%s", #n); \
mode &= ~n##_OK; \
}
size_t size
Definition: evsel.c:60

◆ perf_evsel__init_sc_tp_ptr_field

#define perf_evsel__init_sc_tp_ptr_field (   evsel,
  name 
)
Value:
({ struct syscall_tp *sc = evsel->priv;\
perf_evsel__init_tp_ptr_field(evsel, &sc->name, #name); })
const char * name

Definition at line 233 of file builtin-trace.c.

◆ perf_evsel__init_sc_tp_uint_field

#define perf_evsel__init_sc_tp_uint_field (   evsel,
  name 
)
Value:
({ struct syscall_tp *sc = evsel->priv;\
perf_evsel__init_tp_uint_field(evsel, &sc->name, #name); })
const char * name

Definition at line 217 of file builtin-trace.c.

◆ perf_evsel__sc_tp_ptr

#define perf_evsel__sc_tp_ptr (   evsel,
  name,
  sample 
)
Value:
({ struct syscall_tp *fields = evsel->priv; \
fields->name.pointer(&fields->name, sample); })
u64 fields

Definition at line 286 of file builtin-trace.c.

◆ perf_evsel__sc_tp_uint

#define perf_evsel__sc_tp_uint (   evsel,
  name,
  sample 
)
Value:
({ struct syscall_tp *fields = evsel->priv; \
fields->name.integer(&fields->name, sample); })
u64 fields

Definition at line 282 of file builtin-trace.c.

◆ SCA_ACCMODE

#define SCA_ACCMODE   syscall_arg__scnprintf_access_mode

Definition at line 488 of file builtin-trace.c.

◆ SCA_CLOSE_FD

#define SCA_CLOSE_FD   syscall_arg__scnprintf_close_fd

Definition at line 365 of file builtin-trace.c.

◆ SCA_FDAT

#define SCA_FDAT   syscall_arg__scnprintf_fd_at

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

◆ SCA_FILENAME

#define SCA_FILENAME   syscall_arg__scnprintf_filename

Definition at line 493 of file builtin-trace.c.

◆ SCA_GETRANDOM_FLAGS

#define SCA_GETRANDOM_FLAGS   syscall_arg__scnprintf_getrandom_flags

Definition at line 546 of file builtin-trace.c.

◆ SCA_PIPE_FLAGS

#define SCA_PIPE_FLAGS   syscall_arg__scnprintf_pipe_flags

Definition at line 516 of file builtin-trace.c.

◆ SCA_STRARRAY

#define SCA_STRARRAY   syscall_arg__scnprintf_strarray

Definition at line 313 of file builtin-trace.c.

◆ STRARRAY

#define STRARRAY (   name,
  array 
)
Value:
{ .scnprintf = SCA_STRARRAY, \
.parm = &strarray__##array, }
#define array
#define SCA_STRARRAY

Definition at line 548 of file builtin-trace.c.

◆ TP_UINT_FIELD

#define TP_UINT_FIELD (   bits)
Value:
static u64 tp_field__u##bits(struct tp_field *field, struct perf_sample *sample) \
{ \
u##bits value; \
memcpy(&value, sample->raw_data + field->offset, sizeof(value)); \
return value; \
}
int value
Definition: python.c:1143
Definition: jevents.c:169

Definition at line 135 of file builtin-trace.c.

◆ TP_UINT_FIELD__SWAPPED

#define TP_UINT_FIELD__SWAPPED (   bits)
Value:
static u64 tp_field__swapped_u##bits(struct tp_field *field, struct perf_sample *sample) \
{ \
u##bits value; \
memcpy(&value, sample->raw_data + field->offset, sizeof(value)); \
return bswap_##bits(value);\
}
int value
Definition: python.c:1143
Definition: jevents.c:169

Definition at line 148 of file builtin-trace.c.

◆ TRACE_PFMAJ

#define TRACE_PFMAJ   (1 << 0)

Definition at line 913 of file builtin-trace.c.

◆ TRACE_PFMIN

#define TRACE_PFMIN   (1 << 1)

Definition at line 914 of file builtin-trace.c.

Typedef Documentation

◆ tracepoint_handler

typedef int(* tracepoint_handler) (struct trace *trace, struct perf_evsel *evsel, union perf_event *event, struct perf_sample *sample)

Definition at line 1491 of file builtin-trace.c.

Function Documentation

◆ __syscall_arg__scnprintf_strarray()

static size_t __syscall_arg__scnprintf_strarray ( char *  bf,
size_t  size,
const char *  intfmt,
struct syscall_arg arg 
)
static

Definition at line 300 of file builtin-trace.c.

Here is the call graph for this function:

◆ __trace__fprintf_tstamp()

static size_t __trace__fprintf_tstamp ( struct trace trace,
u64  tstamp,
FILE *  fp 
)
static

Definition at line 1060 of file builtin-trace.c.

◆ bpf_output__fprintf()

static void bpf_output__fprintf ( struct trace trace,
struct perf_sample sample 
)
static

Definition at line 1927 of file builtin-trace.c.

Here is the call graph for this function:

◆ bpf_output__printer()

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

Definition at line 1903 of file builtin-trace.c.

◆ cmd_trace()

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

Definition at line 3022 of file builtin-trace.c.

Here is the call graph for this function:

◆ DEFINE_RESORT_RB() [1/2]

DEFINE_RESORT_RB ( syscall_stats  ,
a->  msecs,
b->  msecs,
struct stats *stats;double msecs;int syscall  
)

Definition at line 2722 of file builtin-trace.c.

Here is the call graph for this function:

◆ DEFINE_RESORT_RB() [2/2]

DEFINE_RESORT_RB ( threads  ,
(thread__nr_events(a->thread->priv)< thread__nr_events(b->thread->priv))  ,
struct thread *thread  
)

Definition at line 2812 of file builtin-trace.c.

Here is the call graph for this function:

◆ DEFINE_STRARRAY() [1/9]

static DEFINE_STRARRAY ( bpf_cmd  )
static

◆ DEFINE_STRARRAY() [2/9]

static DEFINE_STRARRAY ( itimers  )
static

◆ DEFINE_STRARRAY() [3/9]

static DEFINE_STRARRAY ( keyctl_options  )
static

◆ DEFINE_STRARRAY() [4/9]

static DEFINE_STRARRAY ( whences  )
static

◆ DEFINE_STRARRAY() [5/9]

static DEFINE_STRARRAY ( fcntl_cmds  )
static

◆ DEFINE_STRARRAY() [6/9]

static DEFINE_STRARRAY ( rlimit_resources  )
static

◆ DEFINE_STRARRAY() [7/9]

static DEFINE_STRARRAY ( sighow  )
static

◆ DEFINE_STRARRAY() [8/9]

static DEFINE_STRARRAY ( clockid  )
static

◆ DEFINE_STRARRAY() [9/9]

static DEFINE_STRARRAY ( socket_families  )
static

◆ DEFINE_STRARRAY_OFFSET() [1/2]

static DEFINE_STRARRAY_OFFSET ( epoll_ctl_ops  ,
 
)
static

◆ DEFINE_STRARRAY_OFFSET() [2/2]

static DEFINE_STRARRAY_OFFSET ( fcntl_linux_specific_cmds  ,
F_LINUX_SPECIFIC_BASE   
)
static

◆ DEFINE_STRARRAYS()

static DEFINE_STRARRAYS ( fcntl_cmds_arrays  )
static

◆ errno_to_name()

static const char* errno_to_name ( struct perf_evsel evsel,
int  err 
)
static

Definition at line 1688 of file builtin-trace.c.

Here is the call graph for this function:

◆ evlist__set_evsel_handler()

static void evlist__set_evsel_handler ( struct perf_evlist evlist,
void *  handler 
)
static

Definition at line 2916 of file builtin-trace.c.

◆ fprintf_duration()

static size_t fprintf_duration ( unsigned long  t,
bool  calculated,
FILE *  fp 
)
static

Definition at line 823 of file builtin-trace.c.

Here is the call graph for this function:

◆ parse_pagefaults()

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

Definition at line 2899 of file builtin-trace.c.

◆ perf_evlist__add_vfs_getname()

static bool perf_evlist__add_vfs_getname ( struct perf_evlist evlist)
static

Definition at line 2171 of file builtin-trace.c.

Here is the call graph for this function:

◆ perf_evsel__delete_priv()

static void perf_evsel__delete_priv ( struct perf_evsel evsel)
static

Definition at line 237 of file builtin-trace.c.

Here is the call graph for this function:

◆ perf_evsel__init_syscall_tp()

static int perf_evsel__init_syscall_tp ( struct perf_evsel evsel,
void *  handler 
)
static

Definition at line 243 of file builtin-trace.c.

Here is the call graph for this function:

◆ perf_evsel__init_tp_ptr_field()

static int perf_evsel__init_tp_ptr_field ( struct perf_evsel evsel,
struct tp_field field,
const char *  name 
)
static

Definition at line 221 of file builtin-trace.c.

Here is the call graph for this function:

◆ perf_evsel__init_tp_uint_field()

static int perf_evsel__init_tp_uint_field ( struct perf_evsel evsel,
struct tp_field field,
const char *  name 
)
static

Definition at line 205 of file builtin-trace.c.

Here is the call graph for this function:

◆ perf_evsel__new_pgfault()

static struct perf_evsel* perf_evsel__new_pgfault ( u64  config)
static

Definition at line 2188 of file builtin-trace.c.

Here is the call graph for this function:

◆ perf_evsel__syscall_newtp()

static struct perf_evsel* perf_evsel__syscall_newtp ( const char *  direction,
void *  handler 
)
static

Definition at line 261 of file builtin-trace.c.

Here is the call graph for this function:

◆ pid__scnprintf_fd()

size_t pid__scnprintf_fd ( struct trace trace,
pid_t  pid,
int  fd,
char *  bf,
size_t  size 
)

Definition at line 1004 of file builtin-trace.c.

Here is the call graph for this function:

◆ print_location()

static void print_location ( FILE *  f,
struct perf_sample sample,
struct addr_location al,
bool  print_dso,
bool  print_sym 
)
static

Definition at line 1975 of file builtin-trace.c.

◆ sig_handler()

static void sig_handler ( int sig  )
static

Definition at line 1084 of file builtin-trace.c.

◆ strarray__scnprintf()

size_t strarray__scnprintf ( struct strarray sa,
char *  bf,
size_t  size,
const char *  intfmt,
int  val 
)

Definition at line 290 of file builtin-trace.c.

◆ syscall__alloc_arg_fmts()

static int syscall__alloc_arg_fmts ( struct syscall sc,
int  nr_args 
)
static

Definition at line 1184 of file builtin-trace.c.

◆ syscall__scnprintf_args()

static size_t syscall__scnprintf_args ( struct syscall sc,
char *  bf,
size_t  size,
unsigned char *  args,
struct trace trace,
struct thread thread 
)
static

Definition at line 1418 of file builtin-trace.c.

Here is the call graph for this function:

◆ syscall__scnprintf_name()

static size_t syscall__scnprintf_name ( struct syscall sc,
char *  bf,
size_t  size,
struct syscall_arg arg 
)
static

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

◆ syscall__scnprintf_val()

static size_t syscall__scnprintf_val ( struct syscall sc,
char *  bf,
size_t  size,
struct syscall_arg arg,
unsigned long  val 
)
static

Definition at line 1406 of file builtin-trace.c.

◆ syscall__set_arg_fmts()

static int syscall__set_arg_fmts ( struct syscall sc)
static

Definition at line 1204 of file builtin-trace.c.

Here is the call graph for this function:

◆ syscall_arg__scnprintf_access_mode()

static size_t syscall_arg__scnprintf_access_mode ( char *  bf,
size_t  size,
struct syscall_arg arg 
)
static

Definition at line 463 of file builtin-trace.c.

◆ syscall_arg__scnprintf_close_fd()

static size_t syscall_arg__scnprintf_close_fd ( char *  bf,
size_t  size,
struct syscall_arg arg 
)
static

Definition at line 1021 of file builtin-trace.c.

Here is the call graph for this function:

◆ syscall_arg__scnprintf_fd()

size_t syscall_arg__scnprintf_fd ( char *  bf,
size_t  size,
struct syscall_arg arg 
)

Definition at line 992 of file builtin-trace.c.

Here is the call graph for this function:

◆ syscall_arg__scnprintf_fd_at()

static size_t syscall_arg__scnprintf_fd_at ( char *  bf,
size_t  size,
struct syscall_arg arg 
)
static

Definition at line 349 of file builtin-trace.c.

Here is the call graph for this function:

◆ syscall_arg__scnprintf_filename()

static size_t syscall_arg__scnprintf_filename ( char *  bf,
size_t  size,
struct syscall_arg arg 
)
static

Definition at line 1043 of file builtin-trace.c.

Here is the call graph for this function:

◆ syscall_arg__scnprintf_getrandom_flags()

static size_t syscall_arg__scnprintf_getrandom_flags ( char *  bf,
size_t  size,
struct syscall_arg arg 
)
static

Definition at line 525 of file builtin-trace.c.

◆ syscall_arg__scnprintf_hex()

size_t syscall_arg__scnprintf_hex ( char *  bf,
size_t  size,
struct syscall_arg arg 
)

Definition at line 367 of file builtin-trace.c.

◆ syscall_arg__scnprintf_int()

size_t syscall_arg__scnprintf_int ( char *  bf,
size_t  size,
struct syscall_arg arg 
)

Definition at line 372 of file builtin-trace.c.

◆ syscall_arg__scnprintf_long()

size_t syscall_arg__scnprintf_long ( char *  bf,
size_t  size,
struct syscall_arg arg 
)

Definition at line 377 of file builtin-trace.c.

◆ syscall_arg__scnprintf_pipe_flags()

static size_t syscall_arg__scnprintf_pipe_flags ( char *  bf,
size_t  size,
struct syscall_arg arg 
)
static

Definition at line 495 of file builtin-trace.c.

◆ syscall_arg__scnprintf_strarray()

static size_t syscall_arg__scnprintf_strarray ( char *  bf,
size_t  size,
struct syscall_arg arg 
)
static

Definition at line 307 of file builtin-trace.c.

Here is the call graph for this function:

◆ syscall_arg__scnprintf_strarrays()

size_t syscall_arg__scnprintf_strarrays ( char *  bf,
size_t  size,
struct syscall_arg arg 
)

Definition at line 325 of file builtin-trace.c.

◆ syscall_arg__set_ret_scnprintf()

void syscall_arg__set_ret_scnprintf ( struct syscall_arg arg,
size_t(*)(char *bf, size_t size, struct syscall_arg *arg)  ret_scnprintf 
)

Definition at line 905 of file builtin-trace.c.

Here is the call graph for this function:

◆ syscall_arg__val()

unsigned long syscall_arg__val ( struct syscall_arg arg,
u8  idx 
)

Definition at line 1388 of file builtin-trace.c.

Here is the call graph for this function:

◆ syscall_fmt__cmp()

static int syscall_fmt__cmp ( const void *  name,
const void *  fmtp 
)
static

Definition at line 794 of file builtin-trace.c.

◆ syscall_fmt__find()

static struct syscall_fmt* syscall_fmt__find ( const char *  name)
static

Definition at line 800 of file builtin-trace.c.

Here is the call graph for this function:

◆ thread__dump_stats()

static size_t thread__dump_stats ( struct thread_trace ttrace,
struct trace trace,
FILE *  fp 
)
static

Definition at line 2736 of file builtin-trace.c.

Here is the call graph for this function:

◆ thread__fd_path()

static const char* thread__fd_path ( struct thread thread,
int  fd,
struct trace trace 
)
static

Definition at line 970 of file builtin-trace.c.

Here is the call graph for this function:

◆ thread__nr_events()

static unsigned long thread__nr_events ( struct thread_trace ttrace)
static

Definition at line 2807 of file builtin-trace.c.

◆ thread__read_fd_path()

static int thread__read_fd_path ( struct thread thread,
int  fd 
)
static

Definition at line 944 of file builtin-trace.c.

Here is the call graph for this function:

◆ thread__set_filename_pos()

static void thread__set_filename_pos ( struct thread thread,
const char *  bf,
unsigned long  ptr 
)
static

Definition at line 1034 of file builtin-trace.c.

Here is the call graph for this function:

◆ thread__trace()

static struct thread_trace* thread__trace ( struct thread thread,
FILE *  fp 
)
static

Definition at line 881 of file builtin-trace.c.

Here is the call graph for this function:

◆ thread__update_stats()

static void thread__update_stats ( struct thread_trace ttrace,
int  id,
struct perf_sample sample 
)
static

Definition at line 1538 of file builtin-trace.c.

Here is the call graph for this function:

◆ thread_trace__new()

static struct thread_trace* thread_trace__new ( void  )
static

Definition at line 869 of file builtin-trace.c.

Here is the call graph for this function:

◆ tp_field__init_ptr()

static int tp_field__init_ptr ( struct tp_field field,
struct format_field *  format_field 
)
static

Definition at line 191 of file builtin-trace.c.

Here is the call graph for this function:

◆ tp_field__init_uint()

static int tp_field__init_uint ( struct tp_field field,
struct format_field *  format_field,
bool  needs_swap 
)
static

Definition at line 160 of file builtin-trace.c.

◆ tp_field__ptr()

static void* tp_field__ptr ( struct tp_field field,
struct perf_sample sample 
)
static

Definition at line 186 of file builtin-trace.c.

◆ TP_UINT_FIELD() [1/4]

TP_UINT_FIELD ( )

◆ TP_UINT_FIELD() [2/4]

TP_UINT_FIELD ( 16  )

◆ TP_UINT_FIELD() [3/4]

TP_UINT_FIELD ( 32  )

◆ TP_UINT_FIELD() [4/4]

TP_UINT_FIELD ( 64  )

◆ TP_UINT_FIELD__SWAPPED() [1/3]

TP_UINT_FIELD__SWAPPED ( 16  )

◆ TP_UINT_FIELD__SWAPPED() [2/3]

TP_UINT_FIELD__SWAPPED ( 32  )

◆ TP_UINT_FIELD__SWAPPED() [3/3]

TP_UINT_FIELD__SWAPPED ( 64  )

◆ trace__add_syscall_newtp()

static int trace__add_syscall_newtp ( struct trace trace)
static

Definition at line 2237 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__event_handler()

static int trace__event_handler ( struct trace trace,
struct perf_evsel evsel,
union perf_event *event  __maybe_unused,
struct perf_sample sample 
)
static

Definition at line 1934 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__filter_duration()

static bool trace__filter_duration ( struct trace trace,
double  t 
)
static

Definition at line 1055 of file builtin-trace.c.

◆ trace__fprintf_callchain()

static int trace__fprintf_callchain ( struct trace trace,
struct perf_sample sample 
)
static

Definition at line 1678 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__fprintf_entry_head()

static size_t trace__fprintf_entry_head ( struct trace trace,
struct thread thread,
u64  duration,
bool  duration_calculated,
u64  tstamp,
FILE *  fp 
)
static

Definition at line 1090 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__fprintf_sample()

static int trace__fprintf_sample ( struct trace trace,
struct perf_evsel evsel,
struct perf_sample sample,
struct thread thread 
)
static

Definition at line 1584 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__fprintf_thread()

static size_t trace__fprintf_thread ( FILE *  fp,
struct thread thread,
struct trace trace 
)
static

Definition at line 2779 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__fprintf_thread_summary()

static size_t trace__fprintf_thread_summary ( struct trace trace,
FILE *  fp 
)
static

Definition at line 2819 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__fprintf_threads_header()

static size_t trace__fprintf_threads_header ( FILE *  fp)
static

Definition at line 2713 of file builtin-trace.c.

◆ trace__fprintf_tstamp()

static size_t trace__fprintf_tstamp ( struct trace trace,
u64  tstamp,
FILE *  fp 
)
static

Definition at line 1073 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__handle_event()

static void trace__handle_event ( struct trace trace,
union perf_event event,
struct perf_sample sample 
)
static

Definition at line 2208 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__machine__resolve_kernel_addr()

static char* trace__machine__resolve_kernel_addr ( void *  vmachine,
unsigned long long *  addrp,
char **  modp 
)
static

Definition at line 1133 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__open_output()

static int trace__open_output ( struct trace trace,
const char *  filename 
)
static

Definition at line 2882 of file builtin-trace.c.

◆ trace__parse_cgroups()

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

Definition at line 3010 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__parse_events_option()

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

Definition at line 2932 of file builtin-trace.c.

◆ trace__pgfault()

static int trace__pgfault ( struct trace trace,
struct perf_evsel evsel,
union perf_event *event  __maybe_unused,
struct perf_sample sample 
)
static

Definition at line 1992 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__printf_interrupted_entry()

static int trace__printf_interrupted_entry ( struct trace trace)
static

Definition at line 1564 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__process_event()

static int trace__process_event ( struct trace trace,
struct machine machine,
union perf_event event,
struct perf_sample sample 
)
static

Definition at line 1105 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__process_sample()

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

Definition at line 2082 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__read_syscall_info()

static int trace__read_syscall_info ( struct trace trace,
int  id 
)
static

Definition at line 1243 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__record()

static int trace__record ( struct trace trace,
int  argc,
const char **  argv 
)
static

Definition at line 2109 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__replay()

static int trace__replay ( struct trace trace)
static

Definition at line 2612 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__resolve_callchain()

static int trace__resolve_callchain ( struct trace trace,
struct perf_evsel evsel,
struct perf_sample sample,
struct callchain_cursor cursor 
)
static

Definition at line 1662 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__run()

static int trace__run ( struct trace trace,
int  argc,
const char **  argv 
)
static

Definition at line 2335 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__sched_stat_runtime()

static int trace__sched_stat_runtime ( struct trace trace,
struct perf_evsel evsel,
union perf_event *event  __maybe_unused,
struct perf_sample sample 
)
static

Definition at line 1873 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__set_base_time()

static void trace__set_base_time ( struct trace trace,
struct perf_evsel evsel,
struct perf_sample sample 
)
static

Definition at line 2065 of file builtin-trace.c.

◆ trace__set_duration()

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

Definition at line 2841 of file builtin-trace.c.

◆ trace__set_ev_qualifier_filter()

static int trace__set_ev_qualifier_filter ( struct trace trace)
static

Definition at line 2286 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__set_fd_pathname()

static int trace__set_fd_pathname ( struct thread thread,
int  fd,
const char *  pathname 
)
static

Definition at line 918 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__set_filter_loop_pids()

static int trace__set_filter_loop_pids ( struct trace trace)
static

Definition at line 2311 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__set_filter_pids()

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

Definition at line 2850 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__symbols__exit()

static void trace__symbols__exit ( struct trace trace)
static

Definition at line 1176 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__symbols_init()

static int trace__symbols_init ( struct trace trace,
struct perf_evlist evlist 
)
static

Definition at line 1151 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__sys_enter()

static int trace__sys_enter ( struct trace trace,
struct perf_evsel evsel,
union perf_event *event  __maybe_unused,
struct perf_sample sample 
)
static

Definition at line 1601 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__sys_exit()

static int trace__sys_exit ( struct trace trace,
struct perf_evsel evsel,
union perf_event *event  __maybe_unused,
struct perf_sample sample 
)
static

Definition at line 1696 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__syscall_info()

static struct syscall* trace__syscall_info ( struct trace trace,
struct perf_evsel evsel,
int  id 
)
static

Definition at line 1495 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__tool_process()

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

Definition at line 1124 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__validate_ev_qualifier()

static int trace__validate_ev_qualifier ( struct trace trace)
static

Definition at line 1304 of file builtin-trace.c.

Here is the call graph for this function:

◆ trace__vfs_getname()

static int trace__vfs_getname ( struct trace trace,
struct perf_evsel evsel,
union perf_event *event  __maybe_unused,
struct perf_sample sample 
)
static

Definition at line 1812 of file builtin-trace.c.

Here is the call graph for this function:

Variable Documentation

◆ bpf_cmd

const char* bpf_cmd[]
static
Initial value:
= {
"MAP_CREATE", "MAP_LOOKUP_ELEM", "MAP_UPDATE_ELEM", "MAP_DELETE_ELEM",
"MAP_GET_NEXT_KEY", "PROG_LOAD",
}

Definition at line 382 of file builtin-trace.c.

◆ clockid

const char* clockid[]
static
Initial value:
= {
"REALTIME", "MONOTONIC", "PROCESS_CPUTIME_ID", "THREAD_CPUTIME_ID",
"MONOTONIC_RAW", "REALTIME_COARSE", "MONOTONIC_COARSE", "BOOTTIME",
"REALTIME_ALARM", "BOOTTIME_ALARM", "SGI_CYCLE", "TAI"
}

Definition at line 446 of file builtin-trace.c.

◆ done

bool done = false
static

Definition at line 1081 of file builtin-trace.c.

◆ epoll_ctl_ops

const char* epoll_ctl_ops[] = { "ADD", "DEL", "MOD", }
static

Definition at line 388 of file builtin-trace.c.

◆ fcntl_cmds

const char* fcntl_cmds[]
static
Initial value:
= {
"DUPFD", "GETFD", "SETFD", "GETFL", "SETFL", "GETLK", "SETLK",
"SETLKW", "SETOWN", "GETOWN", "SETSIG", "GETSIG", "GETLK64",
"SETLK64", "SETLKW64", "SETOWN_EX", "GETOWN_EX",
"GETOWNER_UIDS",
}

Definition at line 413 of file builtin-trace.c.

◆ fcntl_cmds_arrays

struct strarray* fcntl_cmds_arrays[]
static
Initial value:
= {
&strarray__fcntl_cmds,
&strarray__fcntl_linux_specific_cmds,
}

Definition at line 429 of file builtin-trace.c.

◆ fcntl_linux_specific_cmds

const char* fcntl_linux_specific_cmds[]
static
Initial value:
= {
"SETLEASE", "GETLEASE", "NOTIFY", [5] = "CANCELLK", "DUPFD_CLOEXEC",
"SETPIPE_SZ", "GETPIPE_SZ", "ADD_SEALS", "GET_SEALS",
"GET_RW_HINT", "SET_RW_HINT", "GET_FILE_RW_HINT", "SET_FILE_RW_HINT",
}

Definition at line 421 of file builtin-trace.c.

◆ interrupted

bool interrupted = false
static

Definition at line 1082 of file builtin-trace.c.

◆ itimers

const char* itimers[] = { "REAL", "VIRTUAL", "PROF", }
static

Definition at line 391 of file builtin-trace.c.

◆ keyctl_options

const char* keyctl_options[]
static
Initial value:
= {
"GET_KEYRING_ID", "JOIN_SESSION_KEYRING", "UPDATE", "REVOKE", "CHOWN",
"SETPERM", "DESCRIBE", "CLEAR", "LINK", "UNLINK", "SEARCH", "READ",
"INSTANTIATE", "NEGATE", "SET_REQKEY_KEYRING", "SET_TIMEOUT",
"ASSUME_AUTHORITY", "GET_SECURITY", "SESSION_TO_PARENT", "REJECT",
"INSTANTIATE_IOV", "INVALIDATE", "GET_PERSISTENT",
}

Definition at line 394 of file builtin-trace.c.

◆ rlimit_resources

const char* rlimit_resources[]
static
Initial value:
= {
"CPU", "FSIZE", "DATA", "STACK", "CORE", "RSS", "NPROC", "NOFILE",
"MEMLOCK", "AS", "LOCKS", "SIGPENDING", "MSGQUEUE", "NICE", "RTPRIO",
"RTTIME",
}

Definition at line 436 of file builtin-trace.c.

◆ sighow

const char* sighow[] = { "BLOCK", "UNBLOCK", "SETMASK", }
static

Definition at line 443 of file builtin-trace.c.

◆ socket_families

const char* socket_families[]
static
Initial value:
= {
"UNSPEC", "LOCAL", "INET", "AX25", "IPX", "APPLETALK", "NETROM",
"BRIDGE", "ATMPVC", "X25", "INET6", "ROSE", "DECnet", "NETBEUI",
"SECURITY", "KEY", "NETLINK", "PACKET", "ASH", "ECONET", "ATMSVC",
"RDS", "SNA", "IRDA", "PPPOX", "WANPIPE", "LLC", "IB", "CAN", "TIPC",
"BLUETOOTH", "IUCV", "RXRPC", "ISDN", "PHONET", "IEEE802154", "CAIF",
"ALG", "NFC", "VSOCK",
}

Definition at line 453 of file builtin-trace.c.

◆ syscall_fmts

struct syscall_fmt syscall_fmts[]
static

◆ trace__entry_str_size

const size_t trace__entry_str_size = 2048
static

Definition at line 916 of file builtin-trace.c.

◆ whences

const char* whences[]
static
Initial value:
= { "SET", "CUR", "END",
}

Definition at line 403 of file builtin-trace.c.