blob: 7c5244fa08855832d8ffd88e729015e75e37690d [file] [log] [blame]
John Kacur8b40f522009-09-24 18:02:18 +02001#ifndef __PERF_PARSE_EVENTS_H
2#define __PERF_PARSE_EVENTS_H
Ingo Molnar52425192009-05-26 09:17:18 +02003/*
4 * Parse symbolic events/counts passed in as options:
5 */
6
Jiri Olsaf50246e2012-05-21 09:12:49 +02007#include <linux/list.h>
Robert Richterc6512142012-04-05 18:26:25 +02008#include <stdbool.h>
Jiri Olsaf50246e2012-05-21 09:12:49 +02009#include "types.h"
David Howellsd2709c72012-11-19 22:21:03 +000010#include <linux/perf_event.h>
Robert Richterc6512142012-04-05 18:26:25 +020011#include "types.h"
Arnaldo Carvalho de Melo69aad6f2011-01-03 16:39:04 -020012
13struct list_head;
14struct perf_evsel;
Jiri Olsaf120f9d2011-07-14 11:25:32 +020015struct perf_evlist;
Arnaldo Carvalho de Melo69aad6f2011-01-03 16:39:04 -020016
Jason Baron5beeded2009-07-21 14:16:29 -040017struct option;
18
Frederic Weisbecker1ef2ed12009-08-28 03:09:58 +020019struct tracepoint_path {
20 char *system;
21 char *name;
22 struct tracepoint_path *next;
23};
24
25extern struct tracepoint_path *tracepoint_id_to_path(u64 config);
Arnaldo Carvalho de Melo5c7a6682011-01-22 19:12:38 -020026extern bool have_tracepoints(struct list_head *evlist);
Frederic Weisbecker1ef2ed12009-08-28 03:09:58 +020027
David Ahern1424dc92011-03-09 22:23:28 -070028const char *event_type(int type);
Ingo Molnar8ad8db32009-05-26 11:10:09 +020029
Jiri Olsaf120f9d2011-07-14 11:25:32 +020030extern int parse_events_option(const struct option *opt, const char *str,
31 int unset);
Jiri Olsad8f7bbc2013-01-15 14:39:51 +010032extern int parse_events(struct perf_evlist *evlist, const char *str);
Jiri Olsa90e2b222012-06-15 14:31:40 +080033extern int parse_events_terms(struct list_head *terms, const char *str);
Li Zefanc171b552009-10-15 11:22:07 +080034extern int parse_filter(const struct option *opt, const char *str, int unset);
Ingo Molnar8ad8db32009-05-26 11:10:09 +020035
36#define EVENTS_HELP_MAX (128*1024)
37
Jiri Olsa8f707d82012-03-15 20:09:16 +010038enum {
Jiri Olsa16fa7e82012-04-25 18:24:57 +020039 PARSE_EVENTS__TERM_TYPE_NUM,
40 PARSE_EVENTS__TERM_TYPE_STR,
41};
42
43enum {
44 PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsa8f707d82012-03-15 20:09:16 +010045 PARSE_EVENTS__TERM_TYPE_CONFIG,
46 PARSE_EVENTS__TERM_TYPE_CONFIG1,
47 PARSE_EVENTS__TERM_TYPE_CONFIG2,
Jiri Olsa6b5fc392012-05-21 09:12:53 +020048 PARSE_EVENTS__TERM_TYPE_NAME,
Jiri Olsa8f707d82012-03-15 20:09:16 +010049 PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD,
50 PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
Jiri Olsa8f707d82012-03-15 20:09:16 +010051};
52
53struct parse_events__term {
54 char *config;
55 union {
56 char *str;
Robert Richterb527bab2012-08-07 19:43:13 +020057 u64 num;
Jiri Olsa8f707d82012-03-15 20:09:16 +010058 } val;
Jiri Olsa16fa7e82012-04-25 18:24:57 +020059 int type_val;
60 int type_term;
Jiri Olsa8f707d82012-03-15 20:09:16 +010061 struct list_head list;
62};
63
Jiri Olsa46010ab2012-06-15 14:31:38 +080064struct parse_events_data__events {
65 struct list_head list;
66 int idx;
67};
68
Jiri Olsa90e2b222012-06-15 14:31:40 +080069struct parse_events_data__terms {
70 struct list_head *terms;
71};
72
Jiri Olsa8f707d82012-03-15 20:09:16 +010073int parse_events__is_hardcoded_term(struct parse_events__term *term);
Jiri Olsa16fa7e82012-04-25 18:24:57 +020074int parse_events__term_num(struct parse_events__term **_term,
Robert Richterb527bab2012-08-07 19:43:13 +020075 int type_term, char *config, u64 num);
Jiri Olsa16fa7e82012-04-25 18:24:57 +020076int parse_events__term_str(struct parse_events__term **_term,
77 int type_term, char *config, char *str);
Jiri Olsa1d33d6d2012-10-10 14:53:17 +020078int parse_events__term_sym_hw(struct parse_events__term **term,
79 char *config, unsigned idx);
Zheng Yana6146d52012-06-15 14:31:41 +080080int parse_events__term_clone(struct parse_events__term **new,
81 struct parse_events__term *term);
Jiri Olsa8f707d82012-03-15 20:09:16 +010082void parse_events__free_terms(struct list_head *terms);
Jiri Olsaf5b11352012-08-08 12:21:54 +020083int parse_events__modifier_event(struct list_head *list, char *str, bool add);
Jiri Olsa89efb022012-08-08 12:14:14 +020084int parse_events__modifier_group(struct list_head *list, char *event_mod);
Robert Richterac2ba9f2012-08-16 21:10:21 +020085int parse_events_name(struct list_head *list, char *name);
Jiri Olsab847cbd2012-05-21 09:12:51 +020086int parse_events_add_tracepoint(struct list_head **list, int *idx,
Jiri Olsa89812fc2012-03-15 20:09:15 +010087 char *sys, char *event);
Jiri Olsab847cbd2012-05-21 09:12:51 +020088int parse_events_add_numeric(struct list_head **list, int *idx,
Robert Richterb527bab2012-08-07 19:43:13 +020089 u32 type, u64 config,
Jiri Olsa8f707d82012-03-15 20:09:16 +010090 struct list_head *head_config);
Jiri Olsab847cbd2012-05-21 09:12:51 +020091int parse_events_add_cache(struct list_head **list, int *idx,
Jiri Olsa89812fc2012-03-15 20:09:15 +010092 char *type, char *op_result1, char *op_result2);
Jiri Olsab847cbd2012-05-21 09:12:51 +020093int parse_events_add_breakpoint(struct list_head **list, int *idx,
Jiri Olsa89812fc2012-03-15 20:09:15 +010094 void *ptr, char *type);
Jiri Olsab847cbd2012-05-21 09:12:51 +020095int parse_events_add_pmu(struct list_head **list, int *idx,
Jiri Olsa5f537a22012-03-15 20:09:18 +010096 char *pmu , struct list_head *head_config);
Arnaldo Carvalho de Melo63dab222012-08-14 16:35:48 -030097void parse_events__set_leader(char *name, struct list_head *list);
Jiri Olsa5d7be902012-03-20 19:15:40 +010098void parse_events_update_lists(struct list_head *list_event,
99 struct list_head *list_all);
Zheng Yanac20de6f2012-06-15 14:31:39 +0800100void parse_events_error(void *data, void *scanner, char const *msg);
Jiri Olsa89812fc2012-03-15 20:09:15 +0100101
Frederic Weisbeckera3277d22012-08-09 16:31:52 +0200102void print_events(const char *event_glob, bool name_only);
Arnaldo Carvalho de Melo668b8782011-02-17 15:38:58 -0200103void print_events_type(u8 type);
Frederic Weisbeckera3277d22012-08-09 16:31:52 +0200104void print_tracepoint_events(const char *subsys_glob, const char *event_glob,
105 bool name_only);
106int print_hwcache_events(const char *event_glob, bool name_only);
Thomas Renninger20c457b2011-01-03 17:50:45 +0100107extern int is_valid_tracepoint(const char *event_string);
Ingo Molnar8ad8db32009-05-26 11:10:09 +0200108
Jason Baron5beeded2009-07-21 14:16:29 -0400109extern int valid_debugfs_mount(const char *debugfs);
110
John Kacur8b40f522009-09-24 18:02:18 +0200111#endif /* __PERF_PARSE_EVENTS_H */