From c92b19e8e413d2688f0d73bc96cd2fda4f9be746 Mon Sep 17 00:00:00 2001 From: Liujie Xie Date: Mon, 15 May 2023 11:30:56 +0800 Subject: [PATCH] ANDROID: vendor_hooks: Add hooks for account process tick Add a hook in account_process_tick, which help us to get information about the high load task and the cpu they running on. Bug: 183260319 Change-Id: I54162ce3c65bd69e08d2d4747e4d4883efe4c442 Signed-off-by: Liujie Xie --- include/trace/hooks/sched.h | 4 ++++ kernel/sched/cputime.c | 1 + kernel/sched/vendor_hooks.c | 1 + 3 files changed, 6 insertions(+) diff --git a/include/trace/hooks/sched.h b/include/trace/hooks/sched.h index e15ce7aba0f8..355d876e9b25 100644 --- a/include/trace/hooks/sched.h +++ b/include/trace/hooks/sched.h @@ -351,6 +351,10 @@ DECLARE_HOOK(android_vh_account_process_tick_gran, TP_PROTO(int user_tick, int *ticks), TP_ARGS(user_tick, ticks)); +DECLARE_HOOK(android_vh_account_task_time, + TP_PROTO(struct task_struct *p, struct rq *rq, int user_tick, int ticks), + TP_ARGS(p, rq, user_tick, ticks)); + /* macro versions of hooks are no longer required */ #endif /* _TRACE_HOOK_SCHED_H */ diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index 39b570d9464c..5051b63986b4 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -507,6 +507,7 @@ void account_process_tick(struct task_struct *p, int user_tick) if (vtime_accounting_enabled_this_cpu()) return; + trace_android_vh_account_task_time(p, this_rq(), user_tick, ticks); if (sched_clock_irqtime) { irqtime_account_process_tick(p, user_tick, ticks); diff --git a/kernel/sched/vendor_hooks.c b/kernel/sched/vendor_hooks.c index 13009305381c..ac82d6d3a3c6 100644 --- a/kernel/sched/vendor_hooks.c +++ b/kernel/sched/vendor_hooks.c @@ -90,3 +90,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_comm); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_setaffinity_early); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_process_tick_gran); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_task_time);