Steven Rostedt | 4ace73e | 2012-04-06 00:47:52 +0200 | [diff] [blame] | 1 | #ifndef _PERF_UTIL_TRACE_EVENT_H |
| 2 | #define _PERF_UTIL_TRACE_EVENT_H |
Steven Rostedt | 52050943 | 2009-08-17 16:18:05 +0200 | [diff] [blame] | 3 | |
Robert Richter | 4e31902 | 2013-06-11 17:29:18 +0200 | [diff] [blame] | 4 | #include <traceevent/event-parse.h> |
Frederic Weisbecker | 1ef2ed1 | 2009-08-28 03:09:58 +0200 | [diff] [blame] | 5 | #include "parse-events.h" |
Arnaldo Carvalho de Melo | 743eb86 | 2011-11-28 07:56:39 -0200 | [diff] [blame] | 6 | |
| 7 | struct machine; |
| 8 | struct perf_sample; |
| 9 | union perf_event; |
Arnaldo Carvalho de Melo | da37896 | 2012-06-27 13:08:42 -0300 | [diff] [blame] | 10 | struct perf_tool; |
David Ahern | 2eaa1b4 | 2013-07-18 16:06:15 -0600 | [diff] [blame] | 11 | struct thread; |
Jiri Olsa | 29f5ffd | 2013-12-03 14:09:23 +0100 | [diff] [blame] | 12 | struct plugin_list; |
| 13 | |
| 14 | struct trace_event { |
| 15 | struct pevent *pevent; |
| 16 | struct plugin_list *plugin_list; |
| 17 | }; |
| 18 | |
| 19 | int trace_event__init(struct trace_event *t); |
| 20 | void trace_event__cleanup(struct trace_event *t); |
Arnaldo Carvalho de Melo | 959c219 | 2015-07-24 12:13:05 -0300 | [diff] [blame] | 21 | int trace_event__register_resolver(struct machine *machine, |
| 22 | pevent_func_resolver_t *func); |
Jiri Olsa | 97978b3 | 2013-12-03 14:09:24 +0100 | [diff] [blame] | 23 | struct event_format* |
| 24 | trace_event__tp_format(const char *sys, const char *name); |
Steven Rostedt | 52050943 | 2009-08-17 16:18:05 +0200 | [diff] [blame] | 25 | |
Steven Rostedt | aaf045f | 2012-04-06 00:47:56 +0200 | [diff] [blame] | 26 | int bigendian(void); |
| 27 | |
Arnaldo Carvalho de Melo | aa1aac1 | 2015-02-03 12:46:58 -0300 | [diff] [blame] | 28 | void event_format__fprintf(struct event_format *event, |
| 29 | int cpu, void *data, int size, FILE *fp); |
| 30 | |
Arnaldo Carvalho de Melo | fcf65bf | 2012-08-07 09:58:03 -0300 | [diff] [blame] | 31 | void event_format__print(struct event_format *event, |
| 32 | int cpu, void *data, int size); |
Steven Rostedt | aaf045f | 2012-04-06 00:47:56 +0200 | [diff] [blame] | 33 | |
Arnaldo Carvalho de Melo | da37896 | 2012-06-27 13:08:42 -0300 | [diff] [blame] | 34 | int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size); |
| 35 | int parse_event_file(struct pevent *pevent, |
| 36 | char *buf, unsigned long size, char *sys); |
Steven Rostedt | aaf045f | 2012-04-06 00:47:56 +0200 | [diff] [blame] | 37 | |
Steven Rostedt | aaf045f | 2012-04-06 00:47:56 +0200 | [diff] [blame] | 38 | unsigned long long |
| 39 | raw_field_value(struct event_format *event, const char *name, void *data); |
Steven Rostedt | aaf045f | 2012-04-06 00:47:56 +0200 | [diff] [blame] | 40 | |
Arnaldo Carvalho de Melo | da37896 | 2012-06-27 13:08:42 -0300 | [diff] [blame] | 41 | void parse_proc_kallsyms(struct pevent *pevent, char *file, unsigned int size); |
| 42 | void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size); |
Steven Rostedt | aaf045f | 2012-04-06 00:47:56 +0200 | [diff] [blame] | 43 | |
Jiri Olsa | 29f5ffd | 2013-12-03 14:09:23 +0100 | [diff] [blame] | 44 | ssize_t trace_report(int fd, struct trace_event *tevent, bool repipe); |
Steven Rostedt | aaf045f | 2012-04-06 00:47:56 +0200 | [diff] [blame] | 45 | |
Arnaldo Carvalho de Melo | da37896 | 2012-06-27 13:08:42 -0300 | [diff] [blame] | 46 | struct event_format *trace_find_next_event(struct pevent *pevent, |
| 47 | struct event_format *event); |
Arnaldo Carvalho de Melo | 9782243 | 2012-08-07 23:50:21 -0300 | [diff] [blame] | 48 | unsigned long long read_size(struct event_format *event, void *ptr, int size); |
Steven Rostedt | aaf045f | 2012-04-06 00:47:56 +0200 | [diff] [blame] | 49 | unsigned long long eval_flag(const char *flag); |
| 50 | |
Arnaldo Carvalho de Melo | 69aad6f | 2011-01-03 16:39:04 -0200 | [diff] [blame] | 51 | int read_tracing_data(int fd, struct list_head *pattrs); |
Jiri Olsa | 29208e5 | 2011-10-20 15:59:43 +0200 | [diff] [blame] | 52 | |
| 53 | struct tracing_data { |
| 54 | /* size is only valid if temp is 'true' */ |
| 55 | ssize_t size; |
| 56 | bool temp; |
| 57 | char temp_file[50]; |
| 58 | }; |
| 59 | |
| 60 | struct tracing_data *tracing_data_get(struct list_head *pattrs, |
| 61 | int fd, bool temp); |
Namhyung Kim | 8755d5e | 2013-03-21 16:18:46 +0900 | [diff] [blame] | 62 | int tracing_data_put(struct tracing_data *tdata); |
Jiri Olsa | 29208e5 | 2011-10-20 15:59:43 +0200 | [diff] [blame] | 63 | |
Steven Rostedt | 52050943 | 2009-08-17 16:18:05 +0200 | [diff] [blame] | 64 | |
Feng Tang | 73994dc | 2012-08-08 17:57:52 +0800 | [diff] [blame] | 65 | struct addr_location; |
| 66 | |
Jiri Olsa | 71ad0f5 | 2012-08-07 15:20:46 +0200 | [diff] [blame] | 67 | struct perf_session; |
Jiri Olsa | 8058a30 | 2016-01-05 22:09:08 +0100 | [diff] [blame] | 68 | struct perf_stat_config; |
Jiri Olsa | 71ad0f5 | 2012-08-07 15:20:46 +0200 | [diff] [blame] | 69 | |
Tom Zanussi | 956ffd0 | 2009-11-25 01:15:46 -0600 | [diff] [blame] | 70 | struct scripting_ops { |
| 71 | const char *name; |
Tom Zanussi | 586bc5c | 2009-12-15 02:53:35 -0600 | [diff] [blame] | 72 | int (*start_script) (const char *script, int argc, const char **argv); |
Adrian Hunter | d445dd2 | 2014-08-15 22:08:37 +0300 | [diff] [blame] | 73 | int (*flush_script) (void); |
Tom Zanussi | 956ffd0 | 2009-11-25 01:15:46 -0600 | [diff] [blame] | 74 | int (*stop_script) (void); |
David Ahern | be6d842 | 2011-03-09 22:23:23 -0700 | [diff] [blame] | 75 | void (*process_event) (union perf_event *event, |
| 76 | struct perf_sample *sample, |
Arnaldo Carvalho de Melo | 9e69c21 | 2011-03-15 15:44:01 -0300 | [diff] [blame] | 77 | struct perf_evsel *evsel, |
Arnaldo Carvalho de Melo | f9d5d54 | 2015-04-01 13:29:25 -0300 | [diff] [blame] | 78 | struct addr_location *al); |
Jiri Olsa | 8058a30 | 2016-01-05 22:09:08 +0100 | [diff] [blame] | 79 | void (*process_stat)(struct perf_stat_config *config, |
| 80 | struct perf_evsel *evsel, u64 tstamp); |
| 81 | void (*process_stat_interval)(u64 tstamp); |
Arnaldo Carvalho de Melo | da37896 | 2012-06-27 13:08:42 -0300 | [diff] [blame] | 82 | int (*generate_script) (struct pevent *pevent, const char *outfile); |
Tom Zanussi | 956ffd0 | 2009-11-25 01:15:46 -0600 | [diff] [blame] | 83 | }; |
| 84 | |
Adrian Hunter | 44cbe72 | 2015-09-25 16:15:50 +0300 | [diff] [blame] | 85 | extern unsigned int scripting_max_stack; |
| 86 | |
Tom Zanussi | 956ffd0 | 2009-11-25 01:15:46 -0600 | [diff] [blame] | 87 | int script_spec_register(const char *spec, struct scripting_ops *ops); |
| 88 | |
Tom Zanussi | 16c632d | 2009-11-25 01:15:48 -0600 | [diff] [blame] | 89 | void setup_perl_scripting(void); |
Tom Zanussi | 7e4b21b | 2010-01-27 02:27:57 -0600 | [diff] [blame] | 90 | void setup_python_scripting(void); |
Tom Zanussi | 16c632d | 2009-11-25 01:15:48 -0600 | [diff] [blame] | 91 | |
Tom Zanussi | 7397d80 | 2010-01-27 02:27:54 -0600 | [diff] [blame] | 92 | struct scripting_context { |
Arnaldo Carvalho de Melo | da37896 | 2012-06-27 13:08:42 -0300 | [diff] [blame] | 93 | struct pevent *pevent; |
Tom Zanussi | 7397d80 | 2010-01-27 02:27:54 -0600 | [diff] [blame] | 94 | void *event_data; |
| 95 | }; |
| 96 | |
| 97 | int common_pc(struct scripting_context *context); |
| 98 | int common_flags(struct scripting_context *context); |
| 99 | int common_lock_depth(struct scripting_context *context); |
| 100 | |
Steven Rostedt | 4ace73e | 2012-04-06 00:47:52 +0200 | [diff] [blame] | 101 | #endif /* _PERF_UTIL_TRACE_EVENT_H */ |