Linux Perf
|
#include <inttypes.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <stdbool.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <linux/kernel.h>
#include <linux/perf_event.h>
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/log2.h>
#include <linux/string.h>
#include <sys/param.h>
#include <stdlib.h>
#include <stdio.h>
#include <linux/list.h>
#include "../perf.h"
#include "util.h"
#include "evlist.h"
#include "dso.h"
#include "map.h"
#include "pmu.h"
#include "evsel.h"
#include "cpumap.h"
#include "thread_map.h"
#include "asm/bug.h"
#include "auxtrace.h"
#include <linux/hash.h>
#include "event.h"
#include "session.h"
#include "debug.h"
#include <subcmd/parse-options.h>
#include "cs-etm.h"
#include "intel-pt.h"
#include "intel-bts.h"
#include "arm-spe.h"
#include "sane_ctype.h"
#include "symbol/kallsyms.h"
Go to the source code of this file.
Classes | |
struct | auxtrace_cache |
struct | sym_args |
Macros | |
#define | AUXTRACE_INIT_NR_QUEUES 32 |
#define | BUFFER_LIMIT_FOR_32_BIT (32 * 1024 * 1024) |
#define | PERF_ITRACE_DEFAULT_PERIOD_TYPE PERF_ITRACE_PERIOD_NANOSECS |
#define | PERF_ITRACE_DEFAULT_PERIOD 100000 |
#define | PERF_ITRACE_DEFAULT_CALLCHAIN_SZ 16 |
#define | PERF_ITRACE_MAX_CALLCHAIN_SZ 1024 |
#define | PERF_ITRACE_DEFAULT_LAST_BRANCH_SZ 64 |
#define | PERF_ITRACE_MAX_LAST_BRANCH_SZ 1024 |
Functions | |
static bool | auxtrace__dont_decode (struct perf_session *session) |
int | auxtrace_mmap__mmap (struct auxtrace_mmap *mm, struct auxtrace_mmap_params *mp, void *userpg, int fd) |
void | auxtrace_mmap__munmap (struct auxtrace_mmap *mm) |
void | auxtrace_mmap_params__init (struct auxtrace_mmap_params *mp, off_t auxtrace_offset, unsigned int auxtrace_pages, bool auxtrace_overwrite) |
void | auxtrace_mmap_params__set_idx (struct auxtrace_mmap_params *mp, struct perf_evlist *evlist, int idx, bool per_cpu) |
static struct auxtrace_queue * | auxtrace_alloc_queue_array (unsigned int nr_queues) |
int | auxtrace_queues__init (struct auxtrace_queues *queues) |
static int | auxtrace_queues__grow (struct auxtrace_queues *queues, unsigned int new_nr_queues) |
static void * | auxtrace_copy_data (u64 size, struct perf_session *session) |
static int | auxtrace_queues__queue_buffer (struct auxtrace_queues *queues, unsigned int idx, struct auxtrace_buffer *buffer) |
static int | auxtrace_queues__split_buffer (struct auxtrace_queues *queues, unsigned int idx, struct auxtrace_buffer *buffer) |
static bool | filter_cpu (struct perf_session *session, int cpu) |
static int | auxtrace_queues__add_buffer (struct auxtrace_queues *queues, struct perf_session *session, unsigned int idx, struct auxtrace_buffer *buffer, struct auxtrace_buffer **buffer_ptr) |
int | auxtrace_queues__add_event (struct auxtrace_queues *queues, struct perf_session *session, union perf_event *event, off_t data_offset, struct auxtrace_buffer **buffer_ptr) |
static int | auxtrace_queues__add_indexed_event (struct auxtrace_queues *queues, struct perf_session *session, off_t file_offset, size_t sz) |
void | auxtrace_queues__free (struct auxtrace_queues *queues) |
static void | auxtrace_heapify (struct auxtrace_heap_item *heap_array, unsigned int pos, unsigned int queue_nr, u64 ordinal) |
int | auxtrace_heap__add (struct auxtrace_heap *heap, unsigned int queue_nr, u64 ordinal) |
void | auxtrace_heap__free (struct auxtrace_heap *heap) |
void | auxtrace_heap__pop (struct auxtrace_heap *heap) |
size_t | auxtrace_record__info_priv_size (struct auxtrace_record *itr, struct perf_evlist *evlist) |
static int | auxtrace_not_supported (void) |
int | auxtrace_record__info_fill (struct auxtrace_record *itr, struct perf_session *session, struct auxtrace_info_event *auxtrace_info, size_t priv_size) |
void | auxtrace_record__free (struct auxtrace_record *itr) |
int | auxtrace_record__snapshot_start (struct auxtrace_record *itr) |
int | auxtrace_record__snapshot_finish (struct auxtrace_record *itr) |
int | auxtrace_record__find_snapshot (struct auxtrace_record *itr, int idx, struct auxtrace_mmap *mm, unsigned char *data, u64 *head, u64 *old) |
int | auxtrace_record__options (struct auxtrace_record *itr, struct perf_evlist *evlist, struct record_opts *opts) |
u64 | auxtrace_record__reference (struct auxtrace_record *itr) |
int | auxtrace_parse_snapshot_options (struct auxtrace_record *itr, struct record_opts *opts, const char *str) |
struct auxtrace_record *__weak | auxtrace_record__init (struct perf_evlist *evlist __maybe_unused, int *err) |
static int | auxtrace_index__alloc (struct list_head *head) |
void | auxtrace_index__free (struct list_head *head) |
static struct auxtrace_index * | auxtrace_index__last (struct list_head *head) |
int | auxtrace_index__auxtrace_event (struct list_head *head, union perf_event *event, off_t file_offset) |
static int | auxtrace_index__do_write (int fd, struct auxtrace_index *auxtrace_index) |
int | auxtrace_index__write (int fd, struct list_head *head) |
static int | auxtrace_index__process_entry (int fd, struct list_head *head, bool needs_swap) |
int | auxtrace_index__process (int fd, u64 size, struct perf_session *session, bool needs_swap) |
static int | auxtrace_queues__process_index_entry (struct auxtrace_queues *queues, struct perf_session *session, struct auxtrace_index_entry *ent) |
int | auxtrace_queues__process_index (struct auxtrace_queues *queues, struct perf_session *session) |
struct auxtrace_buffer * | auxtrace_buffer__next (struct auxtrace_queue *queue, struct auxtrace_buffer *buffer) |
void * | auxtrace_buffer__get_data (struct auxtrace_buffer *buffer, int fd) |
void | auxtrace_buffer__put_data (struct auxtrace_buffer *buffer) |
void | auxtrace_buffer__drop_data (struct auxtrace_buffer *buffer) |
void | auxtrace_buffer__free (struct auxtrace_buffer *buffer) |
void | auxtrace_synth_error (struct auxtrace_error_event *auxtrace_error, int type, int code, int cpu, pid_t pid, pid_t tid, u64 ip, const char *msg) |
int | perf_event__synthesize_auxtrace_info (struct auxtrace_record *itr, struct perf_tool *tool, struct perf_session *session, perf_event__handler_t process) |
int | perf_event__process_auxtrace_info (struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_session *session) |
s64 | perf_event__process_auxtrace (struct perf_tool *tool, union perf_event *event, struct perf_session *session) |
void | itrace_synth_opts__set_default (struct itrace_synth_opts *synth_opts) |
int | itrace_parse_synth_opts (const struct option *opt, const char *str, int unset) |
static const char * | auxtrace_error_name (int type) |
size_t | perf_event__fprintf_auxtrace_error (union perf_event *event, FILE *fp) |
void | perf_session__auxtrace_error_inc (struct perf_session *session, union perf_event *event) |
void | events_stats__auxtrace_error_warn (const struct events_stats *stats) |
int | perf_event__process_auxtrace_error (struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_session *session) |
static int | __auxtrace_mmap__read (struct auxtrace_mmap *mm, struct auxtrace_record *itr, struct perf_tool *tool, process_auxtrace_t fn, bool snapshot, size_t snapshot_size) |
int | auxtrace_mmap__read (struct auxtrace_mmap *mm, struct auxtrace_record *itr, struct perf_tool *tool, process_auxtrace_t fn) |
int | auxtrace_mmap__read_snapshot (struct auxtrace_mmap *mm, struct auxtrace_record *itr, struct perf_tool *tool, process_auxtrace_t fn, size_t snapshot_size) |
struct auxtrace_cache * | auxtrace_cache__new (unsigned int bits, size_t entry_size, unsigned int limit_percent) |
static void | auxtrace_cache__drop (struct auxtrace_cache *c) |
void | auxtrace_cache__free (struct auxtrace_cache *c) |
void * | auxtrace_cache__alloc_entry (struct auxtrace_cache *c) |
void | auxtrace_cache__free_entry (struct auxtrace_cache *c __maybe_unused, void *entry) |
int | auxtrace_cache__add (struct auxtrace_cache *c, u32 key, struct auxtrace_cache_entry *entry) |
void * | auxtrace_cache__lookup (struct auxtrace_cache *c, u32 key) |
static void | addr_filter__free_str (struct addr_filter *filt) |
static struct addr_filter * | addr_filter__new (void) |
static void | addr_filter__free (struct addr_filter *filt) |
static void | addr_filters__add (struct addr_filters *filts, struct addr_filter *filt) |
static void | addr_filters__del (struct addr_filters *filts, struct addr_filter *filt) |
void | addr_filters__init (struct addr_filters *filts) |
void | addr_filters__exit (struct addr_filters *filts) |
static int | parse_num_or_str (char **inp, u64 *num, const char **str, const char *str_delim) |
static int | parse_action (struct addr_filter *filt) |
static int | parse_sym_idx (char **inp, int *idx) |
static int | parse_addr_size (char **inp, u64 *num, const char **str, int *idx) |
static int | parse_one_filter (struct addr_filter *filt, const char **filter_inp) |
int | addr_filters__parse_bare_filter (struct addr_filters *filts, const char *filter) |
static bool | kern_sym_match (struct sym_args *args, const char *name, char type) |
static int | find_kern_sym_cb (void *arg, const char *name, char type, u64 start) |
static int | print_kern_sym_cb (void *arg, const char *name, char type, u64 start) |
static int | sym_not_found_error (const char *sym_name, int idx) |
static int | find_kern_sym (const char *sym_name, u64 *start, u64 *size, int idx) |
static int | find_entire_kern_cb (void *arg, const char *name __maybe_unused, char type, u64 start) |
static int | addr_filter__entire_kernel (struct addr_filter *filt) |
static int | check_end_after_start (struct addr_filter *filt, u64 start, u64 size) |
static int | addr_filter__resolve_kernel_syms (struct addr_filter *filt) |
static struct dso * | load_dso (const char *name) |
static bool | dso_sym_match (struct symbol *sym, const char *name, int *cnt, int idx) |
static void | print_duplicate_syms (struct dso *dso, const char *sym_name) |
static int | find_dso_sym (struct dso *dso, const char *sym_name, u64 *start, u64 *size, int idx) |
static int | addr_filter__entire_dso (struct addr_filter *filt, struct dso *dso) |
static int | addr_filter__resolve_syms (struct addr_filter *filt) |
static char * | addr_filter__to_str (struct addr_filter *filt) |
static int | parse_addr_filter (struct perf_evsel *evsel, const char *filter, int max_nr) |
static struct perf_pmu * | perf_evsel__find_pmu (struct perf_evsel *evsel) |
static int | perf_evsel__nr_addr_filter (struct perf_evsel *evsel) |
int | auxtrace_parse_filters (struct perf_evlist *evlist) |
Variables | |
static const char *const | auxtrace_error_type_name [] |
#define AUXTRACE_INIT_NR_QUEUES 32 |
Definition at line 150 of file auxtrace.c.
#define BUFFER_LIMIT_FOR_32_BIT (32 * 1024 * 1024) |
Definition at line 272 of file auxtrace.c.
#define PERF_ITRACE_DEFAULT_CALLCHAIN_SZ 16 |
Definition at line 956 of file auxtrace.c.
#define PERF_ITRACE_DEFAULT_LAST_BRANCH_SZ 64 |
Definition at line 958 of file auxtrace.c.
#define PERF_ITRACE_DEFAULT_PERIOD 100000 |
Definition at line 955 of file auxtrace.c.
#define PERF_ITRACE_DEFAULT_PERIOD_TYPE PERF_ITRACE_PERIOD_NANOSECS |
Definition at line 954 of file auxtrace.c.
#define PERF_ITRACE_MAX_CALLCHAIN_SZ 1024 |
Definition at line 957 of file auxtrace.c.
#define PERF_ITRACE_MAX_LAST_BRANCH_SZ 1024 |
Definition at line 959 of file auxtrace.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 2042 of file auxtrace.c.
|
static |
Definition at line 1465 of file auxtrace.c.
|
static |
Definition at line 1472 of file auxtrace.c.
void addr_filters__exit | ( | struct addr_filters * | filts | ) |
void addr_filters__init | ( | struct addr_filters * | filts | ) |
Definition at line 1479 of file auxtrace.c.
int addr_filters__parse_bare_filter | ( | struct addr_filters * | filts, |
const char * | filter | ||
) |
|
static |
Definition at line 63 of file auxtrace.c.
|
static |
Definition at line 152 of file auxtrace.c.
void auxtrace_buffer__drop_data | ( | struct auxtrace_buffer * | buffer | ) |
void auxtrace_buffer__free | ( | struct auxtrace_buffer * | buffer | ) |
void* auxtrace_buffer__get_data | ( | struct auxtrace_buffer * | buffer, |
int | fd | ||
) |
Definition at line 804 of file auxtrace.c.
struct auxtrace_buffer* auxtrace_buffer__next | ( | struct auxtrace_queue * | queue, |
struct auxtrace_buffer * | buffer | ||
) |
Definition at line 788 of file auxtrace.c.
void auxtrace_buffer__put_data | ( | struct auxtrace_buffer * | buffer | ) |
Definition at line 826 of file auxtrace.c.
int auxtrace_cache__add | ( | struct auxtrace_cache * | c, |
u32 | key, | ||
struct auxtrace_cache_entry * | entry | ||
) |
void* auxtrace_cache__alloc_entry | ( | struct auxtrace_cache * | c | ) |
|
static |
void auxtrace_cache__free | ( | struct auxtrace_cache * | c | ) |
void auxtrace_cache__free_entry | ( | struct auxtrace_cache *c | __maybe_unused, |
void * | entry | ||
) |
void* auxtrace_cache__lookup | ( | struct auxtrace_cache * | c, |
u32 | key | ||
) |
struct auxtrace_cache* auxtrace_cache__new | ( | unsigned int | bits, |
size_t | entry_size, | ||
unsigned int | limit_percent | ||
) |
|
static |
|
static |
Definition at line 1137 of file auxtrace.c.
int auxtrace_heap__add | ( | struct auxtrace_heap * | heap, |
unsigned int | queue_nr, | ||
u64 | ordinal | ||
) |
void auxtrace_heap__free | ( | struct auxtrace_heap * | heap | ) |
Definition at line 463 of file auxtrace.c.
void auxtrace_heap__pop | ( | struct auxtrace_heap * | heap | ) |
|
static |
Definition at line 423 of file auxtrace.c.
|
static |
int auxtrace_index__auxtrace_event | ( | struct list_head * | head, |
union perf_event * | event, | ||
off_t | file_offset | ||
) |
|
static |
void auxtrace_index__free | ( | struct list_head * | head | ) |
|
static |
int auxtrace_index__process | ( | int fd | , |
u64 size | , | ||
struct perf_session * | session, | ||
bool | needs_swap | ||
) |
|
static |
int auxtrace_index__write | ( | int fd | , |
struct list_head * | head | ||
) |
int auxtrace_mmap__mmap | ( | struct auxtrace_mmap * | mm, |
struct auxtrace_mmap_params * | mp, | ||
void * | userpg, | ||
int | fd | ||
) |
Definition at line 69 of file auxtrace.c.
void auxtrace_mmap__munmap | ( | struct auxtrace_mmap * | mm | ) |
Definition at line 108 of file auxtrace.c.
int auxtrace_mmap__read | ( | struct auxtrace_mmap * | mm, |
struct auxtrace_record * | itr, | ||
struct perf_tool * | tool, | ||
process_auxtrace_t | fn | ||
) |
int auxtrace_mmap__read_snapshot | ( | struct auxtrace_mmap * | mm, |
struct auxtrace_record * | itr, | ||
struct perf_tool * | tool, | ||
process_auxtrace_t | fn, | ||
size_t | snapshot_size | ||
) |
void auxtrace_mmap_params__init | ( | struct auxtrace_mmap_params * | mp, |
off_t | auxtrace_offset, | ||
unsigned int | auxtrace_pages, | ||
bool | auxtrace_overwrite | ||
) |
Definition at line 116 of file auxtrace.c.
void auxtrace_mmap_params__set_idx | ( | struct auxtrace_mmap_params * | mp, |
struct perf_evlist * | evlist, | ||
int | idx, | ||
bool | per_cpu | ||
) |
|
static |
Definition at line 516 of file auxtrace.c.
int auxtrace_parse_filters | ( | struct perf_evlist * | evlist | ) |
int auxtrace_parse_snapshot_options | ( | struct auxtrace_record * | itr, |
struct record_opts * | opts, | ||
const char * | str | ||
) |
Definition at line 577 of file auxtrace.c.
|
static |
int auxtrace_queues__add_event | ( | struct auxtrace_queues * | queues, |
struct perf_session * | session, | ||
union perf_event * | event, | ||
off_t | data_offset, | ||
struct auxtrace_buffer ** | buffer_ptr | ||
) |
|
static |
void auxtrace_queues__free | ( | struct auxtrace_queues * | queues | ) |
|
static |
int auxtrace_queues__init | ( | struct auxtrace_queues * | queues | ) |
int auxtrace_queues__process_index | ( | struct auxtrace_queues * | queues, |
struct perf_session * | session | ||
) |
|
static |
|
static |
|
static |
int auxtrace_record__find_snapshot | ( | struct auxtrace_record * | itr, |
int | idx, | ||
struct auxtrace_mmap * | mm, | ||
unsigned char * | data, | ||
u64 * | head, | ||
u64 * | old | ||
) |
Definition at line 552 of file auxtrace.c.
void auxtrace_record__free | ( | struct auxtrace_record * | itr | ) |
Definition at line 532 of file auxtrace.c.
int auxtrace_record__info_fill | ( | struct auxtrace_record * | itr, |
struct perf_session * | session, | ||
struct auxtrace_info_event * | auxtrace_info, | ||
size_t | priv_size | ||
) |
size_t auxtrace_record__info_priv_size | ( | struct auxtrace_record * | itr, |
struct perf_evlist * | evlist | ||
) |
Definition at line 508 of file auxtrace.c.
struct auxtrace_record* __weak auxtrace_record__init | ( | struct perf_evlist *evlist | __maybe_unused, |
int * | err | ||
) |
Definition at line 591 of file auxtrace.c.
int auxtrace_record__options | ( | struct auxtrace_record * | itr, |
struct perf_evlist * | evlist, | ||
struct record_opts * | opts | ||
) |
Definition at line 561 of file auxtrace.c.
u64 auxtrace_record__reference | ( | struct auxtrace_record * | itr | ) |
Definition at line 570 of file auxtrace.c.
int auxtrace_record__snapshot_finish | ( | struct auxtrace_record * | itr | ) |
Definition at line 545 of file auxtrace.c.
int auxtrace_record__snapshot_start | ( | struct auxtrace_record * | itr | ) |
Definition at line 538 of file auxtrace.c.
void auxtrace_synth_error | ( | struct auxtrace_error_event * | auxtrace_error, |
int | type, | ||
int | code, | ||
int | cpu, | ||
pid_t | pid, | ||
pid_t | tid, | ||
u64 | ip, | ||
const char * | msg | ||
) |
|
static |
Definition at line 1817 of file auxtrace.c.
|
static |
void events_stats__auxtrace_error_warn | ( | const struct events_stats * | stats | ) |
|
static |
Definition at line 305 of file auxtrace.c.
|
static |
|
static |
Definition at line 1782 of file auxtrace.c.
|
static |
|
static |
int itrace_parse_synth_opts | ( | const struct option * | opt, |
const char * | str, | ||
int | unset | ||
) |
void itrace_synth_opts__set_default | ( | struct itrace_synth_opts * | synth_opts | ) |
Definition at line 961 of file auxtrace.c.
|
static |
Definition at line 1679 of file auxtrace.c.
|
static |
|
static |
Definition at line 1531 of file auxtrace.c.
|
static |
|
static |
|
static |
Definition at line 1495 of file auxtrace.c.
|
static |
|
static |
Definition at line 1550 of file auxtrace.c.
size_t perf_event__fprintf_auxtrace_error | ( | union perf_event * | event, |
FILE * | fp | ||
) |
s64 perf_event__process_auxtrace | ( | struct perf_tool * | tool, |
union perf_event * | event, | ||
struct perf_session * | session | ||
) |
int perf_event__process_auxtrace_error | ( | struct perf_tool *tool | __maybe_unused, |
union perf_event * | event, | ||
struct perf_session * | session | ||
) |
int perf_event__process_auxtrace_info | ( | struct perf_tool *tool | __maybe_unused, |
union perf_event * | event, | ||
struct perf_session * | session | ||
) |
int perf_event__synthesize_auxtrace_info | ( | struct auxtrace_record * | itr, |
struct perf_tool * | tool, | ||
struct perf_session * | session, | ||
perf_event__handler_t | process | ||
) |
|
static |
|
static |
void perf_session__auxtrace_error_inc | ( | struct perf_session * | session, |
union perf_event * | event | ||
) |
Definition at line 1160 of file auxtrace.c.
|
static |
|
static |
|
static |
Definition at line 1727 of file auxtrace.c.
|
static |
Definition at line 1133 of file auxtrace.c.