2 * This file defines the trace event structures that go into the ring
3 * buffer directly. They are created via macros so that changes for them
4 * appear in the format file. Using macros will automate this process.
6 * The macro used to create a ftrace data structure is:
8 * FTRACE_ENTRY( name, struct_name, id, structure, print )
10 * @name: the name used the event name, as well as the name of
11 * the directory that holds the format file.
13 * @struct_name: the name of the structure that is created.
15 * @id: The event identifier that is used to detect what event
16 * this is from the ring buffer.
18 * @structure: the structure layout
20 * - __field( type, item )
21 * This is equivalent to declaring
24 * - __array( type, item, size )
25 * This is equivalent to declaring
29 * @print: the print format shown to users in the format file.
33 * Function trace entry - function address and parent function addres:
35 FTRACE_ENTRY(function, ftrace_entry,
40 __field( unsigned long, ip )
41 __field( unsigned long, parent_ip )
44 F_printk(" %lx <-- %lx", __entry->ip, __entry->parent_ip)
47 /* Function call entry */
48 FTRACE_ENTRY(funcgraph_entry, ftrace_graph_ent_entry,
53 __field( struct ftrace_graph_ent, graph_ent )
56 F_printk("--> %lx (%d)", __entry->graph_ent.func, __entry->depth)
59 /* Function return entry */
60 FTRACE_ENTRY(funcgraph_exit, ftrace_graph_ret_entry,
65 __field( struct ftrace_graph_ret, ret )
68 F_printk("<-- %lx (%d) (start: %llx end: %llx) over: %d",
69 __entry->func, __entry->depth,
70 __entry->calltime, __entry->rettim,
75 * Context switch trace entry - which task (and prio) we switched from/to:
77 * This is used for both wakeup and context switches. We only want
78 * to create one structure, but we need two outputs for it.
80 #define FTRACE_CTX_FIELDS \
81 __field( unsigned int, prev_pid ) \
82 __field( unsigned char, prev_prio ) \
83 __field( unsigned char, prev_state ) \
84 __field( unsigned int, next_pid ) \
85 __field( unsigned char, next_prio ) \
86 __field( unsigned char, next_state ) \
87 __field( unsigned int, next_cpu )
90 FTRACE_ENTRY_STRUCT_ONLY(ctx_switch_entry,
98 FTRACE_ENTRY(context_switch, ctx_switch_entry,
106 F_printk(b"%u:%u:%u ==> %u:%u:%u [%03u]",
107 __entry->prev_pid, __entry->prev_prio, __entry->prev_state,
108 __entry->next_pid, __entry->next_prio, __entry->next_state,
114 * FTRACE_ENTRY_DUP only creates the format file, it will not
115 * create another structure.
117 FTRACE_ENTRY_DUP(wakeup, ctx_switch_entry,
125 F_printk("%u:%u:%u ==+ %u:%u:%u [%03u]",
126 __entry->prev_pid, __entry->prev_prio, __entry->prev_state,
127 __entry->next_pid, __entry->next_prio, __entry->next_state,
133 * Special (free-form) trace entry:
135 FTRACE_ENTRY(special, special_entry,
140 __field( unsigned long, arg1 )
141 __field( unsigned long, arg2 )
142 __field( unsigned long, arg3 )
145 F_printk("(%08lx) (%08lx) (%08lx)",
146 __entry->arg1, __entry->arg2, __entry->arg3)
153 #define FTRACE_STACK_ENTRIES 8
155 FTRACE_ENTRY(kernel_stack, stack_entry,
160 __array( unsigned long, caller, FTRACE_STACK_ENTRIES )
163 F_printk("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
164 "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n",
165 __entry->caller[0], __entry->caller[1], __entry->caller[2],
166 __entry->caller[3], __entry->caller[4], __entry->caller[5],
167 __entry->caller[6], __entry->caller[7])
170 FTRACE_ENTRY(user_stack, userstack_entry,
175 __field( unsigned int, tgid )
176 __array( unsigned long, caller, FTRACE_STACK_ENTRIES )
179 F_printk("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
180 "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n",
181 __entry->caller[0], __entry->caller[1], __entry->caller[2],
182 __entry->caller[3], __entry->caller[4], __entry->caller[5],
183 __entry->caller[6], __entry->caller[7])
187 * trace_printk entry:
189 FTRACE_ENTRY(bprint, bprint_entry,
194 __field( unsigned long, ip )
195 __field( const char *, fmt )
196 __dynamic_array( u32, buf )
199 F_printk("%08lx fmt:%p",
200 __entry->ip, __entry->fmt)
203 FTRACE_ENTRY(print, print_entry,
208 __field( unsigned long, ip )
209 __dynamic_array( char, buf )
213 __entry->ip, __entry->buf)
216 FTRACE_ENTRY(mmiotrace_rw, trace_mmiotrace_rw,
221 __field( struct mmiotrace_rw, rw )
224 F_printk("%lx %lx %lx %d %lx %lx",
225 __entry->phs, __entry->value, __entry->pc,
226 __entry->map_id, __entry->opcode, __entry->width)
229 FTRACE_ENTRY(mmiotrace_map, trace_mmiotrace_map,
234 __field( struct mmiotrace_map, map )
237 F_printk("%lx %lx %lx %d %lx",
238 __entry->phs, __entry->virt, __entry->len,
239 __entry->map_id, __entry->opcode)
242 FTRACE_ENTRY(boot_call, trace_boot_call,
247 __field( struct boot_trace_call, boot_call )
250 F_printk("%d %s", __entry->caller, __entry->func)
253 FTRACE_ENTRY(boot_ret, trace_boot_ret,
258 __field( struct boot_trace_ret, boot_ret )
261 F_printk("%s %d %lx",
262 __entry->func, __entry->result, __entry->duration)
265 #define TRACE_FUNC_SIZE 30
266 #define TRACE_FILE_SIZE 20
268 FTRACE_ENTRY(branch, trace_branch,
273 __field( unsigned int, line )
274 __array( char, func, TRACE_FUNC_SIZE+1 )
275 __array( char, file, TRACE_FILE_SIZE+1 )
276 __field( char, correct )
279 F_printk("%u:%s:%s (%u)",
281 __entry->func, __entry->file, __entry->correct)
284 FTRACE_ENTRY(hw_branch, hw_branch_entry,
293 F_printk("from: %llx to: %llx", __entry->from, __entry->to)
296 FTRACE_ENTRY(power, trace_power,
301 __field( struct power_trace, state_data )
304 F_printk("%llx->%llx type:%u state:%u",
305 __entry->stamp, __entry->end,
306 __entry->type, __entry->state)
309 FTRACE_ENTRY(kmem_alloc, kmemtrace_alloc_entry,
314 __field( enum kmemtrace_type_id, type_id )
315 __field( unsigned long, call_site )
316 __field( const void *, ptr )
317 __field( size_t, bytes_req )
318 __field( size_t, bytes_alloc )
319 __field( gfp_t, gfp_flags )
323 F_printk("type:%u call_site:%lx ptr:%p req:%lu alloc:%lu"
325 __entry->type_id, __entry->call_site, __entry->ptr,
326 __entry->bytes_req, __entry->bytes_alloc,
327 __entry->gfp_flags, __entry->node)
330 FTRACE_ENTRY(kmem_free, kmemtrace_free_entry,
335 __field( enum kmemtrace_type_id, type_id )
336 __field( unsigned long, call_site )
337 __field( const void *, ptr )
340 F_printk("type:%u call_site:%lx ptr:%p",
341 __entry->type_id, __entry->call_site, __entry->ptr)