1 #ifndef _PARSE_EVENTS_H
2 #define _PARSE_EVENTS_H
5 #define __unused __attribute__((unused))
9 #define PAGE_MASK (page_size - 1)
13 RINGBUF_TYPE_PADDING
= 29,
14 RINGBUF_TYPE_TIME_EXTEND
= 30,
15 RINGBUF_TYPE_TIME_STAMP
= 31,
22 #define NSECS_PER_SEC 1000000000ULL
23 #define NSECS_PER_USEC 1000ULL
31 struct format_field
*next
;
42 struct format_field
*common_fields
;
43 struct format_field
*fields
;
46 struct print_arg_atom
{
50 struct print_arg_string
{
54 struct print_arg_field
{
56 struct format_field
*field
;
59 struct print_flag_sym
{
60 struct print_flag_sym
*next
;
65 struct print_arg_typecast
{
67 struct print_arg
*item
;
70 struct print_arg_flags
{
71 struct print_arg
*field
;
73 struct print_flag_sym
*flags
;
76 struct print_arg_symbol
{
77 struct print_arg
*field
;
78 struct print_flag_sym
*symbols
;
86 struct print_arg
*left
;
87 struct print_arg
*right
;
90 struct print_arg_func
{
92 struct print_arg
*args
;
107 struct print_arg
*next
;
108 enum print_arg_type type
;
110 struct print_arg_atom atom
;
111 struct print_arg_field field
;
112 struct print_arg_typecast typecast
;
113 struct print_arg_flags flags
;
114 struct print_arg_symbol symbol
;
115 struct print_arg_func func
;
116 struct print_arg_string string
;
117 struct print_arg_op op
;
123 struct print_arg
*args
;
131 struct format format
;
132 struct print_fmt print_fmt
;
136 EVENT_FL_ISFTRACE
= 1,
137 EVENT_FL_ISPRINT
= 2,
138 EVENT_FL_ISBPRINT
= 4,
140 EVENT_FL_ISFUNCENT
= 16,
141 EVENT_FL_ISFUNCRET
= 32,
145 unsigned long long ts
;
150 struct record
*trace_peek_data(int cpu
);
151 struct record
*trace_read_data(int cpu
);
153 void parse_set_info(int nr_cpus
, int long_sz
);
155 void trace_report(void);
157 void *malloc_or_die(unsigned int size
);
159 void parse_cmdlines(char *file
, int size
);
160 void parse_proc_kallsyms(char *file
, unsigned int size
);
161 void parse_ftrace_printk(char *file
, unsigned int size
);
163 void print_funcs(void);
164 void print_printk(void);
166 int parse_ftrace_file(char *buf
, unsigned long size
);
167 int parse_event_file(char *buf
, unsigned long size
, char *system
);
168 void print_event(int cpu
, void *data
, int size
, unsigned long long nsecs
,
171 extern int file_bigendian
;
172 extern int host_bigendian
;
176 static inline unsigned short __data2host2(unsigned short data
)
180 if (host_bigendian
== file_bigendian
)
183 swap
= ((data
& 0xffULL
) << 8) |
184 ((data
& (0xffULL
<< 8)) >> 8);
189 static inline unsigned int __data2host4(unsigned int data
)
193 if (host_bigendian
== file_bigendian
)
196 swap
= ((data
& 0xffULL
) << 24) |
197 ((data
& (0xffULL
<< 8)) << 8) |
198 ((data
& (0xffULL
<< 16)) >> 8) |
199 ((data
& (0xffULL
<< 24)) >> 24);
204 static inline unsigned long long __data2host8(unsigned long long data
)
206 unsigned long long swap
;
208 if (host_bigendian
== file_bigendian
)
211 swap
= ((data
& 0xffULL
) << 56) |
212 ((data
& (0xffULL
<< 8)) << 40) |
213 ((data
& (0xffULL
<< 16)) << 24) |
214 ((data
& (0xffULL
<< 24)) << 8) |
215 ((data
& (0xffULL
<< 32)) >> 8) |
216 ((data
& (0xffULL
<< 40)) >> 24) |
217 ((data
& (0xffULL
<< 48)) >> 40) |
218 ((data
& (0xffULL
<< 56)) >> 56);
223 #define data2host2(ptr) __data2host2(*(unsigned short *)ptr)
224 #define data2host4(ptr) __data2host4(*(unsigned int *)ptr)
225 #define data2host8(ptr) __data2host8(*(unsigned long long *)ptr)
227 extern int header_page_ts_offset
;
228 extern int header_page_ts_size
;
229 extern int header_page_size_offset
;
230 extern int header_page_size_size
;
231 extern int header_page_data_offset
;
232 extern int header_page_data_size
;
234 int parse_header_page(char *buf
, unsigned long size
);
236 void read_tracing_data(void);
238 #endif /* _PARSE_EVENTS_H */