1 #ifndef __PERF_TRACE_EVENTS_H
2 #define __PERF_TRACE_EVENTS_H
4 #include "parse-events.h"
6 #define __unused __attribute__((unused))
10 #define PAGE_MASK (page_size - 1)
14 RINGBUF_TYPE_PADDING = 29,
15 RINGBUF_TYPE_TIME_EXTEND = 30,
16 RINGBUF_TYPE_TIME_STAMP = 31,
23 #define NSECS_PER_SEC 1000000000ULL
24 #define NSECS_PER_USEC 1000ULL
33 struct format_field *next;
44 struct format_field *common_fields;
45 struct format_field *fields;
48 struct print_arg_atom {
52 struct print_arg_string {
57 struct print_arg_field {
59 struct format_field *field;
62 struct print_flag_sym {
63 struct print_flag_sym *next;
68 struct print_arg_typecast {
70 struct print_arg *item;
73 struct print_arg_flags {
74 struct print_arg *field;
76 struct print_flag_sym *flags;
79 struct print_arg_symbol {
80 struct print_arg *field;
81 struct print_flag_sym *symbols;
89 struct print_arg *left;
90 struct print_arg *right;
93 struct print_arg_func {
95 struct print_arg *args;
110 struct print_arg *next;
111 enum print_arg_type type;
113 struct print_arg_atom atom;
114 struct print_arg_field field;
115 struct print_arg_typecast typecast;
116 struct print_arg_flags flags;
117 struct print_arg_symbol symbol;
118 struct print_arg_func func;
119 struct print_arg_string string;
120 struct print_arg_op op;
126 struct print_arg *args;
134 struct format format;
135 struct print_fmt print_fmt;
139 EVENT_FL_ISFTRACE = 1,
140 EVENT_FL_ISPRINT = 2,
141 EVENT_FL_ISBPRINT = 4,
143 EVENT_FL_ISFUNCENT = 16,
144 EVENT_FL_ISFUNCRET = 32,
148 unsigned long long ts;
153 struct record *trace_peek_data(int cpu);
154 struct record *trace_read_data(int cpu);
156 void parse_set_info(int nr_cpus, int long_sz);
158 void trace_report(void);
160 void *malloc_or_die(unsigned int size);
162 void parse_cmdlines(char *file, int size);
163 void parse_proc_kallsyms(char *file, unsigned int size);
164 void parse_ftrace_printk(char *file, unsigned int size);
166 void print_funcs(void);
167 void print_printk(void);
169 int parse_ftrace_file(char *buf, unsigned long size);
170 int parse_event_file(char *buf, unsigned long size, char *system);
171 void print_event(int cpu, void *data, int size, unsigned long long nsecs,
174 extern int file_bigendian;
175 extern int host_bigendian;
179 static inline unsigned short __data2host2(unsigned short data)
183 if (host_bigendian == file_bigendian)
186 swap = ((data & 0xffULL) << 8) |
187 ((data & (0xffULL << 8)) >> 8);
192 static inline unsigned int __data2host4(unsigned int data)
196 if (host_bigendian == file_bigendian)
199 swap = ((data & 0xffULL) << 24) |
200 ((data & (0xffULL << 8)) << 8) |
201 ((data & (0xffULL << 16)) >> 8) |
202 ((data & (0xffULL << 24)) >> 24);
207 static inline unsigned long long __data2host8(unsigned long long data)
209 unsigned long long swap;
211 if (host_bigendian == file_bigendian)
214 swap = ((data & 0xffULL) << 56) |
215 ((data & (0xffULL << 8)) << 40) |
216 ((data & (0xffULL << 16)) << 24) |
217 ((data & (0xffULL << 24)) << 8) |
218 ((data & (0xffULL << 32)) >> 8) |
219 ((data & (0xffULL << 40)) >> 24) |
220 ((data & (0xffULL << 48)) >> 40) |
221 ((data & (0xffULL << 56)) >> 56);
226 #define data2host2(ptr) __data2host2(*(unsigned short *)ptr)
227 #define data2host4(ptr) __data2host4(*(unsigned int *)ptr)
228 #define data2host8(ptr) __data2host8(*(unsigned long long *)ptr)
230 extern int header_page_ts_offset;
231 extern int header_page_ts_size;
232 extern int header_page_size_offset;
233 extern int header_page_size_size;
234 extern int header_page_data_offset;
235 extern int header_page_data_size;
237 int parse_header_page(char *buf, unsigned long size);
238 int trace_parse_common_type(void *data);
239 struct event *trace_find_event(int id);
241 raw_field_value(struct event *event, const char *name, void *data);
242 void *raw_field_ptr(struct event *event, const char *name, void *data);
244 void read_tracing_data(struct perf_event_attr *pattrs, int nb_events);
246 #endif /* __PERF_TRACE_EVENTS_H */