mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
BACKPORT: FROMGIT: Binder: Add timestamp to transaction record
This patch adds a timestamp field to the binder_transaction
structure to track the time consumed during transmission
when reading binder_transaction records.
Signed-off-by: Chuang Zhang <zhangchuang3@xiaomi.com>
Acked-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/5ac8c0d09392290be789423f0dd78a520b830fab.1682333709.git.zhangchuang3@xiaomi.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 235773151
(cherry picked from commit 800936191a
git: //git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
char-misc-next)
[cmllamas: resolved minor conflicts with local patches]
Change-Id: If6dab2e9b80c71f9ac3084dc8cf0e519976f55d8
Signed-off-by: Carlos Llamas <cmllamas@google.com>
This commit is contained in:
committed by
Carlos Llamas
parent
d7b3d8d1e5
commit
f00a145958
@@ -66,6 +66,7 @@
|
|||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/task_work.h>
|
#include <linux/task_work.h>
|
||||||
#include <linux/sizes.h>
|
#include <linux/sizes.h>
|
||||||
|
#include <linux/ktime.h>
|
||||||
#include <linux/android_vendor.h>
|
#include <linux/android_vendor.h>
|
||||||
|
|
||||||
#include <uapi/linux/sched/types.h>
|
#include <uapi/linux/sched/types.h>
|
||||||
@@ -3113,6 +3114,7 @@ static void binder_transaction(struct binder_proc *proc,
|
|||||||
binder_size_t last_fixup_min_off = 0;
|
binder_size_t last_fixup_min_off = 0;
|
||||||
struct binder_context *context = proc->context;
|
struct binder_context *context = proc->context;
|
||||||
int t_debug_id = atomic_inc_return(&binder_last_id);
|
int t_debug_id = atomic_inc_return(&binder_last_id);
|
||||||
|
ktime_t t_start_time = ktime_get();
|
||||||
char *secctx = NULL;
|
char *secctx = NULL;
|
||||||
u32 secctx_sz = 0;
|
u32 secctx_sz = 0;
|
||||||
struct list_head sgc_head;
|
struct list_head sgc_head;
|
||||||
@@ -3358,6 +3360,7 @@ static void binder_transaction(struct binder_proc *proc,
|
|||||||
binder_stats_created(BINDER_STAT_TRANSACTION_COMPLETE);
|
binder_stats_created(BINDER_STAT_TRANSACTION_COMPLETE);
|
||||||
|
|
||||||
t->debug_id = t_debug_id;
|
t->debug_id = t_debug_id;
|
||||||
|
t->start_time = t_start_time;
|
||||||
|
|
||||||
if (reply)
|
if (reply)
|
||||||
binder_debug(BINDER_DEBUG_TRANSACTION,
|
binder_debug(BINDER_DEBUG_TRANSACTION,
|
||||||
@@ -6180,18 +6183,20 @@ static void print_binder_transaction_ilocked(struct seq_file *m,
|
|||||||
{
|
{
|
||||||
struct binder_proc *to_proc;
|
struct binder_proc *to_proc;
|
||||||
struct binder_buffer *buffer = t->buffer;
|
struct binder_buffer *buffer = t->buffer;
|
||||||
|
ktime_t current_time = ktime_get();
|
||||||
|
|
||||||
spin_lock(&t->lock);
|
spin_lock(&t->lock);
|
||||||
to_proc = t->to_proc;
|
to_proc = t->to_proc;
|
||||||
seq_printf(m,
|
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,
|
prefix, t->debug_id, t,
|
||||||
t->from ? t->from->proc->pid : 0,
|
t->from ? t->from->proc->pid : 0,
|
||||||
t->from ? t->from->pid : 0,
|
t->from ? t->from->pid : 0,
|
||||||
to_proc ? to_proc->pid : 0,
|
to_proc ? to_proc->pid : 0,
|
||||||
t->to_thread ? t->to_thread->pid : 0,
|
t->to_thread ? t->to_thread->pid : 0,
|
||||||
t->code, t->flags, t->priority.sched_policy,
|
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);
|
spin_unlock(&t->lock);
|
||||||
|
|
||||||
if (proc != to_proc) {
|
if (proc != to_proc) {
|
||||||
|
|||||||
@@ -567,6 +567,7 @@ struct binder_transaction {
|
|||||||
bool set_priority_called;
|
bool set_priority_called;
|
||||||
bool is_nested;
|
bool is_nested;
|
||||||
kuid_t sender_euid;
|
kuid_t sender_euid;
|
||||||
|
ktime_t start_time;
|
||||||
struct list_head fd_fixups;
|
struct list_head fd_fixups;
|
||||||
binder_uintptr_t security_ctx;
|
binder_uintptr_t security_ctx;
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user