ANDROID: binder: Add tracing for binder priority inheritance.
authorMartijn Coenen <maco@google.com>
Mon, 8 May 2017 16:33:22 +0000 (09:33 -0700)
committerDanny Wood <danwood76@gmail.com>
Fri, 8 Nov 2019 12:03:13 +0000 (12:03 +0000)
Bug: 34461621
Change-Id: I5ebb1c0c49fd42a89ee250a1d70221f767c82c7c
Signed-off-by: Martijn Coenen <maco@google.com>
drivers/android/binder.c
drivers/android/binder_trace.h

index 3f29255b1c6641f97dc32287d35d4fa770ca78e7..d163ebcce27ce7e1ce53f7cae219b9b1dedf108e 100644 (file)
@@ -1161,6 +1161,10 @@ static void binder_do_set_priority(struct task_struct *task,
                              task->pid, desired.prio,
                              to_kernel_prio(policy, priority));
 
+       trace_binder_set_priority(task->tgid, task->pid, task->normal_prio,
+                                 to_kernel_prio(policy, priority),
+                                 desired.prio);
+
        /* Set the actual priority */
        if (task->policy != policy || is_rt_policy(policy)) {
                struct sched_param params;
index 7967db16ba5a653d898c097fd0323a23ec918bc0..1e0169796d81966e7bc30874861224b7d92824fe 100644 (file)
@@ -85,6 +85,30 @@ DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_ioctl_done);
 DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_write_done);
 DEFINE_BINDER_FUNCTION_RETURN_EVENT(binder_read_done);
 
+TRACE_EVENT(binder_set_priority,
+       TP_PROTO(int proc, int thread, unsigned int old_prio,
+                unsigned int desired_prio, unsigned int new_prio),
+       TP_ARGS(proc, thread, old_prio, new_prio, desired_prio),
+
+       TP_STRUCT__entry(
+               __field(int, proc)
+               __field(int, thread)
+               __field(unsigned int, old_prio)
+               __field(unsigned int, new_prio)
+               __field(unsigned int, desired_prio)
+       ),
+       TP_fast_assign(
+               __entry->proc = proc;
+               __entry->thread = thread;
+               __entry->old_prio = old_prio;
+               __entry->new_prio = new_prio;
+               __entry->desired_prio = desired_prio;
+       ),
+       TP_printk("proc=%d thread=%d old=%d => new=%d desired=%d",
+                 __entry->proc, __entry->thread, __entry->old_prio,
+                 __entry->new_prio, __entry->desired_prio)
+);
+
 TRACE_EVENT(binder_wait_for_work,
        TP_PROTO(bool proc_work, bool transaction_stack, bool thread_todo),
        TP_ARGS(proc_work, transaction_stack, thread_todo),