xref: /linux/tools/perf/util/evsel_config.h (revision ec714e371f22f716a04e6ecb2a24988c92b26911)
1 // SPDX-License-Identifier: GPL-2.0
2 #ifndef __PERF_EVSEL_CONFIG_H
3 #define __PERF_EVSEL_CONFIG_H 1
4 
5 #include <linux/types.h>
6 #include <stdbool.h>
7 
8 /*
9  * The 'struct evsel_config_term' is used to pass event
10  * specific configuration data to evsel__config routine.
11  * It is allocated within event parsing and attached to
12  * evsel::config_terms list head.
13 */
14 enum evsel_term_type {
15 	EVSEL__CONFIG_TERM_PERIOD,
16 	EVSEL__CONFIG_TERM_FREQ,
17 	EVSEL__CONFIG_TERM_TIME,
18 	EVSEL__CONFIG_TERM_CALLGRAPH,
19 	EVSEL__CONFIG_TERM_STACK_USER,
20 	EVSEL__CONFIG_TERM_INHERIT,
21 	EVSEL__CONFIG_TERM_MAX_STACK,
22 	EVSEL__CONFIG_TERM_MAX_EVENTS,
23 	EVSEL__CONFIG_TERM_OVERWRITE,
24 	EVSEL__CONFIG_TERM_DRV_CFG,
25 	EVSEL__CONFIG_TERM_BRANCH,
26 	EVSEL__CONFIG_TERM_PERCORE,
27 	EVSEL__CONFIG_TERM_AUX_OUTPUT,
28 	EVSEL__CONFIG_TERM_AUX_ACTION,
29 	EVSEL__CONFIG_TERM_AUX_SAMPLE_SIZE,
30 	EVSEL__CONFIG_TERM_CFG_CHG,
31 	EVSEL__CONFIG_TERM_RATIO_TO_PREV,
32 };
33 
34 struct evsel_config_term {
35 	struct list_head      list;
36 	enum evsel_term_type  type;
37 	bool		      free_str;
38 	union {
39 		u64	      period;
40 		u64	      freq;
41 		bool	      time;
42 		u64	      stack_user;
43 		int	      max_stack;
44 		bool	      inherit;
45 		bool	      overwrite;
46 		unsigned long max_events;
47 		bool	      percore;
48 		bool	      aux_output;
49 		u32	      aux_sample_size;
50 		u64	      cfg_chg;
51 		char	      *str;
52 		int	      cpu;
53 	} val;
54 	bool weak;
55 };
56 
57 struct evsel;
58 
59 struct evsel_config_term *__evsel__get_config_term(struct evsel *evsel, enum evsel_term_type type);
60 
61 #define evsel__get_config_term(evsel, type) \
62 	__evsel__get_config_term(evsel, EVSEL__CONFIG_TERM_ ## type)
63 
64 #endif // __PERF_EVSEL_CONFIG_H
65