WIP FPC-III support
[linux/fpc-iii.git] / drivers / android / binder_trace.h
blob8eeccdc64724b12b18e63a3ebfff8edf0c733ecb
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2012 Google, Inc.
4 */
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM binder
9 #if !defined(_BINDER_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define _BINDER_TRACE_H
12 #include <linux/tracepoint.h>
14 struct binder_buffer;
15 struct binder_node;
16 struct binder_proc;
17 struct binder_alloc;
18 struct binder_ref_data;
19 struct binder_thread;
20 struct binder_transaction;
22 TRACE_EVENT(binder_ioctl,
23 TP_PROTO(unsigned int cmd, unsigned long arg),
24 TP_ARGS(cmd, arg),
26 TP_STRUCT__entry(
27 __field(unsigned int, cmd)
28 __field(unsigned long, arg)
30 TP_fast_assign(
31 __entry->cmd = cmd;
32 __entry->arg = arg;
34 TP_printk("cmd=0x%x arg=0x%lx", __entry->cmd, __entry->arg)
37 DECLARE_EVENT_CLASS(binder_lock_class,
38 TP_PROTO(const char *tag),
39 TP_ARGS(tag),
40 TP_STRUCT__entry(
41 __field(const char *, tag)
43 TP_fast_assign(
44 __entry->tag = tag;
46 TP_printk("tag=%s", __entry->tag)
49 #define DEFINE_BINDER_LOCK_EVENT(name) \
50 DEFINE_EVENT(binder_lock_class, name, \
51 TP_PROTO(const char *func), \
52 TP_ARGS(func))
54 DEFINE_BINDER_LOCK_EVENT(binder_lock);
55 DEFINE_BINDER_LOCK_EVENT(binder_locked);
56 DEFINE_BINDER_LOCK_EVENT(binder_unlock);
58 DECLARE_EVENT_CLASS(binder_function_return_class,
59 TP_PROTO(int ret),
60 TP_ARGS(ret),
61 TP_STRUCT__entry(
62 __field(int, ret)
64 TP_fast_assign(
65 __entry->ret = ret;
67 TP_printk("ret=%d", __entry->ret)
70 #define DEFINE_BINDER_FUNCTION_RETURN_EVENT(name) \
71 DEFINE_EVENT(binder_function_return_class, name, \
72 TP_PROTO(int ret), \
73 TP_ARGS(ret))
75 DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_ioctl_done);
76 DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_write_done);
77 DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_read_done);
79 TRACE_EVENT(binder_wait_for_work,
80 TP_PROTO(bool proc_work, bool transaction_stack, bool thread_todo),
81 TP_ARGS(proc_work, transaction_stack, thread_todo),
83 TP_STRUCT__entry(
84 __field(bool, proc_work)
85 __field(bool, transaction_stack)
86 __field(bool, thread_todo)
88 TP_fast_assign(
89 __entry->proc_work = proc_work;
90 __entry->transaction_stack = transaction_stack;
91 __entry->thread_todo = thread_todo;
93 TP_printk("proc_work=%d transaction_stack=%d thread_todo=%d",
94 __entry->proc_work, __entry->transaction_stack,
95 __entry->thread_todo)
98 TRACE_EVENT(binder_txn_latency_free,
99 TP_PROTO(struct binder_transaction *t,
100 int from_proc, int from_thread,
101 int to_proc, int to_thread),
102 TP_ARGS(t, from_proc, from_thread, to_proc, to_thread),
103 TP_STRUCT__entry(
104 __field(int, debug_id)
105 __field(int, from_proc)
106 __field(int, from_thread)
107 __field(int, to_proc)
108 __field(int, to_thread)
109 __field(unsigned int, code)
110 __field(unsigned int, flags)
112 TP_fast_assign(
113 __entry->debug_id = t->debug_id;
114 __entry->from_proc = from_proc;
115 __entry->from_thread = from_thread;
116 __entry->to_proc = to_proc;
117 __entry->to_thread = to_thread;
118 __entry->code = t->code;
119 __entry->flags = t->flags;
121 TP_printk("transaction=%d from %d:%d to %d:%d flags=0x%x code=0x%x",
122 __entry->debug_id, __entry->from_proc, __entry->from_thread,
123 __entry->to_proc, __entry->to_thread, __entry->code,
124 __entry->flags)
127 TRACE_EVENT(binder_transaction,
128 TP_PROTO(bool reply, struct binder_transaction *t,
129 struct binder_node *target_node),
130 TP_ARGS(reply, t, target_node),
131 TP_STRUCT__entry(
132 __field(int, debug_id)
133 __field(int, target_node)
134 __field(int, to_proc)
135 __field(int, to_thread)
136 __field(int, reply)
137 __field(unsigned int, code)
138 __field(unsigned int, flags)
140 TP_fast_assign(
141 __entry->debug_id = t->debug_id;
142 __entry->target_node = target_node ? target_node->debug_id : 0;
143 __entry->to_proc = t->to_proc->pid;
144 __entry->to_thread = t->to_thread ? t->to_thread->pid : 0;
145 __entry->reply = reply;
146 __entry->code = t->code;
147 __entry->flags = t->flags;
149 TP_printk("transaction=%d dest_node=%d dest_proc=%d dest_thread=%d reply=%d flags=0x%x code=0x%x",
150 __entry->debug_id, __entry->target_node,
151 __entry->to_proc, __entry->to_thread,
152 __entry->reply, __entry->flags, __entry->code)
155 TRACE_EVENT(binder_transaction_received,
156 TP_PROTO(struct binder_transaction *t),
157 TP_ARGS(t),
159 TP_STRUCT__entry(
160 __field(int, debug_id)
162 TP_fast_assign(
163 __entry->debug_id = t->debug_id;
165 TP_printk("transaction=%d", __entry->debug_id)
168 TRACE_EVENT(binder_transaction_node_to_ref,
169 TP_PROTO(struct binder_transaction *t, struct binder_node *node,
170 struct binder_ref_data *rdata),
171 TP_ARGS(t, node, rdata),
173 TP_STRUCT__entry(
174 __field(int, debug_id)
175 __field(int, node_debug_id)
176 __field(binder_uintptr_t, node_ptr)
177 __field(int, ref_debug_id)
178 __field(uint32_t, ref_desc)
180 TP_fast_assign(
181 __entry->debug_id = t->debug_id;
182 __entry->node_debug_id = node->debug_id;
183 __entry->node_ptr = node->ptr;
184 __entry->ref_debug_id = rdata->debug_id;
185 __entry->ref_desc = rdata->desc;
187 TP_printk("transaction=%d node=%d src_ptr=0x%016llx ==> dest_ref=%d dest_desc=%d",
188 __entry->debug_id, __entry->node_debug_id,
189 (u64)__entry->node_ptr,
190 __entry->ref_debug_id, __entry->ref_desc)
193 TRACE_EVENT(binder_transaction_ref_to_node,
194 TP_PROTO(struct binder_transaction *t, struct binder_node *node,
195 struct binder_ref_data *rdata),
196 TP_ARGS(t, node, rdata),
198 TP_STRUCT__entry(
199 __field(int, debug_id)
200 __field(int, ref_debug_id)
201 __field(uint32_t, ref_desc)
202 __field(int, node_debug_id)
203 __field(binder_uintptr_t, node_ptr)
205 TP_fast_assign(
206 __entry->debug_id = t->debug_id;
207 __entry->ref_debug_id = rdata->debug_id;
208 __entry->ref_desc = rdata->desc;
209 __entry->node_debug_id = node->debug_id;
210 __entry->node_ptr = node->ptr;
212 TP_printk("transaction=%d node=%d src_ref=%d src_desc=%d ==> dest_ptr=0x%016llx",
213 __entry->debug_id, __entry->node_debug_id,
214 __entry->ref_debug_id, __entry->ref_desc,
215 (u64)__entry->node_ptr)
218 TRACE_EVENT(binder_transaction_ref_to_ref,
219 TP_PROTO(struct binder_transaction *t, struct binder_node *node,
220 struct binder_ref_data *src_ref,
221 struct binder_ref_data *dest_ref),
222 TP_ARGS(t, node, src_ref, dest_ref),
224 TP_STRUCT__entry(
225 __field(int, debug_id)
226 __field(int, node_debug_id)
227 __field(int, src_ref_debug_id)
228 __field(uint32_t, src_ref_desc)
229 __field(int, dest_ref_debug_id)
230 __field(uint32_t, dest_ref_desc)
232 TP_fast_assign(
233 __entry->debug_id = t->debug_id;
234 __entry->node_debug_id = node->debug_id;
235 __entry->src_ref_debug_id = src_ref->debug_id;
236 __entry->src_ref_desc = src_ref->desc;
237 __entry->dest_ref_debug_id = dest_ref->debug_id;
238 __entry->dest_ref_desc = dest_ref->desc;
240 TP_printk("transaction=%d node=%d src_ref=%d src_desc=%d ==> dest_ref=%d dest_desc=%d",
241 __entry->debug_id, __entry->node_debug_id,
242 __entry->src_ref_debug_id, __entry->src_ref_desc,
243 __entry->dest_ref_debug_id, __entry->dest_ref_desc)
246 TRACE_EVENT(binder_transaction_fd_send,
247 TP_PROTO(struct binder_transaction *t, int fd, size_t offset),
248 TP_ARGS(t, fd, offset),
250 TP_STRUCT__entry(
251 __field(int, debug_id)
252 __field(int, fd)
253 __field(size_t, offset)
255 TP_fast_assign(
256 __entry->debug_id = t->debug_id;
257 __entry->fd = fd;
258 __entry->offset = offset;
260 TP_printk("transaction=%d src_fd=%d offset=%zu",
261 __entry->debug_id, __entry->fd, __entry->offset)
264 TRACE_EVENT(binder_transaction_fd_recv,
265 TP_PROTO(struct binder_transaction *t, int fd, size_t offset),
266 TP_ARGS(t, fd, offset),
268 TP_STRUCT__entry(
269 __field(int, debug_id)
270 __field(int, fd)
271 __field(size_t, offset)
273 TP_fast_assign(
274 __entry->debug_id = t->debug_id;
275 __entry->fd = fd;
276 __entry->offset = offset;
278 TP_printk("transaction=%d dest_fd=%d offset=%zu",
279 __entry->debug_id, __entry->fd, __entry->offset)
282 DECLARE_EVENT_CLASS(binder_buffer_class,
283 TP_PROTO(struct binder_buffer *buf),
284 TP_ARGS(buf),
285 TP_STRUCT__entry(
286 __field(int, debug_id)
287 __field(size_t, data_size)
288 __field(size_t, offsets_size)
289 __field(size_t, extra_buffers_size)
291 TP_fast_assign(
292 __entry->debug_id = buf->debug_id;
293 __entry->data_size = buf->data_size;
294 __entry->offsets_size = buf->offsets_size;
295 __entry->extra_buffers_size = buf->extra_buffers_size;
297 TP_printk("transaction=%d data_size=%zd offsets_size=%zd extra_buffers_size=%zd",
298 __entry->debug_id, __entry->data_size, __entry->offsets_size,
299 __entry->extra_buffers_size)
302 DEFINE_EVENT(binder_buffer_class, binder_transaction_alloc_buf,
303 TP_PROTO(struct binder_buffer *buffer),
304 TP_ARGS(buffer));
306 DEFINE_EVENT(binder_buffer_class, binder_transaction_buffer_release,
307 TP_PROTO(struct binder_buffer *buffer),
308 TP_ARGS(buffer));
310 DEFINE_EVENT(binder_buffer_class, binder_transaction_failed_buffer_release,
311 TP_PROTO(struct binder_buffer *buffer),
312 TP_ARGS(buffer));
314 TRACE_EVENT(binder_update_page_range,
315 TP_PROTO(struct binder_alloc *alloc, bool allocate,
316 void __user *start, void __user *end),
317 TP_ARGS(alloc, allocate, start, end),
318 TP_STRUCT__entry(
319 __field(int, proc)
320 __field(bool, allocate)
321 __field(size_t, offset)
322 __field(size_t, size)
324 TP_fast_assign(
325 __entry->proc = alloc->pid;
326 __entry->allocate = allocate;
327 __entry->offset = start - alloc->buffer;
328 __entry->size = end - start;
330 TP_printk("proc=%d allocate=%d offset=%zu size=%zu",
331 __entry->proc, __entry->allocate,
332 __entry->offset, __entry->size)
335 DECLARE_EVENT_CLASS(binder_lru_page_class,
336 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
337 TP_ARGS(alloc, page_index),
338 TP_STRUCT__entry(
339 __field(int, proc)
340 __field(size_t, page_index)
342 TP_fast_assign(
343 __entry->proc = alloc->pid;
344 __entry->page_index = page_index;
346 TP_printk("proc=%d page_index=%zu",
347 __entry->proc, __entry->page_index)
350 DEFINE_EVENT(binder_lru_page_class, binder_alloc_lru_start,
351 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
352 TP_ARGS(alloc, page_index));
354 DEFINE_EVENT(binder_lru_page_class, binder_alloc_lru_end,
355 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
356 TP_ARGS(alloc, page_index));
358 DEFINE_EVENT(binder_lru_page_class, binder_free_lru_start,
359 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
360 TP_ARGS(alloc, page_index));
362 DEFINE_EVENT(binder_lru_page_class, binder_free_lru_end,
363 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
364 TP_ARGS(alloc, page_index));
366 DEFINE_EVENT(binder_lru_page_class, binder_alloc_page_start,
367 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
368 TP_ARGS(alloc, page_index));
370 DEFINE_EVENT(binder_lru_page_class, binder_alloc_page_end,
371 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
372 TP_ARGS(alloc, page_index));
374 DEFINE_EVENT(binder_lru_page_class, binder_unmap_user_start,
375 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
376 TP_ARGS(alloc, page_index));
378 DEFINE_EVENT(binder_lru_page_class, binder_unmap_user_end,
379 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
380 TP_ARGS(alloc, page_index));
382 DEFINE_EVENT(binder_lru_page_class, binder_unmap_kernel_start,
383 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
384 TP_ARGS(alloc, page_index));
386 DEFINE_EVENT(binder_lru_page_class, binder_unmap_kernel_end,
387 TP_PROTO(const struct binder_alloc *alloc, size_t page_index),
388 TP_ARGS(alloc, page_index));
390 TRACE_EVENT(binder_command,
391 TP_PROTO(uint32_t cmd),
392 TP_ARGS(cmd),
393 TP_STRUCT__entry(
394 __field(uint32_t, cmd)
396 TP_fast_assign(
397 __entry->cmd = cmd;
399 TP_printk("cmd=0x%x %s",
400 __entry->cmd,
401 _IOC_NR(__entry->cmd) < ARRAY_SIZE(binder_command_strings) ?
402 binder_command_strings[_IOC_NR(__entry->cmd)] :
403 "unknown")
406 TRACE_EVENT(binder_return,
407 TP_PROTO(uint32_t cmd),
408 TP_ARGS(cmd),
409 TP_STRUCT__entry(
410 __field(uint32_t, cmd)
412 TP_fast_assign(
413 __entry->cmd = cmd;
415 TP_printk("cmd=0x%x %s",
416 __entry->cmd,
417 _IOC_NR(__entry->cmd) < ARRAY_SIZE(binder_return_strings) ?
418 binder_return_strings[_IOC_NR(__entry->cmd)] :
419 "unknown")
422 #endif /* _BINDER_TRACE_H */
424 #undef TRACE_INCLUDE_PATH
425 #undef TRACE_INCLUDE_FILE
426 #define TRACE_INCLUDE_PATH .
427 #define TRACE_INCLUDE_FILE binder_trace
428 #include <trace/define_trace.h>