Linux Perf
|
#include <linux/hw_breakpoint.h>
#include <linux/err.h>
#include <dirent.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/param.h>
#include "term.h"
#include "../perf.h"
#include "evlist.h"
#include "evsel.h"
#include <subcmd/parse-options.h>
#include "parse-events.h"
#include <subcmd/exec-cmd.h>
#include "string2.h"
#include "strlist.h"
#include "symbol.h"
#include "cache.h"
#include "header.h"
#include "bpf-loader.h"
#include "debug.h"
#include <api/fs/tracing_path.h>
#include "parse-events-bison.h"
#include "parse-events-flex.h"
#include "pmu.h"
#include "thread_map.h"
#include "cpumap.h"
#include "probe-file.h"
#include "asm/bug.h"
#include "util/parse-branch-options.h"
#include "metricgroup.h"
Go to the source code of this file.
Classes | |
struct | __add_bpf_event_param |
struct | event_modifier |
Macros | |
#define | YY_EXTRA_TYPE int |
#define | MAX_NAME_LEN 100 |
#define | __PERF_EVENT_FIELD(config, name) ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT) |
#define | PERF_EVENT_RAW(config) __PERF_EVENT_FIELD(config, RAW) |
#define | PERF_EVENT_CONFIG(config) __PERF_EVENT_FIELD(config, CONFIG) |
#define | PERF_EVENT_TYPE(config) __PERF_EVENT_FIELD(config, TYPE) |
#define | PERF_EVENT_ID(config) __PERF_EVENT_FIELD(config, EVENT) |
#define | for_each_subsystem(sys_dir, sys_dirent) |
#define | for_each_event(dir_path, evt_dir, evt_dirent) |
#define | MAX_EVENT_LENGTH 512 |
#define | CHECK_SET_TYPE(bit) |
#define | CHECK_TYPE_VAL(type) |
#define | ADD_CONFIG_TERM(__type, __name, __val) |
#define | SET_SYMBOL(str, stype) |
#define | MAX_WIDTH 1000 |
Typedefs | |
typedef int | config_term_func_t(struct perf_event_attr *attr, struct parse_events_term *term, struct parse_events_error *err) |
Functions | |
int | parse_events_parse (void *parse_state, void *scanner) |
static int | get_config_terms (struct list_head *head_config, struct list_head *head_terms __maybe_unused) |
static int | tp_event_has_id (const char *dir_path, struct dirent *evt_dir) |
struct tracepoint_path * | tracepoint_id_to_path (u64 config) |
struct tracepoint_path * | tracepoint_name_to_path (const char *name) |
const char * | event_type (int type) |
static int | parse_events__is_name_term (struct parse_events_term *term) |
static char * | get_config_name (struct list_head *head_terms) |
static struct perf_evsel * | __add_event (struct list_head *list, int *idx, struct perf_event_attr *attr, char *name, struct perf_pmu *pmu, struct list_head *config_terms, bool auto_merge_stats) |
static int | add_event (struct list_head *list, int *idx, struct perf_event_attr *attr, char *name, struct list_head *config_terms) |
static int | parse_aliases (char *str, const char *names[][PERF_EVSEL__MAX_ALIASES], int size) |
static int | config_term_common (struct perf_event_attr *attr, struct parse_events_term *term, struct parse_events_error *err) |
static int | config_attr (struct perf_event_attr *attr, struct list_head *head, struct parse_events_error *err, config_term_func_t config_term) |
int | parse_events_add_cache (struct list_head *list, int *idx, char *type, char *op_result1, char *op_result2, struct parse_events_error *err, struct list_head *head_config) |
static void | tracepoint_error (struct parse_events_error *e, int err, const char *sys, const char *name) |
static int | add_tracepoint (struct list_head *list, int *idx, const char *sys_name, const char *evt_name, struct parse_events_error *err, struct list_head *head_config) |
static int | add_tracepoint_multi_event (struct list_head *list, int *idx, const char *sys_name, const char *evt_name, struct parse_events_error *err, struct list_head *head_config) |
static int | add_tracepoint_event (struct list_head *list, int *idx, const char *sys_name, const char *evt_name, struct parse_events_error *err, struct list_head *head_config) |
static int | add_tracepoint_multi_sys (struct list_head *list, int *idx, const char *sys_name, const char *evt_name, struct parse_events_error *err, struct list_head *head_config) |
static int | add_bpf_event (const char *group, const char *event, int fd, void *_param) |
int | parse_events_load_bpf_obj (struct parse_events_state *parse_state, struct list_head *list, struct bpf_object *obj, struct list_head *head_config) |
static int | parse_events_config_bpf (struct parse_events_state *parse_state, struct bpf_object *obj, struct list_head *head_config) |
static void | split_bpf_config_terms (struct list_head *evt_head_config, struct list_head *obj_head_config) |
int | parse_events_load_bpf (struct parse_events_state *parse_state, struct list_head *list, char *bpf_file_name, bool source, struct list_head *head_config) |
static int | parse_breakpoint_type (const char *type, struct perf_event_attr *attr) |
int | parse_events_add_breakpoint (struct list_head *list, int *idx, void *ptr, char *type, u64 len) |
static int | check_type_val (struct parse_events_term *term, struct parse_events_error *err, int type) |
static bool | config_term_avail (int term_type, struct parse_events_error *err) |
void | parse_events__shrink_config_terms (void) |
static int | config_term_pmu (struct perf_event_attr *attr, struct parse_events_term *term, struct parse_events_error *err) |
static int | config_term_tracepoint (struct perf_event_attr *attr, struct parse_events_term *term, struct parse_events_error *err) |
int | parse_events_add_tracepoint (struct list_head *list, int *idx, const char *sys, const char *event, struct parse_events_error *err, struct list_head *head_config) |
int | parse_events_add_numeric (struct parse_events_state *parse_state, struct list_head *list, u32 type, u64 config, struct list_head *head_config) |
int | parse_events_add_pmu (struct parse_events_state *parse_state, struct list_head *list, char *name, struct list_head *head_config, bool auto_merge_stats, bool use_alias) |
int | parse_events_multi_pmu_add (struct parse_events_state *parse_state, char *str, struct list_head **listp) |
int | parse_events__modifier_group (struct list_head *list, char *event_mod) |
static bool | is_same_uncore_block (const char *pmu_name_a, const char *pmu_name_b) |
static int | parse_events__set_leader_for_uncore_aliase (char *name, struct list_head *list, struct parse_events_state *parse_state) |
void | parse_events__set_leader (char *name, struct list_head *list, struct parse_events_state *parse_state) |
void | parse_events_update_lists (struct list_head *list_event, struct list_head *list_all) |
static int | get_event_modifier (struct event_modifier *mod, char *str, struct perf_evsel *evsel) |
static int | check_modifier (char *str) |
int | parse_events__modifier_event (struct list_head *list, char *str, bool add) |
int | parse_events_name (struct list_head *list, char *name) |
static int | comp_pmu (const void *p1, const void *p2) |
static void | perf_pmu__parse_cleanup (void) |
static void | perf_pmu__parse_init (void) |
enum perf_pmu_event_symbol_type | perf_pmu__parse_check (const char *name) |
static int | parse_events__scanner (const char *str, void *parse_state, int start_token) |
int | parse_events_terms (struct list_head *terms, const char *str) |
int | parse_events (struct perf_evlist *evlist, const char *str, struct parse_events_error *err) |
static int | get_term_width (void) |
void | parse_events_print_error (struct parse_events_error *err, const char *event) |
int | parse_events_option (const struct option *opt, const char *str, int unset __maybe_unused) |
static int | foreach_evsel_in_last_glob (struct perf_evlist *evlist, int(*func)(struct perf_evsel *evsel, const void *arg), const void *arg) |
static int | set_filter (struct perf_evsel *evsel, const void *arg) |
int | parse_filter (const struct option *opt, const char *str, int unset __maybe_unused) |
static int | add_exclude_perf_filter (struct perf_evsel *evsel, const void *arg __maybe_unused) |
int | exclude_perf (const struct option *opt, const char *arg __maybe_unused, int unset __maybe_unused) |
static int | cmp_string (const void *a, const void *b) |
void | print_tracepoint_events (const char *subsys_glob, const char *event_glob, bool name_only) |
int | is_valid_tracepoint (const char *event_string) |
static bool | is_event_supported (u8 type, unsigned config) |
void | print_sdt_events (const char *subsys_glob, const char *event_glob, bool name_only) |
int | print_hwcache_events (const char *event_glob, bool name_only) |
void | print_symbol_events (const char *event_glob, unsigned type, struct event_symbol *syms, unsigned max, bool name_only) |
void | print_events (const char *event_glob, bool name_only, bool quiet_flag, bool long_desc, bool details_flag) |
int | parse_events__is_hardcoded_term (struct parse_events_term *term) |
static int | new_term (struct parse_events_term **_term, struct parse_events_term *temp, char *str, u64 num) |
int | parse_events_term__num (struct parse_events_term **term, int type_term, char *config, u64 num, bool no_value, void *loc_term_, void *loc_val_) |
int | parse_events_term__str (struct parse_events_term **term, int type_term, char *config, char *str, void *loc_term_, void *loc_val_) |
int | parse_events_term__sym_hw (struct parse_events_term **term, char *config, unsigned idx) |
int | parse_events_term__clone (struct parse_events_term **new, struct parse_events_term *term) |
int | parse_events_copy_term_list (struct list_head *old, struct list_head **new) |
void | parse_events_terms__purge (struct list_head *terms) |
void | parse_events_terms__delete (struct list_head *terms) |
void | parse_events__clear_array (struct parse_events_array *a) |
void | parse_events_evlist_error (struct parse_events_state *parse_state, int idx, const char *str) |
static void | config_terms_list (char *buf, size_t buf_sz) |
char * | parse_events_formats_error_string (char *additional_terms) |
Variables | |
static struct perf_pmu_event_symbol * | perf_pmu_events_list |
static int | perf_pmu_events_list_num |
struct event_symbol | event_symbols_hw [PERF_COUNT_HW_MAX] |
struct event_symbol | event_symbols_sw [PERF_COUNT_SW_MAX] |
static const char * | config_term_names [__PARSE_EVENTS__TERM_TYPE_NR] |
static bool | config_term_shrinked |
static const char *const | event_type_descriptors [] |
#define __PERF_EVENT_FIELD | ( | config, | |
name | |||
) | ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT) |
Definition at line 145 of file parse-events.c.
#define ADD_CONFIG_TERM | ( | __type, | |
__name, | |||
__val | |||
) |
#define CHECK_SET_TYPE | ( | bit | ) |
#define CHECK_TYPE_VAL | ( | type | ) |
#define for_each_event | ( | dir_path, | |
evt_dir, | |||
evt_dirent | |||
) |
Definition at line 173 of file parse-events.c.
#define for_each_subsystem | ( | sys_dir, | |
sys_dirent | |||
) |
Definition at line 153 of file parse-events.c.
#define MAX_EVENT_LENGTH 512 |
Definition at line 180 of file parse-events.c.
#define MAX_NAME_LEN 100 |
Definition at line 37 of file parse-events.c.
#define MAX_WIDTH 1000 |
Definition at line 1870 of file parse-events.c.
#define PERF_EVENT_CONFIG | ( | config | ) | __PERF_EVENT_FIELD(config, CONFIG) |
Definition at line 149 of file parse-events.c.
#define PERF_EVENT_ID | ( | config | ) | __PERF_EVENT_FIELD(config, EVENT) |
Definition at line 151 of file parse-events.c.
#define PERF_EVENT_RAW | ( | config | ) | __PERF_EVENT_FIELD(config, RAW) |
Definition at line 148 of file parse-events.c.
#define PERF_EVENT_TYPE | ( | config | ) | __PERF_EVENT_FIELD(config, TYPE) |
Definition at line 150 of file parse-events.c.
#define SET_SYMBOL | ( | str, | |
stype | |||
) |
Definition at line 1701 of file parse-events.c.
#define YY_EXTRA_TYPE int |
Definition at line 27 of file parse-events.c.
typedef int config_term_func_t(struct perf_event_attr *attr, struct parse_events_term *term, struct parse_events_error *err) |
Definition at line 372 of file parse-events.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 894 of file parse-events.c.
|
static |
Definition at line 2085 of file parse-events.c.
|
static |
Definition at line 1678 of file parse-events.c.
|
static |
|
static |
Definition at line 937 of file parse-events.c.
|
static |
|
static |
|
static |
|
static |
const char* event_type | ( | int | type | ) |
Definition at line 275 of file parse-events.c.
int exclude_perf | ( | const struct option * | opt, |
const char *arg | __maybe_unused, | ||
int unset | __maybe_unused | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 1362 of file parse-events.c.
int is_valid_tracepoint | ( | const char * | event_string | ) |
Definition at line 2196 of file parse-events.c.
|
static |
|
static |
Definition at line 354 of file parse-events.c.
|
static |
Definition at line 828 of file parse-events.c.
int parse_events | ( | struct perf_evlist * | evlist, |
const char * | str, | ||
struct parse_events_error * | err | ||
) |
void parse_events__clear_array | ( | struct parse_events_array * | a | ) |
Definition at line 2686 of file parse-events.c.
int parse_events__is_hardcoded_term | ( | struct parse_events_term * | term | ) |
Definition at line 2538 of file parse-events.c.
|
static |
Definition at line 297 of file parse-events.c.
int parse_events__modifier_event | ( | struct list_head * | list, |
char * | str, | ||
bool | add | ||
) |
int parse_events__modifier_group | ( | struct list_head * | list, |
char * | event_mod | ||
) |
|
static |
void parse_events__set_leader | ( | char * | name, |
struct list_head * | list, | ||
struct parse_events_state * | parse_state | ||
) |
|
static |
void parse_events__shrink_config_terms | ( | void | ) |
Definition at line 965 of file parse-events.c.
int parse_events_add_breakpoint | ( | struct list_head * | list, |
int * | idx, | ||
void * | ptr, | ||
char * | type, | ||
u64 | len | ||
) |
int parse_events_add_cache | ( | struct list_head * | list, |
int * | idx, | ||
char * | type, | ||
char * | op_result1, | ||
char * | op_result2, | ||
struct parse_events_error * | err, | ||
struct list_head * | head_config | ||
) |
int parse_events_add_numeric | ( | struct parse_events_state * | parse_state, |
struct list_head * | list, | ||
u32 | type, | ||
u64 | config, | ||
struct list_head * | head_config | ||
) |
int parse_events_add_pmu | ( | struct parse_events_state * | parse_state, |
struct list_head * | list, | ||
char * | name, | ||
struct list_head * | head_config, | ||
bool | auto_merge_stats, | ||
bool | use_alias | ||
) |
int parse_events_add_tracepoint | ( | struct list_head * | list, |
int * | idx, | ||
const char * | sys, | ||
const char * | event, | ||
struct parse_events_error * | err, | ||
struct list_head * | head_config | ||
) |
|
static |
int parse_events_copy_term_list | ( | struct list_head * | old, |
struct list_head ** | new | ||
) |
void parse_events_evlist_error | ( | struct parse_events_state * | parse_state, |
int | idx, | ||
const char * | str | ||
) |
Definition at line 2691 of file parse-events.c.
char* parse_events_formats_error_string | ( | char * | additional_terms | ) |
int parse_events_load_bpf | ( | struct parse_events_state * | parse_state, |
struct list_head * | list, | ||
char * | bpf_file_name, | ||
bool | source, | ||
struct list_head * | head_config | ||
) |
int parse_events_load_bpf_obj | ( | struct parse_events_state * | parse_state, |
struct list_head * | list, | ||
struct bpf_object * | obj, | ||
struct list_head * | head_config | ||
) |
int parse_events_multi_pmu_add | ( | struct parse_events_state * | parse_state, |
char * | str, | ||
struct list_head ** | listp | ||
) |
int parse_events_name | ( | struct list_head * | list, |
char * | name | ||
) |
Definition at line 1665 of file parse-events.c.
int parse_events_option | ( | const struct option * | opt, |
const char * | str, | ||
int unset | __maybe_unused | ||
) |
Definition at line 1939 of file parse-events.c.
int parse_events_parse | ( | void * | parse_state, |
void * | scanner | ||
) |
void parse_events_print_error | ( | struct parse_events_error * | err, |
const char * | event | ||
) |
int parse_events_term__clone | ( | struct parse_events_term ** | new, |
struct parse_events_term * | term | ||
) |
int parse_events_term__num | ( | struct parse_events_term ** | term, |
int | type_term, | ||
char * | config, | ||
u64 | num, | ||
bool | no_value, | ||
void * | loc_term_, | ||
void * | loc_val_ | ||
) |
int parse_events_term__str | ( | struct parse_events_term ** | term, |
int | type_term, | ||
char * | config, | ||
char * | str, | ||
void * | loc_term_, | ||
void * | loc_val_ | ||
) |
int parse_events_term__sym_hw | ( | struct parse_events_term ** | term, |
char * | config, | ||
unsigned | idx | ||
) |
int parse_events_terms | ( | struct list_head * | terms, |
const char * | str | ||
) |
void parse_events_terms__delete | ( | struct list_head * | terms | ) |
void parse_events_terms__purge | ( | struct list_head * | terms | ) |
void parse_events_update_lists | ( | struct list_head * | list_event, |
struct list_head * | list_all | ||
) |
int parse_filter | ( | const struct option * | opt, |
const char * | str, | ||
int unset | __maybe_unused | ||
) |
enum perf_pmu_event_symbol_type perf_pmu__parse_check | ( | const char * | name | ) |
|
static |
Definition at line 1686 of file parse-events.c.
|
static |
void print_events | ( | const char * | event_glob, |
bool | name_only, | ||
bool | quiet_flag, | ||
bool | long_desc, | ||
bool | details_flag | ||
) |
int print_hwcache_events | ( | const char * | event_glob, |
bool | name_only | ||
) |
void print_sdt_events | ( | const char * | subsys_glob, |
const char * | event_glob, | ||
bool | name_only | ||
) |
void print_symbol_events | ( | const char * | event_glob, |
unsigned | type, | ||
struct event_symbol * | syms, | ||
unsigned | max, | ||
bool | name_only | ||
) |
void print_tracepoint_events | ( | const char * | subsys_glob, |
const char * | event_glob, | ||
bool | name_only | ||
) |
|
static |
|
static |
|
static |
Definition at line 159 of file parse-events.c.
|
static |
Definition at line 457 of file parse-events.c.
struct tracepoint_path* tracepoint_id_to_path | ( | u64 | config | ) |
struct tracepoint_path* tracepoint_name_to_path | ( | const char * | name | ) |
|
static |
Definition at line 914 of file parse-events.c.
|
static |
Definition at line 934 of file parse-events.c.
struct event_symbol event_symbols_hw[PERF_COUNT_HW_MAX] |
Definition at line 55 of file parse-events.c.
struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX] |
Definition at line 98 of file parse-events.c.
|
static |
Definition at line 2076 of file parse-events.c.
|
static |
Definition at line 46 of file parse-events.c.
|
static |
Definition at line 53 of file parse-events.c.