tracing: new format for specialized trace points
[linux-2.6.git] / kernel / trace / trace_event_types.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM    ftrace
3
4 /*
5  * We cheat and use the proto type field as the ID
6  * and args as the entry type (minus 'struct')
7  */
8 TRACE_EVENT_FORMAT(function, TRACE_FN, ftrace_entry, ignore,
9         TRACE_STRUCT(
10                 TRACE_FIELD(unsigned long, ip, ip)
11                 TRACE_FIELD(unsigned long, parent_ip, parent_ip)
12         ),
13         TP_RAW_FMT(" %lx <-- %lx")
14 );
15
16 TRACE_EVENT_FORMAT(funcgraph_entry, TRACE_GRAPH_ENT,
17                    ftrace_graph_ent_entry, ignore,
18         TRACE_STRUCT(
19                 TRACE_FIELD(unsigned long, graph_ent.func, func)
20                 TRACE_FIELD(int, graph_ent.depth, depth)
21         ),
22         TP_RAW_FMT("--> %lx (%d)")
23 );
24
25 TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET,
26                    ftrace_graph_ret_entry, ignore,
27         TRACE_STRUCT(
28                 TRACE_FIELD(unsigned long, ret.func, func)
29                 TRACE_FIELD(int, ret.depth, depth)
30         ),
31         TP_RAW_FMT("<-- %lx (%d)")
32 );
33
34 TRACE_EVENT_FORMAT(wakeup, TRACE_WAKE, ctx_switch_entry, ignore,
35         TRACE_STRUCT(
36                 TRACE_FIELD(unsigned int, prev_pid, prev_pid)
37                 TRACE_FIELD(unsigned char, prev_prio, prev_prio)
38                 TRACE_FIELD(unsigned char, prev_state, prev_state)
39                 TRACE_FIELD(unsigned int, next_pid, next_pid)
40                 TRACE_FIELD(unsigned char, next_prio, next_prio)
41                 TRACE_FIELD(unsigned char, next_state, next_state)
42                 TRACE_FIELD(unsigned int, next_cpu, next_cpu)
43         ),
44         TP_RAW_FMT("%u:%u:%u  ==+ %u:%u:%u [%03u]")
45 );
46
47 TRACE_EVENT_FORMAT(context_switch, TRACE_CTX, ctx_switch_entry, ignore,
48         TRACE_STRUCT(
49                 TRACE_FIELD(unsigned int, prev_pid, prev_pid)
50                 TRACE_FIELD(unsigned char, prev_prio, prev_prio)
51                 TRACE_FIELD(unsigned char, prev_state, prev_state)
52                 TRACE_FIELD(unsigned int, next_pid, next_pid)
53                 TRACE_FIELD(unsigned char, next_prio, next_prio)
54                 TRACE_FIELD(unsigned char, next_state, next_state)
55                 TRACE_FIELD(unsigned int, next_cpu, next_cpu)
56         ),
57         TP_RAW_FMT("%u:%u:%u  ==+ %u:%u:%u [%03u]")
58 );
59
60 TRACE_EVENT_FORMAT(special, TRACE_SPECIAL, special_entry, ignore,
61         TRACE_STRUCT(
62                 TRACE_FIELD(unsigned long, arg1, arg1)
63                 TRACE_FIELD(unsigned long, arg2, arg2)
64                 TRACE_FIELD(unsigned long, arg3, arg3)
65         ),
66         TP_RAW_FMT("(%08lx) (%08lx) (%08lx)")
67 );
68
69 /*
70  * Stack-trace entry:
71  */
72
73 /* #define FTRACE_STACK_ENTRIES   8 */
74
75 TRACE_EVENT_FORMAT(kernel_stack, TRACE_STACK, stack_entry, ignore,
76         TRACE_STRUCT(
77                 TRACE_FIELD(unsigned long, caller[0], stack0)
78                 TRACE_FIELD(unsigned long, caller[1], stack1)
79                 TRACE_FIELD(unsigned long, caller[2], stack2)
80                 TRACE_FIELD(unsigned long, caller[3], stack3)
81                 TRACE_FIELD(unsigned long, caller[4], stack4)
82                 TRACE_FIELD(unsigned long, caller[5], stack5)
83                 TRACE_FIELD(unsigned long, caller[6], stack6)
84                 TRACE_FIELD(unsigned long, caller[7], stack7)
85         ),
86         TP_RAW_FMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
87                  "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n")
88 );
89
90 TRACE_EVENT_FORMAT(user_stack, TRACE_USER_STACK, userstack_entry, ignore,
91         TRACE_STRUCT(
92                 TRACE_FIELD(unsigned long, caller[0], stack0)
93                 TRACE_FIELD(unsigned long, caller[1], stack1)
94                 TRACE_FIELD(unsigned long, caller[2], stack2)
95                 TRACE_FIELD(unsigned long, caller[3], stack3)
96                 TRACE_FIELD(unsigned long, caller[4], stack4)
97                 TRACE_FIELD(unsigned long, caller[5], stack5)
98                 TRACE_FIELD(unsigned long, caller[6], stack6)
99                 TRACE_FIELD(unsigned long, caller[7], stack7)
100         ),
101         TP_RAW_FMT("\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n"
102                  "\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n\t=> (%08lx)\n")
103 );
104
105 TRACE_EVENT_FORMAT(print, TRACE_PRINT, print_entry, ignore,
106         TRACE_STRUCT(
107                 TRACE_FIELD(unsigned long, ip, ip)
108                 TRACE_FIELD(unsigned int, depth, depth)
109                 TRACE_FIELD(char *, fmt, fmt)
110                 TRACE_FIELD_ZERO_CHAR(buf)
111         ),
112         TP_RAW_FMT("%08lx (%d) fmt:%p %s")
113 );
114
115 TRACE_EVENT_FORMAT(branch, TRACE_BRANCH, trace_branch, ignore,
116         TRACE_STRUCT(
117                 TRACE_FIELD(unsigned int, line, line)
118                 TRACE_FIELD_SPECIAL(char func[TRACE_FUNC_SIZE+1], func, func)
119                 TRACE_FIELD_SPECIAL(char file[TRACE_FUNC_SIZE+1], file, file)
120                 TRACE_FIELD(char, correct, correct)
121         ),
122         TP_RAW_FMT("%u:%s:%s (%u)")
123 );
124
125 TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore,
126         TRACE_STRUCT(
127                 TRACE_FIELD(u64, from, from)
128                 TRACE_FIELD(u64, to, to)
129         ),
130         TP_RAW_FMT("from: %llx to: %llx")
131 );
132
133 TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore,
134         TRACE_STRUCT(
135                 TRACE_FIELD(ktime_t, state_data.stamp, stamp)
136                 TRACE_FIELD(ktime_t, state_data.end, end)
137                 TRACE_FIELD(int, state_data.type, type)
138                 TRACE_FIELD(int, state_data.state, state)
139         ),
140         TP_RAW_FMT("%llx->%llx type:%u state:%u")
141 );
142
143 TRACE_EVENT_FORMAT(kmem_alloc, TRACE_KMEM_ALLOC, kmemtrace_alloc_entry, ignore,
144         TRACE_STRUCT(
145                 TRACE_FIELD(enum kmemtrace_type_id, type_id, type_id)
146                 TRACE_FIELD(unsigned long, call_site, call_site)
147                 TRACE_FIELD(const void *, ptr, ptr)
148                 TRACE_FIELD(size_t, bytes_req, bytes_req)
149                 TRACE_FIELD(size_t, bytes_alloc, bytes_alloc)
150                 TRACE_FIELD(gfp_t, gfp_flags, gfp_flags)
151                 TRACE_FIELD(int, node, node)
152         ),
153         TP_RAW_FMT("type:%u call_site:%lx ptr:%p req:%lu alloc:%lu"
154                  " flags:%x node:%d")
155 );
156
157 TRACE_EVENT_FORMAT(kmem_free, TRACE_KMEM_FREE, kmemtrace_free_entry, ignore,
158         TRACE_STRUCT(
159                 TRACE_FIELD(enum kmemtrace_type_id, type_id, type_id)
160                 TRACE_FIELD(unsigned long, call_site, call_site)
161                 TRACE_FIELD(const void *, ptr, ptr)
162         ),
163         TP_RAW_FMT("type:%u call_site:%lx ptr:%p")
164 );
165
166 #undef TRACE_SYSTEM