Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef __PERF_PARSE_EVENTS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define __PERF_PARSE_EVENTS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Parse symbolic events/counts passed in as options:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <stdbool.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/perf_event.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) struct list_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) struct evsel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) struct evlist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) struct parse_events_error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) struct option;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) struct perf_pmu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) struct tracepoint_path {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	char *system;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	struct tracepoint_path *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) struct tracepoint_path *tracepoint_id_to_path(u64 config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) struct tracepoint_path *tracepoint_name_to_path(const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) bool have_tracepoints(struct list_head *evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) const char *event_type(int type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) int parse_events_option(const struct option *opt, const char *str, int unset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) int parse_events_option_new_evlist(const struct option *opt, const char *str, int unset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) int __parse_events(struct evlist *evlist, const char *str, struct parse_events_error *error,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 		   struct perf_pmu *fake_pmu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) static inline int parse_events(struct evlist *evlist, const char *str,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 			       struct parse_events_error *err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	return __parse_events(evlist, str, err, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) int parse_events_terms(struct list_head *terms, const char *str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) int parse_filter(const struct option *opt, const char *str, int unset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) int exclude_perf(const struct option *opt, const char *arg, int unset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define EVENTS_HELP_MAX (128*1024)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) enum perf_pmu_event_symbol_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	PMU_EVENT_SYMBOL_ERR,		/* not a PMU EVENT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	PMU_EVENT_SYMBOL,		/* normal style PMU event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	PMU_EVENT_SYMBOL_PREFIX,	/* prefix of pre-suf style event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	PMU_EVENT_SYMBOL_SUFFIX,	/* suffix of pre-suf style event */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) struct perf_pmu_event_symbol {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	char	*symbol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	enum perf_pmu_event_symbol_type	type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	PARSE_EVENTS__TERM_TYPE_NUM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	PARSE_EVENTS__TERM_TYPE_STR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	PARSE_EVENTS__TERM_TYPE_USER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	PARSE_EVENTS__TERM_TYPE_CONFIG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	PARSE_EVENTS__TERM_TYPE_CONFIG1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	PARSE_EVENTS__TERM_TYPE_CONFIG2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	PARSE_EVENTS__TERM_TYPE_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	PARSE_EVENTS__TERM_TYPE_SAMPLE_FREQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	PARSE_EVENTS__TERM_TYPE_TIME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	PARSE_EVENTS__TERM_TYPE_CALLGRAPH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	PARSE_EVENTS__TERM_TYPE_STACKSIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	PARSE_EVENTS__TERM_TYPE_NOINHERIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	PARSE_EVENTS__TERM_TYPE_INHERIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	PARSE_EVENTS__TERM_TYPE_MAX_STACK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	PARSE_EVENTS__TERM_TYPE_MAX_EVENTS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	PARSE_EVENTS__TERM_TYPE_NOOVERWRITE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	PARSE_EVENTS__TERM_TYPE_OVERWRITE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	PARSE_EVENTS__TERM_TYPE_DRV_CFG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	PARSE_EVENTS__TERM_TYPE_PERCORE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	__PARSE_EVENTS__TERM_TYPE_NR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) struct parse_events_array {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	size_t nr_ranges;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		unsigned int start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		size_t length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	} *ranges;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) struct parse_events_term {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	char *config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	struct parse_events_array array;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		char *str;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		u64  num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	} val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	int type_val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	int type_term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	bool used;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	bool no_value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	/* error string indexes for within parsed string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	int err_term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	int err_val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	/* Coming from implicit alias */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	bool weak;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct parse_events_error {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	int   num_errors;       /* number of errors encountered */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	int   idx;	/* index in the parsed string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	char *str;      /* string to display at the index */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	char *help;	/* optional help string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	int   first_idx;/* as above, but for the first encountered error */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	char *first_str;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	char *first_help;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) struct parse_events_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	struct list_head	   list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	int			   idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	int			   nr_groups;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	struct parse_events_error *error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	struct evlist		  *evlist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	struct list_head	  *terms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	int			   stoken;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	struct perf_pmu		  *fake_pmu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) void parse_events__handle_error(struct parse_events_error *err, int idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 				char *str, char *help);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) void parse_events__shrink_config_terms(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) int parse_events__is_hardcoded_term(struct parse_events_term *term);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) int parse_events_term__num(struct parse_events_term **term,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 			   int type_term, char *config, u64 num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 			   bool novalue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 			   void *loc_term, void *loc_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) int parse_events_term__str(struct parse_events_term **term,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 			   int type_term, char *config, char *str,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 			   void *loc_term, void *loc_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) int parse_events_term__sym_hw(struct parse_events_term **term,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 			      char *config, unsigned idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) int parse_events_term__clone(struct parse_events_term **new,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			     struct parse_events_term *term);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) void parse_events_term__delete(struct parse_events_term *term);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) void parse_events_terms__delete(struct list_head *terms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) void parse_events_terms__purge(struct list_head *terms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) void parse_events__clear_array(struct parse_events_array *a);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) int parse_events__modifier_event(struct list_head *list, char *str, bool add);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) int parse_events__modifier_group(struct list_head *list, char *event_mod);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) int parse_events_name(struct list_head *list, char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) int parse_events_add_tracepoint(struct list_head *list, int *idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 				const char *sys, const char *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 				struct parse_events_error *error,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 				struct list_head *head_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) int parse_events_load_bpf(struct parse_events_state *parse_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 			  struct list_head *list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 			  char *bpf_file_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 			  bool source,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 			  struct list_head *head_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) /* Provide this function for perf test */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) struct bpf_object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) int parse_events_load_bpf_obj(struct parse_events_state *parse_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 			      struct list_head *list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 			      struct bpf_object *obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 			      struct list_head *head_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) int parse_events_add_numeric(struct parse_events_state *parse_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 			     struct list_head *list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 			     u32 type, u64 config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 			     struct list_head *head_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) enum perf_tool_event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) int parse_events_add_tool(struct parse_events_state *parse_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 			  struct list_head *list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 			  enum perf_tool_event tool_event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) int parse_events_add_cache(struct list_head *list, int *idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 			   char *type, char *op_result1, char *op_result2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 			   struct parse_events_error *error,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 			   struct list_head *head_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) int parse_events_add_breakpoint(struct list_head *list, int *idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 				u64 addr, char *type, u64 len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) int parse_events_add_pmu(struct parse_events_state *parse_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 			 struct list_head *list, char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 			 struct list_head *head_config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 			 bool auto_merge_stats,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 			 bool use_alias);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) struct evsel *parse_events__add_event(int idx, struct perf_event_attr *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 					char *name, struct perf_pmu *pmu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) int parse_events_multi_pmu_add(struct parse_events_state *parse_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 			       char *str,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 			       struct list_head **listp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) int parse_events_copy_term_list(struct list_head *old,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 				 struct list_head **new);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) enum perf_pmu_event_symbol_type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) perf_pmu__parse_check(const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) void parse_events__set_leader(char *name, struct list_head *list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 			      struct parse_events_state *parse_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) void parse_events_update_lists(struct list_head *list_event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 			       struct list_head *list_all);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) void parse_events_evlist_error(struct parse_events_state *parse_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 			       int idx, const char *str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) void print_events(const char *event_glob, bool name_only, bool quiet,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		  bool long_desc, bool details_flag, bool deprecated);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) struct event_symbol {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	const char	*symbol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	const char	*alias;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) extern struct event_symbol event_symbols_hw[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) extern struct event_symbol event_symbols_sw[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) void print_symbol_events(const char *event_glob, unsigned type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 				struct event_symbol *syms, unsigned max,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 				bool name_only);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) void print_tool_events(const char *event_glob, bool name_only);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) void print_tracepoint_events(const char *subsys_glob, const char *event_glob,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 			     bool name_only);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) int print_hwcache_events(const char *event_glob, bool name_only);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) void print_sdt_events(const char *subsys_glob, const char *event_glob,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		      bool name_only);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) int is_valid_tracepoint(const char *event_string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) int valid_event_mount(const char *eventfs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) char *parse_events_formats_error_string(char *additional_terms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) void parse_events_print_error(struct parse_events_error *err,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 			      const char *event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) #ifdef HAVE_LIBELF_SUPPORT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)  * If the probe point starts with '%',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)  * or starts with "sdt_" and has a ':' but no '=',
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)  * then it should be a SDT/cached probe point.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) static inline bool is_sdt_event(char *str)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	return (str[0] == '%' ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		(!strncmp(str, "sdt_", 4) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		 !!strchr(str, ':') && !strchr(str, '=')));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) static inline bool is_sdt_event(char *str __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) #endif /* HAVE_LIBELF_SUPPORT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) int perf_pmu__test_parse_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) #endif /* __PERF_PARSE_EVENTS_H */