blob: 839230ceb18bd918b194d0fc719607445ad7bb00 [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"
Ingo Molnar7d380c82012-10-14 10:40:57 +020010#include "../../../include/uapi/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);
32extern int parse_events(struct perf_evlist *evlist, const char *str,
33 int unset);
Jiri Olsa90e2b222012-06-15 14:31:40 +080034extern int parse_events_terms(struct list_head *terms, const char *str);
Li Zefanc171b552009-10-15 11:22:07 +080035extern int parse_filter(const struct option *opt, const char *str, int unset);
Ingo Molnar8ad8db32009-05-26 11:10:09 +020036
37#define EVENTS_HELP_MAX (128*1024)
38
Jiri Olsa8f707d82012-03-15 20:09:16 +010039enum {
Jiri Olsa16fa7e82012-04-25 18:24:57 +020040 PARSE_EVENTS__TERM_TYPE_NUM,
41 PARSE_EVENTS__TERM_TYPE_STR,
42};
43
44enum {
45 PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsa8f707d82012-03-15 20:09:16 +010046 PARSE_EVENTS__TERM_TYPE_CONFIG,
47 PARSE_EVENTS__TERM_TYPE_CONFIG1,
48 PARSE_EVENTS__TERM_TYPE_CONFIG2,
Jiri Olsa6b5fc392012-05-21 09:12:53 +020049 PARSE_EVENTS__TERM_TYPE_NAME,
Jiri Olsa8f707d82012-03-15 20:09:16 +010050 PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD,
51 PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
Jiri Olsa8f707d82012-03-15 20:09:16 +010052};
53
54struct parse_events__term {
55 char *config;
56 union {
57 char *str;
Robert Richterb527bab2012-08-07 19:43:13 +020058 u64 num;
Jiri Olsa8f707d82012-03-15 20:09:16 +010059 } val;
Jiri Olsa16fa7e82012-04-25 18:24:57 +020060 int type_val;
61 int type_term;
Jiri Olsa8f707d82012-03-15 20:09:16 +010062 struct list_head list;
63};
64
Jiri Olsa46010ab2012-06-15 14:31:38 +080065struct parse_events_data__events {
66 struct list_head list;
67 int idx;
68};
69
Jiri Olsa90e2b222012-06-15 14:31:40 +080070struct parse_events_data__terms {
71 struct list_head *terms;
72};
73
Jiri Olsa8f707d82012-03-15 20:09:16 +010074int parse_events__is_hardcoded_term(struct parse_events__term *term);
Jiri Olsa16fa7e82012-04-25 18:24:57 +020075int parse_events__term_num(struct parse_events__term **_term,
Robert Richterb527bab2012-08-07 19:43:13 +020076 int type_term, char *config, u64 num);
Jiri Olsa16fa7e82012-04-25 18:24:57 +020077int parse_events__term_str(struct parse_events__term **_term,
78 int type_term, char *config, char *str);
Zheng Yana6146d52012-06-15 14:31:41 +080079int parse_events__term_clone(struct parse_events__term **new,
80 struct parse_events__term *term);
Jiri Olsa8f707d82012-03-15 20:09:16 +010081void parse_events__free_terms(struct list_head *terms);
Jiri Olsaf5b11352012-08-08 12:21:54 +020082int parse_events__modifier_event(struct list_head *list, char *str, bool add);
Jiri Olsa89efb022012-08-08 12:14:14 +020083int parse_events__modifier_group(struct list_head *list, char *event_mod);
Robert Richterac2ba9f2012-08-16 21:10:21 +020084int parse_events_name(struct list_head *list, char *name);
Jiri Olsab847cbd2012-05-21 09:12:51 +020085int parse_events_add_tracepoint(struct list_head **list, int *idx,
Jiri Olsa89812fc2012-03-15 20:09:15 +010086 char *sys, char *event);
Jiri Olsab847cbd2012-05-21 09:12:51 +020087int parse_events_add_numeric(struct list_head **list, int *idx,
Robert Richterb527bab2012-08-07 19:43:13 +020088 u32 type, u64 config,
Jiri Olsa8f707d82012-03-15 20:09:16 +010089 struct list_head *head_config);
Jiri Olsab847cbd2012-05-21 09:12:51 +020090int parse_events_add_cache(struct list_head **list, int *idx,
Jiri Olsa89812fc2012-03-15 20:09:15 +010091 char *type, char *op_result1, char *op_result2);
Jiri Olsab847cbd2012-05-21 09:12:51 +020092int parse_events_add_breakpoint(struct list_head **list, int *idx,
Jiri Olsa89812fc2012-03-15 20:09:15 +010093 void *ptr, char *type);
Jiri Olsab847cbd2012-05-21 09:12:51 +020094int parse_events_add_pmu(struct list_head **list, int *idx,
Jiri Olsa5f537a22012-03-15 20:09:18 +010095 char *pmu , struct list_head *head_config);
Arnaldo Carvalho de Melo63dab222012-08-14 16:35:48 -030096void parse_events__set_leader(char *name, struct list_head *list);
Jiri Olsa5d7be902012-03-20 19:15:40 +010097void parse_events_update_lists(struct list_head *list_event,
98 struct list_head *list_all);
Zheng Yanac20de6f2012-06-15 14:31:39 +080099void parse_events_error(void *data, void *scanner, char const *msg);
Jiri Olsaf50246e2012-05-21 09:12:49 +0200100int parse_events__test(void);
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 */