diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 6a51c7ad3fc8..b1743461fdc4 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -66,6 +66,7 @@ #include #include #include +#include #include #include @@ -3121,6 +3122,7 @@ static void binder_transaction(struct binder_proc *proc, binder_size_t last_fixup_min_off = 0; struct binder_context *context = proc->context; int t_debug_id = atomic_inc_return(&binder_last_id); + ktime_t t_start_time = ktime_get(); char *secctx = NULL; u32 secctx_sz = 0; bool is_nested = false; @@ -3351,6 +3353,7 @@ static void binder_transaction(struct binder_proc *proc, binder_stats_created(BINDER_STAT_TRANSACTION_COMPLETE); t->debug_id = t_debug_id; + t->start_time = t_start_time; if (reply) binder_debug(BINDER_DEBUG_TRANSACTION, @@ -6145,19 +6148,21 @@ static void print_binder_transaction_ilocked(struct seq_file *m, { struct binder_proc *to_proc; struct binder_buffer *buffer = t->buffer; + ktime_t current_time = ktime_get(); spin_lock(&t->lock); trace_android_vh_binder_print_transaction_info(m, proc, prefix, t); to_proc = t->to_proc; seq_printf(m, - "%s %d: %pK from %d:%d to %d:%d code %x flags %x pri %d:%d r%d", + "%s %d: %pK from %d:%d to %d:%d code %x flags %x pri %d:%d r%d elapsed %lldms", prefix, t->debug_id, t, t->from ? t->from->proc->pid : 0, t->from ? t->from->pid : 0, to_proc ? to_proc->pid : 0, t->to_thread ? t->to_thread->pid : 0, t->code, t->flags, t->priority.sched_policy, - t->priority.prio, t->need_reply); + t->priority.prio, t->need_reply, + ktime_ms_delta(current_time, t->start_time)); spin_unlock(&t->lock); if (proc != to_proc) { diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_internal.h index ac97ecdc2f9f..87dbe401680a 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -568,6 +568,7 @@ struct binder_transaction { bool set_priority_called; bool is_nested; kuid_t sender_euid; + ktime_t start_time; struct list_head fd_fixups; binder_uintptr_t security_ctx; /**