blob: ee9c218a193c8d8c8b20f893da976d262931e172 [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);
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;
58 long num;
59 } 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,
76 int type_term, char *config, long num);
77int 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 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 */