Linux Perf
|
#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_evsel * | perf_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_fmt * | syscall_fmt__find (const char *name) |
static size_t | fprintf_duration (unsigned long t, bool calculated, FILE *fp) |
static struct thread_trace * | thread_trace__new (void) |
static struct thread_trace * | thread__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 syscall * | trace__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_evsel * | perf_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 strarray * | fcntl_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 |
#define AT_FDCWD -100 |
Definition at line 346 of file builtin-trace.c.
#define DEFINE_STRARRAYS | ( | array | ) |
Definition at line 320 of file builtin-trace.c.
#define F_LINUX_SPECIFIC_BASE 1024 |
Definition at line 69 of file builtin-trace.c.
#define GRND_NONBLOCK 0x0001 |
Definition at line 519 of file builtin-trace.c.
#define GRND_RANDOM 0x0002 |
Definition at line 522 of file builtin-trace.c.
#define P_FLAG | ( | n | ) |
#define P_FLAG | ( | n | ) |
#define P_MODE | ( | n | ) |
#define perf_evsel__init_sc_tp_ptr_field | ( | evsel, | |
name | |||
) |
Definition at line 233 of file builtin-trace.c.
#define perf_evsel__init_sc_tp_uint_field | ( | evsel, | |
name | |||
) |
Definition at line 217 of file builtin-trace.c.
Definition at line 286 of file builtin-trace.c.
Definition at line 282 of file builtin-trace.c.
#define SCA_ACCMODE syscall_arg__scnprintf_access_mode |
Definition at line 488 of file builtin-trace.c.
#define SCA_CLOSE_FD syscall_arg__scnprintf_close_fd |
Definition at line 365 of file builtin-trace.c.
#define SCA_FDAT syscall_arg__scnprintf_fd_at |
Definition at line 360 of file builtin-trace.c.
#define SCA_FILENAME syscall_arg__scnprintf_filename |
Definition at line 493 of file builtin-trace.c.
#define SCA_GETRANDOM_FLAGS syscall_arg__scnprintf_getrandom_flags |
Definition at line 546 of file builtin-trace.c.
#define SCA_PIPE_FLAGS syscall_arg__scnprintf_pipe_flags |
Definition at line 516 of file builtin-trace.c.
#define SCA_STRARRAY syscall_arg__scnprintf_strarray |
Definition at line 313 of file builtin-trace.c.
Definition at line 548 of file builtin-trace.c.
#define TP_UINT_FIELD | ( | bits | ) |
Definition at line 135 of file builtin-trace.c.
#define TP_UINT_FIELD__SWAPPED | ( | bits | ) |
Definition at line 148 of file builtin-trace.c.
#define TRACE_PFMAJ (1 << 0) |
Definition at line 913 of file builtin-trace.c.
#define TRACE_PFMIN (1 << 1) |
Definition at line 914 of file builtin-trace.c.
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.
|
static |
|
static |
Definition at line 1060 of file builtin-trace.c.
|
static |
|
static |
Definition at line 1903 of file builtin-trace.c.
int cmd_trace | ( | int | argc, |
const char ** | argv | ||
) |
DEFINE_RESORT_RB | ( | threads | , |
(thread__nr_events(a->thread->priv)< thread__nr_events(b->thread->priv)) | , | ||
struct thread *thread; | |||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 2916 of file builtin-trace.c.
|
static |
|
static |
Definition at line 2899 of file builtin-trace.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
size_t pid__scnprintf_fd | ( | struct trace * | trace, |
pid_t | pid, | ||
int | fd, | ||
char * | bf, | ||
size_t | size | ||
) |
|
static |
Definition at line 1975 of file builtin-trace.c.
|
static |
Definition at line 1084 of file builtin-trace.c.
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.
|
static |
Definition at line 1184 of file builtin-trace.c.
|
static |
Definition at line 1397 of file builtin-trace.c.
|
static |
Definition at line 1406 of file builtin-trace.c.
|
static |
|
static |
Definition at line 463 of file builtin-trace.c.
|
static |
size_t syscall_arg__scnprintf_fd | ( | char * | bf, |
size_t | size, | ||
struct syscall_arg * | arg | ||
) |
|
static |
|
static |
|
static |
Definition at line 525 of file builtin-trace.c.
size_t syscall_arg__scnprintf_hex | ( | char * | bf, |
size_t | size, | ||
struct syscall_arg * | arg | ||
) |
Definition at line 367 of file builtin-trace.c.
size_t syscall_arg__scnprintf_int | ( | char * | bf, |
size_t | size, | ||
struct syscall_arg * | arg | ||
) |
Definition at line 372 of file builtin-trace.c.
size_t syscall_arg__scnprintf_long | ( | char * | bf, |
size_t | size, | ||
struct syscall_arg * | arg | ||
) |
Definition at line 377 of file builtin-trace.c.
|
static |
Definition at line 495 of file builtin-trace.c.
|
static |
size_t syscall_arg__scnprintf_strarrays | ( | char * | bf, |
size_t | size, | ||
struct syscall_arg * | arg | ||
) |
Definition at line 325 of file builtin-trace.c.
void syscall_arg__set_ret_scnprintf | ( | struct syscall_arg * | arg, |
size_t(*)(char *bf, size_t size, struct syscall_arg *arg) | ret_scnprintf | ||
) |
unsigned long syscall_arg__val | ( | struct syscall_arg * | arg, |
u8 | idx | ||
) |
|
static |
Definition at line 794 of file builtin-trace.c.
|
static |
|
static |
|
static |
Definition at line 2807 of file builtin-trace.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 160 of file builtin-trace.c.
|
static |
Definition at line 186 of file builtin-trace.c.
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 |
|
static |
|
static |
Definition at line 1055 of file builtin-trace.c.
|
static |
|
static |
|
static |
|
static |
Definition at line 2713 of file builtin-trace.c.
|
static |
|
static |
|
static |
|
static |
Definition at line 2882 of file builtin-trace.c.
|
static |
|
static |
Definition at line 2932 of file builtin-trace.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 2065 of file builtin-trace.c.
|
static |
Definition at line 2841 of file builtin-trace.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 382 of file builtin-trace.c.
|
static |
Definition at line 446 of file builtin-trace.c.
|
static |
Definition at line 1081 of file builtin-trace.c.
|
static |
Definition at line 388 of file builtin-trace.c.
|
static |
Definition at line 413 of file builtin-trace.c.
|
static |
Definition at line 429 of file builtin-trace.c.
|
static |
Definition at line 421 of file builtin-trace.c.
|
static |
Definition at line 1082 of file builtin-trace.c.
|
static |
Definition at line 391 of file builtin-trace.c.
|
static |
Definition at line 394 of file builtin-trace.c.
|
static |
Definition at line 436 of file builtin-trace.c.
|
static |
Definition at line 443 of file builtin-trace.c.
|
static |
Definition at line 453 of file builtin-trace.c.
|
static |
|
static |
Definition at line 916 of file builtin-trace.c.
|
static |
Definition at line 403 of file builtin-trace.c.