1 #ifndef _TRACE_EVENTS_H
2 #define _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
32 struct format_field *next;
43 struct format_field *common_fields;
44 struct format_field *fields;
47 struct print_arg_atom {
51 struct print_arg_string {
55 struct print_arg_field {
57 struct format_field *field;
60 struct print_flag_sym {
61 struct print_flag_sym *next;
66 struct print_arg_typecast {
68 struct print_arg *item;
71 struct print_arg_flags {
72 struct print_arg *field;
74 struct print_flag_sym *flags;
77 struct print_arg_symbol {
78 struct print_arg *field;
79 struct print_flag_sym *symbols;
87 struct print_arg *left;
88 struct print_arg *right;
91 struct print_arg_func {
93 struct print_arg *args;
108 struct print_arg *next;
109 enum print_arg_type type;
111 struct print_arg_atom atom;
112 struct print_arg_field field;
113 struct print_arg_typecast typecast;
114 struct print_arg_flags flags;
115 struct print_arg_symbol symbol;
116 struct print_arg_func func;
117 struct print_arg_string string;
118 struct print_arg_op op;
124 struct print_arg *args;
132 struct format format;
133 struct print_fmt print_fmt;
137 EVENT_FL_ISFTRACE = 1,
138 EVENT_FL_ISPRINT = 2,
139 EVENT_FL_ISBPRINT = 4,
141 EVENT_FL_ISFUNCENT = 16,
142 EVENT_FL_ISFUNCRET = 32,
146 unsigned long long ts;
151 struct record *trace_peek_data(int cpu);
152 struct record *trace_read_data(int cpu);
154 void parse_set_info(int nr_cpus, int long_sz);
156 void trace_report(void);
158 void *malloc_or_die(unsigned int size);
160 void parse_cmdlines(char *file, int size);
161 void parse_proc_kallsyms(char *file, unsigned int size);
162 void parse_ftrace_printk(char *file, unsigned int size);
164 void print_funcs(void);
165 void print_printk(void);
167 int parse_ftrace_file(char *buf, unsigned long size);
168 int parse_event_file(char *buf, unsigned long size, char *system);
169 void print_event(int cpu, void *data, int size, unsigned long long nsecs,
172 extern int file_bigendian;
173 extern int host_bigendian;
177 static inline unsigned short __data2host2(unsigned short data)
181 if (host_bigendian == file_bigendian)
184 swap = ((data & 0xffULL) << 8) |
185 ((data & (0xffULL << 8)) >> 8);
190 static inline unsigned int __data2host4(unsigned int data)
194 if (host_bigendian == file_bigendian)
197 swap = ((data & 0xffULL) << 24) |
198 ((data & (0xffULL << 8)) << 8) |
199 ((data & (0xffULL << 16)) >> 8) |
200 ((data & (0xffULL << 24)) >> 24);
205 static inline unsigned long long __data2host8(unsigned long long data)
207 unsigned long long swap;
209 if (host_bigendian == file_bigendian)
212 swap = ((data & 0xffULL) << 56) |
213 ((data & (0xffULL << 8)) << 40) |
214 ((data & (0xffULL << 16)) << 24) |
215 ((data & (0xffULL << 24)) << 8) |
216 ((data & (0xffULL << 32)) >> 8) |
217 ((data & (0xffULL << 40)) >> 24) |
218 ((data & (0xffULL << 48)) >> 40) |
219 ((data & (0xffULL << 56)) >> 56);
224 #define data2host2(ptr) __data2host2(*(unsigned short *)ptr)
225 #define data2host4(ptr) __data2host4(*(unsigned int *)ptr)
226 #define data2host8(ptr) __data2host8(*(unsigned long long *)ptr)
228 extern int header_page_ts_offset;
229 extern int header_page_ts_size;
230 extern int header_page_size_offset;
231 extern int header_page_size_size;
232 extern int header_page_data_offset;
233 extern int header_page_data_size;
235 int parse_header_page(char *buf, unsigned long size);
237 void read_tracing_data(struct perf_counter_attr *pattrs, int nb_counters);
239 #endif /* _TRACE_EVENTS_H */