ANDROID: vendor_hooks: Add hooks for cpufreq_acct_update_power

We want to record the cputime of each running process by adding
hooks for cpufreq_acct_update_power.

Bug: 186604985

Signed-off-by: zhengding chen <chenzhengding@oppo.com>
Change-Id: I35e38be4680781df3338b4a01041922294aecaa0
(cherry picked from commit dd8f1003c5b0c40a6c920488441397cae5ea039c)
This commit is contained in:
zhengding chen
2021-06-01 20:59:53 +08:00
committed by maoshenshen
parent 4e79ee4013
commit 2ce3f8b341
3 changed files with 8 additions and 0 deletions
+1
View File
@@ -245,6 +245,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_hib_resume_bdev);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_futex_plist_add);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_report_bug);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_logbuf);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_acct_update_power);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_logbuf_pr_cont);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_calc_alloc_flags);
+3
View File
@@ -21,6 +21,7 @@
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/threads.h>
#include <trace/hooks/cpufreq.h>
static DEFINE_SPINLOCK(task_time_in_state_lock); /* task->time_in_state */
@@ -146,6 +147,8 @@ void cpufreq_acct_update_power(struct task_struct *p, u64 cputime)
p->time_in_state)
p->time_in_state[state] += cputime;
spin_unlock_irqrestore(&task_time_in_state_lock, flags);
trace_android_vh_cpufreq_acct_update_power(cputime, p, state);
}
static int cpufreq_times_get_index(struct cpu_freqs *freqs, unsigned int freq)
+4
View File
@@ -19,6 +19,10 @@ DECLARE_HOOK(android_vh_cpufreq_online,
TP_PROTO(struct cpufreq_policy *policy),
TP_ARGS(policy));
DECLARE_HOOK(android_vh_cpufreq_acct_update_power,
TP_PROTO(u64 cputime, struct task_struct *p, unsigned int state),
TP_ARGS(cputime, p, state));
DECLARE_HOOK(android_vh_cpufreq_resolve_freq,
TP_PROTO(struct cpufreq_policy *policy, unsigned int *target_freq,
unsigned int old_target_freq),