John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 1 | #ifndef __PERF_PARSE_EVENTS_H |
| 2 | #define __PERF_PARSE_EVENTS_H |
Ingo Molnar | 5242519 | 2009-05-26 09:17:18 +0200 | [diff] [blame] | 3 | /* |
| 4 | * Parse symbolic events/counts passed in as options: |
| 5 | */ |
| 6 | |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 7 | #include <linux/list.h> |
Robert Richter | c651214 | 2012-04-05 18:26:25 +0200 | [diff] [blame] | 8 | #include <stdbool.h> |
Jiri Olsa | f50246e | 2012-05-21 09:12:49 +0200 | [diff] [blame] | 9 | #include "types.h" |
David Howells | d2709c7 | 2012-11-19 22:21:03 +0000 | [diff] [blame] | 10 | #include <linux/perf_event.h> |
Robert Richter | c651214 | 2012-04-05 18:26:25 +0200 | [diff] [blame] | 11 | #include "types.h" |
Arnaldo Carvalho de Melo | 69aad6f | 2011-01-03 16:39:04 -0200 | [diff] [blame] | 12 | |
| 13 | struct list_head; |
| 14 | struct perf_evsel; |
Jiri Olsa | f120f9d | 2011-07-14 11:25:32 +0200 | [diff] [blame] | 15 | struct perf_evlist; |
Arnaldo Carvalho de Melo | 69aad6f | 2011-01-03 16:39:04 -0200 | [diff] [blame] | 16 | |
Jason Baron | 5beeded | 2009-07-21 14:16:29 -0400 | [diff] [blame] | 17 | struct option; |
| 18 | |
Frederic Weisbecker | 1ef2ed1 | 2009-08-28 03:09:58 +0200 | [diff] [blame] | 19 | struct tracepoint_path { |
| 20 | char *system; |
| 21 | char *name; |
| 22 | struct tracepoint_path *next; |
| 23 | }; |
| 24 | |
| 25 | extern struct tracepoint_path *tracepoint_id_to_path(u64 config); |
Arnaldo Carvalho de Melo | 5c7a668 | 2011-01-22 19:12:38 -0200 | [diff] [blame] | 26 | extern bool have_tracepoints(struct list_head *evlist); |
Frederic Weisbecker | 1ef2ed1 | 2009-08-28 03:09:58 +0200 | [diff] [blame] | 27 | |
David Ahern | 1424dc9 | 2011-03-09 22:23:28 -0700 | [diff] [blame] | 28 | const char *event_type(int type); |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 29 | |
Jiri Olsa | f120f9d | 2011-07-14 11:25:32 +0200 | [diff] [blame] | 30 | extern int parse_events_option(const struct option *opt, const char *str, |
| 31 | int unset); |
Jiri Olsa | d8f7bbc | 2013-01-15 14:39:51 +0100 | [diff] [blame] | 32 | extern int parse_events(struct perf_evlist *evlist, const char *str); |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 33 | extern int parse_events_terms(struct list_head *terms, const char *str); |
Li Zefan | c171b55 | 2009-10-15 11:22:07 +0800 | [diff] [blame] | 34 | extern int parse_filter(const struct option *opt, const char *str, int unset); |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 35 | |
| 36 | #define EVENTS_HELP_MAX (128*1024) |
| 37 | |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 38 | enum { |
Jiri Olsa | 16fa7e8 | 2012-04-25 18:24:57 +0200 | [diff] [blame] | 39 | PARSE_EVENTS__TERM_TYPE_NUM, |
| 40 | PARSE_EVENTS__TERM_TYPE_STR, |
| 41 | }; |
| 42 | |
| 43 | enum { |
| 44 | PARSE_EVENTS__TERM_TYPE_USER, |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 45 | PARSE_EVENTS__TERM_TYPE_CONFIG, |
| 46 | PARSE_EVENTS__TERM_TYPE_CONFIG1, |
| 47 | PARSE_EVENTS__TERM_TYPE_CONFIG2, |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 48 | PARSE_EVENTS__TERM_TYPE_NAME, |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 49 | PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD, |
| 50 | PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE, |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 51 | }; |
| 52 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 53 | struct parse_events_term { |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 54 | char *config; |
| 55 | union { |
| 56 | char *str; |
Robert Richter | b527bab | 2012-08-07 19:43:13 +0200 | [diff] [blame] | 57 | u64 num; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 58 | } val; |
Jiri Olsa | 16fa7e8 | 2012-04-25 18:24:57 +0200 | [diff] [blame] | 59 | int type_val; |
| 60 | int type_term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 61 | struct list_head list; |
| 62 | }; |
| 63 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame^] | 64 | struct parse_events_evlist { |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 65 | struct list_head list; |
| 66 | int idx; |
| 67 | }; |
| 68 | |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame^] | 69 | struct parse_events_terms { |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 70 | struct list_head *terms; |
| 71 | }; |
| 72 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 73 | int parse_events__is_hardcoded_term(struct parse_events_term *term); |
| 74 | int parse_events_term__num(struct parse_events_term **_term, |
Robert Richter | b527bab | 2012-08-07 19:43:13 +0200 | [diff] [blame] | 75 | int type_term, char *config, u64 num); |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 76 | int parse_events_term__str(struct parse_events_term **_term, |
Jiri Olsa | 16fa7e8 | 2012-04-25 18:24:57 +0200 | [diff] [blame] | 77 | int type_term, char *config, char *str); |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 78 | int parse_events_term__sym_hw(struct parse_events_term **term, |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 79 | char *config, unsigned idx); |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 80 | int parse_events_term__clone(struct parse_events_term **new, |
| 81 | struct parse_events_term *term); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 82 | void parse_events__free_terms(struct list_head *terms); |
Jiri Olsa | f5b1135 | 2012-08-08 12:21:54 +0200 | [diff] [blame] | 83 | int parse_events__modifier_event(struct list_head *list, char *str, bool add); |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 84 | int parse_events__modifier_group(struct list_head *list, char *event_mod); |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 85 | int parse_events_name(struct list_head *list, char *name); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 86 | int parse_events_add_tracepoint(struct list_head **list, int *idx, |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 87 | char *sys, char *event); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 88 | int parse_events_add_numeric(struct list_head **list, int *idx, |
Robert Richter | b527bab | 2012-08-07 19:43:13 +0200 | [diff] [blame] | 89 | u32 type, u64 config, |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 90 | struct list_head *head_config); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 91 | int parse_events_add_cache(struct list_head **list, int *idx, |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 92 | char *type, char *op_result1, char *op_result2); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 93 | int parse_events_add_breakpoint(struct list_head **list, int *idx, |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 94 | void *ptr, char *type); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 95 | int parse_events_add_pmu(struct list_head **list, int *idx, |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 96 | char *pmu , struct list_head *head_config); |
Arnaldo Carvalho de Melo | 63dab22 | 2012-08-14 16:35:48 -0300 | [diff] [blame] | 97 | void parse_events__set_leader(char *name, struct list_head *list); |
Jiri Olsa | 5d7be90 | 2012-03-20 19:15:40 +0100 | [diff] [blame] | 98 | void parse_events_update_lists(struct list_head *list_event, |
| 99 | struct list_head *list_all); |
Zheng Yan | ac20de6f | 2012-06-15 14:31:39 +0800 | [diff] [blame] | 100 | void parse_events_error(void *data, void *scanner, char const *msg); |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 101 | |
Frederic Weisbecker | a3277d2 | 2012-08-09 16:31:52 +0200 | [diff] [blame] | 102 | void print_events(const char *event_glob, bool name_only); |
Arnaldo Carvalho de Melo | 668b878 | 2011-02-17 15:38:58 -0200 | [diff] [blame] | 103 | void print_events_type(u8 type); |
Frederic Weisbecker | a3277d2 | 2012-08-09 16:31:52 +0200 | [diff] [blame] | 104 | void print_tracepoint_events(const char *subsys_glob, const char *event_glob, |
| 105 | bool name_only); |
| 106 | int print_hwcache_events(const char *event_glob, bool name_only); |
Thomas Renninger | 20c457b | 2011-01-03 17:50:45 +0100 | [diff] [blame] | 107 | extern int is_valid_tracepoint(const char *event_string); |
Ingo Molnar | 8ad8db3 | 2009-05-26 11:10:09 +0200 | [diff] [blame] | 108 | |
Jason Baron | 5beeded | 2009-07-21 14:16:29 -0400 | [diff] [blame] | 109 | extern int valid_debugfs_mount(const char *debugfs); |
| 110 | |
John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 111 | #endif /* __PERF_PARSE_EVENTS_H */ |