Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1#ifndef _PERF_UTIL_TRACE_EVENT_H
2#define _PERF_UTIL_TRACE_EVENT_H
3
4#include "parse-events.h"
5#include "event-parse.h"
6#include "session.h"
7
8struct machine;
9struct perf_sample;
10union perf_event;
11struct perf_tool;
12
13extern int header_page_size_size;
14extern int header_page_ts_size;
15extern int header_page_data_offset;
16
17extern bool latency_format;
18extern struct pevent *perf_pevent;
19
20enum {
21 RINGBUF_TYPE_PADDING = 29,
22 RINGBUF_TYPE_TIME_EXTEND = 30,
23 RINGBUF_TYPE_TIME_STAMP = 31,
24};
25
26#ifndef TS_SHIFT
27#define TS_SHIFT 27
28#endif
29
30int bigendian(void);
31
32struct pevent *read_trace_init(int file_bigendian, int host_bigendian);
33void print_trace_event(struct pevent *pevent, int cpu, void *data, int size);
34void event_format__print(struct event_format *event,
35 int cpu, void *data, int size);
36
37void print_event(struct pevent *pevent, int cpu, void *data, int size,
38 unsigned long long nsecs, char *comm);
39
40int parse_ftrace_file(struct pevent *pevent, char *buf, unsigned long size);
41int parse_event_file(struct pevent *pevent,
42 char *buf, unsigned long size, char *sys);
43
44struct pevent_record *trace_peek_data(struct pevent *pevent, int cpu);
45
46unsigned long long
47raw_field_value(struct event_format *event, const char *name, void *data);
48void *raw_field_ptr(struct event_format *event, const char *name, void *data);
49
50void parse_proc_kallsyms(struct pevent *pevent, char *file, unsigned int size);
51void parse_ftrace_printk(struct pevent *pevent, char *file, unsigned int size);
52
53ssize_t trace_report(int fd, struct pevent **pevent, bool repipe);
54
55int trace_parse_common_type(struct pevent *pevent, void *data);
56int trace_parse_common_pid(struct pevent *pevent, void *data);
57
58struct event_format *trace_find_next_event(struct pevent *pevent,
59 struct event_format *event);
60unsigned long long read_size(struct event_format *event, void *ptr, int size);
61unsigned long long eval_flag(const char *flag);
62
63struct pevent_record *trace_read_data(struct pevent *pevent, int cpu);
64int read_tracing_data(int fd, struct list_head *pattrs);
65
66struct tracing_data {
67 /* size is only valid if temp is 'true' */
68 ssize_t size;
69 bool temp;
70 char temp_file[50];
71};
72
73struct tracing_data *tracing_data_get(struct list_head *pattrs,
74 int fd, bool temp);
75void tracing_data_put(struct tracing_data *tdata);
76
77
78struct addr_location;
79
80struct perf_session;
81
82struct scripting_ops {
83 const char *name;
84 int (*start_script) (const char *script, int argc, const char **argv);
85 int (*stop_script) (void);
86 void (*process_event) (union perf_event *event,
87 struct perf_sample *sample,
88 struct perf_evsel *evsel,
89 struct machine *machine,
90 struct addr_location *al);
91 int (*generate_script) (struct pevent *pevent, const char *outfile);
92};
93
94int script_spec_register(const char *spec, struct scripting_ops *ops);
95
96void setup_perl_scripting(void);
97void setup_python_scripting(void);
98
99struct scripting_context {
100 struct pevent *pevent;
101 void *event_data;
102};
103
104int common_pc(struct scripting_context *context);
105int common_flags(struct scripting_context *context);
106int common_lock_depth(struct scripting_context *context);
107
108#endif /* _PERF_UTIL_TRACE_EVENT_H */