Linux Perf
builtin-top.c File Reference
#include "builtin.h"
#include "perf.h"
#include "util/annotate.h"
#include "util/config.h"
#include "util/color.h"
#include "util/drv_configs.h"
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/event.h"
#include "util/machine.h"
#include "util/session.h"
#include "util/symbol.h"
#include "util/thread.h"
#include "util/thread_map.h"
#include "util/top.h"
#include <linux/rbtree.h>
#include <subcmd/parse-options.h>
#include "util/parse-events.h"
#include "util/cpumap.h"
#include "util/xyarray.h"
#include "util/sort.h"
#include "util/term.h"
#include "util/intlist.h"
#include "util/parse-branch-options.h"
#include "arch/common.h"
#include "util/debug.h"
#include <assert.h>
#include <elf.h>
#include <fcntl.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <inttypes.h>
#include <errno.h>
#include <time.h>
#include <sched.h>
#include <signal.h>
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <poll.h>
#include <sys/prctl.h>
#include <sys/wait.h>
#include <sys/uio.h>
#include <sys/utsname.h>
#include <sys/mman.h>
#include <linux/stringify.h>
#include <linux/time64.h>
#include <linux/types.h>
#include "sane_ctype.h"
Include dependency graph for builtin-top.c:

Go to the source code of this file.

Macros

#define HEADER_LINE_NR   5
 

Functions

static void perf_top__update_print_entries (struct perf_top *top)
 
static void winch_sig (int sig __maybe_unused)
 
static void perf_top__resize (struct perf_top *top)
 
static int perf_top__parse_source (struct perf_top *top, struct hist_entry *he)
 
static void __zero_source_counters (struct hist_entry *he)
 
static void ui__warn_map_erange (struct map *map, struct symbol *sym, u64 ip)
 
static void perf_top__record_precise_ip (struct perf_top *top, struct hist_entry *he, struct perf_sample *sample, struct perf_evsel *evsel, u64 ip)
 
static void perf_top__show_details (struct perf_top *top)
 
static void perf_top__print_sym_table (struct perf_top *top)
 
static void prompt_integer (int *target, const char *msg)
 
static void prompt_percent (int *target, const char *msg)
 
static void perf_top__prompt_symbol (struct perf_top *top, const char *msg)
 
static void perf_top__print_mapped_keys (struct perf_top *top)
 
static int perf_top__key_mapped (struct perf_top *top, int c)
 
static bool perf_top__handle_keypress (struct perf_top *top, int c)
 
static void perf_top__sort_new_samples (void *arg)
 
static void * display_thread_tui (void *arg)
 
static void display_sig (int sig __maybe_unused)
 
static void display_setup_sig (void)
 
static void * display_thread (void *arg)
 
static int hist_iter__top_callback (struct hist_entry_iter *iter, struct addr_location *al, bool single, void *arg)
 
static void perf_event__process_sample (struct perf_tool *tool, const union perf_event *event, struct perf_evsel *evsel, struct perf_sample *sample, struct machine *machine)
 
static void perf_top__mmap_read_idx (struct perf_top *top, int idx)
 
static void perf_top__mmap_read (struct perf_top *top)
 
static int perf_top__overwrite_check (struct perf_top *top)
 
static int perf_top_overwrite_fallback (struct perf_top *top, struct perf_evsel *evsel)
 
static int perf_top__start_counters (struct perf_top *top)
 
static int callchain_param__setup_sample_type (struct callchain_param *callchain)
 
static int __cmd_top (struct perf_top *top)
 
static int callchain_opt (const struct option *opt, const char *arg, int unset)
 
static int parse_callchain_opt (const struct option *opt, const char *arg, int unset)
 
static int perf_top_config (const char *var, const char *value, void *cb __maybe_unused)
 
static int parse_percent_limit (const struct option *opt, const char *arg, int unset __maybe_unused)
 
int cmd_top (int argc, const char **argv)
 

Variables

static volatile int done
 
static volatile int resize
 
const char top_callchain_help []
 

Macro Definition Documentation

◆ HEADER_LINE_NR

#define HEADER_LINE_NR   5

Definition at line 82 of file builtin-top.c.

Function Documentation

◆ __cmd_top()

static int __cmd_top ( struct perf_top top)
static

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

Here is the call graph for this function:

◆ __zero_source_counters()

static void __zero_source_counters ( struct hist_entry he)
static

Definition at line 149 of file builtin-top.c.

Here is the call graph for this function:

◆ callchain_opt()

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

Definition at line 1192 of file builtin-top.c.

Here is the call graph for this function:

◆ callchain_param__setup_sample_type()

static int callchain_param__setup_sample_type ( struct callchain_param callchain)
static

Definition at line 1049 of file builtin-top.c.

Here is the call graph for this function:

◆ cmd_top()

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

Definition at line 1245 of file builtin-top.c.

Here is the call graph for this function:

