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 3983753280987d68138ce249232b3d1b775ab1e6)
This commit is contained in:
zhengding chen 2021-06-01 20:59:53 +08:00 committed by Treehugger Robot
parent e6c15792a6
commit fdfaf852cd
3 changed files with 8 additions and 0 deletions

View File

@ -241,4 +241,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmap_region);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_unmap_one);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_acct_update_power);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal);

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)

View File

@ -20,6 +20,10 @@ DECLARE_HOOK(android_vh_freq_table_limits,
unsigned int max_freq),
TP_ARGS(policy, min_freq, max_freq));
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_RESTRICTED_HOOK(android_rvh_cpufreq_transition,
TP_PROTO(struct cpufreq_policy *policy),
TP_ARGS(policy), 1);