1 #ifndef _PERF_UTIL_TRACE_EVENT_H
2 #define _PERF_UTIL_TRACE_EVENT_H
4 #include "parse-events.h"
5 #include "event-parse.h"
13 extern int header_page_size_size;
14 extern int header_page_ts_size;
15 extern int header_page_data_offset;
17 extern bool latency_format;
18 extern struct pevent *perf_pevent;
21 RINGBUF_TYPE_PADDING = 29,
22 RINGBUF_TYPE_TIME_EXTEND = 30,
23 RINGBUF_TYPE_TIME_STAMP = 31,
32 struct pevent *read_trace_init(int file_bigendian, int host_bigendian);
33 void event_format__print(struct event_format *event,
34 int cpu, void *data, int size);
36 int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size);
37 int parse_event_file(struct pevent *pevent,
38 char *buf, unsigned long size, char *sys);
40 struct pevent_record *trace_peek_data(struct pevent *pevent, int cpu);
43 raw_field_value(struct event_format *event, const char *name, void *data);
44 void *raw_field_ptr(struct event_format *event, const char *name, void *data);
46 void parse_proc_kallsyms(struct pevent *pevent, char *file, unsigned int size);
47 void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size);
49 ssize_t trace_report(int fd, struct pevent **pevent, bool repipe);
51 int trace_parse_common_type(struct pevent *pevent, void *data);
52 int trace_parse_common_pid(struct pevent *pevent, void *data);
54 struct event_format *trace_find_next_event(struct pevent *pevent,
55 struct event_format *event);
56 unsigned long long read_size(struct event_format *event, void *ptr, int size);
57 unsigned long long eval_flag(const char *flag);
59 struct pevent_record *trace_read_data(struct pevent *pevent, int cpu);
60 int read_tracing_data(int fd, struct list_head *pattrs);
63 /* size is only valid if temp is 'true' */
69 struct tracing_data *tracing_data_get(struct list_head *pattrs,
71 int tracing_data_put(struct tracing_data *tdata);
78 struct scripting_ops {
80 int (*start_script) (const char *script, int argc, const char **argv);
81 int (*stop_script) (void);
82 void (*process_event) (union perf_event *event,
83 struct perf_sample *sample,
84 struct perf_evsel *evsel,
85 struct machine *machine,
86 struct addr_location *al);
87 int (*generate_script) (struct pevent *pevent, const char *outfile);
90 int script_spec_register(const char *spec, struct scripting_ops *ops);
92 void setup_perl_scripting(void);
93 void setup_python_scripting(void);
95 struct scripting_context {
96 struct pevent *pevent;
100 int common_pc(struct scripting_context *context);
101 int common_flags(struct scripting_context *context);
102 int common_lock_depth(struct scripting_context *context);
104 #endif /* _PERF_UTIL_TRACE_EVENT_H */