◆ display_setup_sig()

static void display_setup_sig ( void  )
static

Definition at line 621 of file builtin-top.c.

Here is the call graph for this function:

◆ display_sig()

static void display_sig ( int sig  __maybe_unused)
static

Definition at line 616 of file builtin-top.c.

◆ display_thread()

static void* display_thread ( void *  arg)
static

Definition at line 630 of file builtin-top.c.

Here is the call graph for this function:

◆ display_thread_tui()

static void* display_thread_tui ( void *  arg)
static

Definition at line 576 of file builtin-top.c.

Here is the call graph for this function:

◆ hist_iter__top_callback()

static int hist_iter__top_callback ( struct hist_entry_iter iter,
struct addr_location al,
bool  single,
void *  arg 
)
static

Definition at line 679 of file builtin-top.c.

Here is the call graph for this function:

◆ parse_callchain_opt()

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

Definition at line 1199 of file builtin-top.c.

Here is the call graph for this function:

◆ parse_percent_limit()

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

Definition at line 1233 of file builtin-top.c.

◆ perf_event__process_sample()

static void perf_event__process_sample ( struct perf_tool tool,
const union perf_event event,
struct perf_evsel evsel,
struct perf_sample sample,
struct machine machine 
)
static

Definition at line 695 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__handle_keypress()

static bool perf_top__handle_keypress ( struct perf_top top,
int  c 
)
static

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

Here is the call graph for this function:

◆ perf_top__key_mapped()

static int perf_top__key_mapped ( struct perf_top top,
int  c 
)
static

Definition at line 422 of file builtin-top.c.

◆ perf_top__mmap_read()

static void perf_top__mmap_read ( struct perf_top top)
static

Definition at line 880 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__mmap_read_idx()

static void perf_top__mmap_read_idx ( struct perf_top top,
int  idx 
)
static

Definition at line 803 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__overwrite_check()

static int perf_top__overwrite_check ( struct perf_top top)
static

Definition at line 924 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__parse_source()

static int perf_top__parse_source ( struct perf_top top,
struct hist_entry he 
)
static

Definition at line 100 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__print_mapped_keys()

static void perf_top__print_mapped_keys ( struct perf_top top)
static

Definition at line 390 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__print_sym_table()

static void perf_top__print_sym_table ( struct perf_top top)
static

Definition at line 262 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__prompt_symbol()

static void perf_top__prompt_symbol ( struct perf_top top,
const char *  msg 
)
static

Definition at line 348 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__record_precise_ip()

static void perf_top__record_precise_ip ( struct perf_top top,
struct hist_entry he,
struct perf_sample sample,
struct perf_evsel evsel,
u64  ip 
)
static

Definition at line 182 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__resize()

static void perf_top__resize ( struct perf_top top)
static

Definition at line 94 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__show_details()

static void perf_top__show_details ( struct perf_top top)
static

Definition at line 224 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__sort_new_samples()

static void perf_top__sort_new_samples ( void *  arg)
static

Definition at line 550 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__start_counters()

static int perf_top__start_counters ( struct perf_top top)
static

Definition at line 990 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top__update_print_entries()

static void perf_top__update_print_entries ( struct perf_top top)
static

Definition at line 84 of file builtin-top.c.

◆ perf_top_config()

static int perf_top_config ( const char *  var,
const char *  value,
void *cb  __maybe_unused 
)
static

Definition at line 1218 of file builtin-top.c.

Here is the call graph for this function:

◆ perf_top_overwrite_fallback()

static int perf_top_overwrite_fallback ( struct perf_top top,
struct perf_evsel evsel 
)
static

Definition at line 969 of file builtin-top.c.

Here is the call graph for this function:

◆ prompt_integer()

static void prompt_integer ( int *  target,
const char *  msg 
)
static

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

Here is the call graph for this function:

◆ prompt_percent()

static void prompt_percent ( int *  target,
const char *  msg 
)
static

Definition at line 339 of file builtin-top.c.

Here is the call graph for this function:

◆ ui__warn_map_erange()

static void ui__warn_map_erange ( struct map map,
struct symbol sym,
u64  ip 
)
static

Definition at line 155 of file builtin-top.c.

Here is the call graph for this function:

◆ winch_sig()

static void winch_sig ( int sig  __maybe_unused)
static

Definition at line 89 of file builtin-top.c.

Variable Documentation

◆ done

volatile int done
static

Definition at line 79 of file builtin-top.c.

◆ resize

volatile int resize
static

Definition at line 80 of file builtin-top.c.

◆ top_callchain_help

const char top_callchain_help[]
Initial value:
"\n\t\t\t\tDefault: fp,graph,0.5,caller,function"
#define CALLCHAIN_REPORT_HELP
Definition: callchain.h:25
#define CALLCHAIN_RECORD_HELP
Definition: callchain.h:23

Definition at line 1242 of file builtin-top.c.