blob: 04df63114109604403f2f57a84ed03ec0b765707 [file] [log] [blame]
Steven Rostedt4ace73e2012-04-06 00:47:52 +02001#ifndef _PERF_UTIL_TRACE_EVENT_H
2#define _PERF_UTIL_TRACE_EVENT_H
Steven Rostedt520509432009-08-17 16:18:05 +02003
Robert Richter4e319022013-06-11 17:29:18 +02004#include <traceevent/event-parse.h>
Frederic Weisbecker1ef2ed12009-08-28 03:09:58 +02005#include "parse-events.h"
Steven Rostedt4ace73e2012-04-06 00:47:52 +02006#include "session.h"
Arnaldo Carvalho de Melo743eb862011-11-28 07:56:39 -02007
8struct machine;
9struct perf_sample;
10union perf_event;
Arnaldo Carvalho de Meloda378962012-06-27 13:08:42 -030011struct perf_tool;
David Ahern2eaa1b42013-07-18 16:06:15 -060012struct thread;
Steven Rostedt520509432009-08-17 16:18:05 +020013
Steven Rostedtaaf045f2012-04-06 00:47:56 +020014int bigendian(void);
15
Arnaldo Carvalho de Meloda378962012-06-27 13:08:42 -030016struct pevent *read_trace_init(int file_bigendian, int host_bigendian);
Arnaldo Carvalho de Melofcf65bf2012-08-07 09:58:03 -030017void event_format__print(struct event_format *event,
18 int cpu, void *data, int size);
Steven Rostedtaaf045f2012-04-06 00:47:56 +020019
Arnaldo Carvalho de Meloda378962012-06-27 13:08:42 -030020int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size);
21int parse_event_file(struct pevent *pevent,
22 char *buf, unsigned long size, char *sys);
Steven Rostedtaaf045f2012-04-06 00:47:56 +020023
Steven Rostedtaaf045f2012-04-06 00:47:56 +020024unsigned long long
25raw_field_value(struct event_format *event, const char *name, void *data);
Steven Rostedtaaf045f2012-04-06 00:47:56 +020026
Arnaldo Carvalho de Meloda378962012-06-27 13:08:42 -030027void parse_proc_kallsyms(struct pevent *pevent, char *file, unsigned int size);
28void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size);
Steven Rostedtaaf045f2012-04-06 00:47:56 +020029
Arnaldo Carvalho de Meloda378962012-06-27 13:08:42 -030030ssize_t trace_report(int fd, struct pevent **pevent, bool repipe);
Steven Rostedtaaf045f2012-04-06 00:47:56 +020031
Arnaldo Carvalho de Meloda378962012-06-27 13:08:42 -030032struct event_format *trace_find_next_event(struct pevent *pevent,
33 struct event_format *event);
Arnaldo Carvalho de Melo97822432012-08-07 23:50:21 -030034unsigned long long read_size(struct event_format *event, void *ptr, int size);
Steven Rostedtaaf045f2012-04-06 00:47:56 +020035unsigned long long eval_flag(const char *flag);
36
Arnaldo Carvalho de Melo69aad6f2011-01-03 16:39:04 -020037int read_tracing_data(int fd, struct list_head *pattrs);
Jiri Olsa29208e52011-10-20 15:59:43 +020038
39struct tracing_data {
40 /* size is only valid if temp is 'true' */
41 ssize_t size;
42 bool temp;
43 char temp_file[50];
44};
45
46struct tracing_data *tracing_data_get(struct list_head *pattrs,
47 int fd, bool temp);
Namhyung Kim8755d5e2013-03-21 16:18:46 +090048int tracing_data_put(struct tracing_data *tdata);
Jiri Olsa29208e52011-10-20 15:59:43 +020049
Steven Rostedt520509432009-08-17 16:18:05 +020050
Feng Tang73994dc2012-08-08 17:57:52 +080051struct addr_location;
52
Jiri Olsa71ad0f52012-08-07 15:20:46 +020053struct perf_session;
54
Tom Zanussi956ffd02009-11-25 01:15:46 -060055struct scripting_ops {
56 const char *name;
Tom Zanussi586bc5c2009-12-15 02:53:35 -060057 int (*start_script) (const char *script, int argc, const char **argv);
Tom Zanussi956ffd02009-11-25 01:15:46 -060058 int (*stop_script) (void);
David Ahernbe6d8422011-03-09 22:23:23 -070059 void (*process_event) (union perf_event *event,
60 struct perf_sample *sample,
Arnaldo Carvalho de Melo9e69c212011-03-15 15:44:01 -030061 struct perf_evsel *evsel,
Arnaldo Carvalho de Melo743eb862011-11-28 07:56:39 -020062 struct machine *machine,
David Ahern2eaa1b42013-07-18 16:06:15 -060063 struct thread *thread,
64 struct addr_location *al);
Arnaldo Carvalho de Meloda378962012-06-27 13:08:42 -030065 int (*generate_script) (struct pevent *pevent, const char *outfile);
Tom Zanussi956ffd02009-11-25 01:15:46 -060066};
67
68int script_spec_register(const char *spec, struct scripting_ops *ops);
69
Tom Zanussi16c632d2009-11-25 01:15:48 -060070void setup_perl_scripting(void);
Tom Zanussi7e4b21b2010-01-27 02:27:57 -060071void setup_python_scripting(void);
Tom Zanussi16c632d2009-11-25 01:15:48 -060072
Tom Zanussi7397d802010-01-27 02:27:54 -060073struct scripting_context {
Arnaldo Carvalho de Meloda378962012-06-27 13:08:42 -030074 struct pevent *pevent;
Tom Zanussi7397d802010-01-27 02:27:54 -060075 void *event_data;
76};
77
78int common_pc(struct scripting_context *context);
79int common_flags(struct scripting_context *context);
80int common_lock_depth(struct scripting_context *context);
81
Steven Rostedt4ace73e2012-04-06 00:47:52 +020082#endif /* _PERF_UTIL_TRACE_EVENT_H */