blob: 9896edadbe62b2cea386eaf2fa37bae744a19793 [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"
Stephane Eraniand0302602011-01-04 16:30:01 +020010#include "../../../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);
Arnaldo Carvalho de Melo69aad6f2011-01-03 16:39:04 -020029const char *event_name(struct perf_evsel *event);
Ingo Molnar83a09442009-08-15 12:26:57 +020030extern const char *__event_name(int type, u64 config);
Ingo Molnar8ad8db32009-05-26 11:10:09 +020031
Jiri Olsaf120f9d2011-07-14 11:25:32 +020032extern int parse_events_option(const struct option *opt, const char *str,
33 int unset);
34extern int parse_events(struct perf_evlist *evlist, const char *str,
35 int unset);
Jiri Olsa90e2b222012-06-15 14:31:40 +080036extern int parse_events_terms(struct list_head *terms, const char *str);
Li Zefanc171b552009-10-15 11:22:07 +080037extern int parse_filter(const struct option *opt, const char *str, int unset);
Ingo Molnar8ad8db32009-05-26 11:10:09 +020038
39#define EVENTS_HELP_MAX (128*1024)
40
Jiri Olsa8f707d82012-03-15 20:09:16 +010041enum {
Jiri Olsa16fa7e82012-04-25 18:24:57 +020042 PARSE_EVENTS__TERM_TYPE_NUM,
43 PARSE_EVENTS__TERM_TYPE_STR,
44};
45
46enum {
47 PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsa8f707d82012-03-15 20:09:16 +010048 PARSE_EVENTS__TERM_TYPE_CONFIG,
49 PARSE_EVENTS__TERM_TYPE_CONFIG1,
50 PARSE_EVENTS__TERM_TYPE_CONFIG2,
Jiri Olsa6b5fc392012-05-21 09:12:53 +020051 PARSE_EVENTS__TERM_TYPE_NAME,
Jiri Olsa8f707d82012-03-15 20:09:16 +010052 PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD,
53 PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE,
Jiri Olsa8f707d82012-03-15 20:09:16 +010054};
55
56struct parse_events__term {
57 char *config;
58 union {
59 char *str;
60 long num;
61 } val;
Jiri Olsa16fa7e82012-04-25 18:24:57 +020062 int type_val;
63 int type_term;
Jiri Olsa8f707d82012-03-15 20:09:16 +010064 struct list_head list;
65};
66
Jiri Olsa46010ab2012-06-15 14:31:38 +080067struct parse_events_data__events {
68 struct list_head list;
69 int idx;
70};
71
Jiri Olsa90e2b222012-06-15 14:31:40 +080072struct parse_events_data__terms {
73 struct list_head *terms;
74};
75
Jiri Olsa8f707d82012-03-15 20:09:16 +010076int parse_events__is_hardcoded_term(struct parse_events__term *term);
Jiri Olsa16fa7e82012-04-25 18:24:57 +020077int parse_events__term_num(struct parse_events__term **_term,
78 int type_term, char *config, long num);
79int parse_events__term_str(struct parse_events__term **_term,
80 int type_term, char *config, char *str);
Jiri Olsa8f707d82012-03-15 20:09:16 +010081void parse_events__free_terms(struct list_head *terms);
Jiri Olsab847cbd2012-05-21 09:12:51 +020082int parse_events_modifier(struct list_head *list, char *str);
83int parse_events_add_tracepoint(struct list_head **list, int *idx,
Jiri Olsa89812fc2012-03-15 20:09:15 +010084 char *sys, char *event);
Jiri Olsab847cbd2012-05-21 09:12:51 +020085int parse_events_add_numeric(struct list_head **list, int *idx,
Jiri Olsa8f707d82012-03-15 20:09:16 +010086 unsigned long type, unsigned long config,
87 struct list_head *head_config);
Jiri Olsab847cbd2012-05-21 09:12:51 +020088int parse_events_add_cache(struct list_head **list, int *idx,
Jiri Olsa89812fc2012-03-15 20:09:15 +010089 char *type, char *op_result1, char *op_result2);
Jiri Olsab847cbd2012-05-21 09:12:51 +020090int parse_events_add_breakpoint(struct list_head **list, int *idx,
Jiri Olsa89812fc2012-03-15 20:09:15 +010091 void *ptr, char *type);
Jiri Olsab847cbd2012-05-21 09:12:51 +020092int parse_events_add_pmu(struct list_head **list, int *idx,
Jiri Olsa5f537a22012-03-15 20:09:18 +010093 char *pmu , struct list_head *head_config);
Jiri Olsa5d7be902012-03-20 19:15:40 +010094void parse_events_update_lists(struct list_head *list_event,
95 struct list_head *list_all);
Zheng Yanac20de6f2012-06-15 14:31:39 +080096void parse_events_error(void *data, void *scanner, char const *msg);
Jiri Olsaf50246e2012-05-21 09:12:49 +020097int parse_events__test(void);
Jiri Olsa89812fc2012-03-15 20:09:15 +010098
Arnaldo Carvalho de Melo668b8782011-02-17 15:38:58 -020099void print_events(const char *event_glob);
100void print_events_type(u8 type);
101void print_tracepoint_events(const char *subsys_glob, const char *event_glob);
102int print_hwcache_events(const char *event_glob);
Thomas Renninger20c457b2011-01-03 17:50:45 +0100103extern int is_valid_tracepoint(const char *event_string);
Ingo Molnar8ad8db32009-05-26 11:10:09 +0200104
Jason Baron5beeded2009-07-21 14:16:29 -0400105extern int valid_debugfs_mount(const char *debugfs);
106
John Kacur8b40f522009-09-24 18:02:18 +0200107#endif /* __PERF_PARSE_EVENTS_H */