diff options
author | Ruchi Kandoi <kandoiruchi@google.com> | 2015-04-17 16:33:29 -0700 |
---|---|---|
committer | Ruchi Kandoi <kandoiruchi@google.com> | 2015-06-02 11:14:50 -0700 |
commit | e91d3fbfa83b2ab32ffef6fdfd9a244c20e27ffa (patch) | |
tree | b142868583b61d1ccf61a398ca33220435d44ac5 /include | |
parent | 0866f4e30c337714f86bff4638e418ad8c60b11c (diff) |
sched: cpufreq: Adds a field cpu_power in the task_struct
cpu_power has been added to keep track of amount of power each task is
consuming. cpu_power is updated whenever stime and utime are updated for
a task. power is computed by taking into account the frequency at which
the current core was running and the current for cpu actively
running at hat frequency.
Change-Id: Ic535941e7b339aab5cae9081a34049daeb44b248
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/cpufreq.h | 8 | ||||
-rw-r--r-- | include/linux/sched.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index b0d360c87602..a15944d5a06f 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -17,6 +17,8 @@ #include <linux/kobject.h> #include <linux/notifier.h> #include <linux/sysfs.h> +#include <asm/cputime.h> + /********************************************************************* * CPUFREQ INTERFACE * @@ -509,4 +511,10 @@ static inline int cpufreq_generic_exit(struct cpufreq_policy *policy) return 0; } +/********************************************************************* + * CPUFREQ STATS * + *********************************************************************/ + +void acct_update_power(struct task_struct *p, cputime_t cputime); + #endif /* _LINUX_CPUFREQ_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index 37658d063909..6aef9c64c73d 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1290,6 +1290,7 @@ struct task_struct { cputime_t utime, stime, utimescaled, stimescaled; cputime_t gtime; + unsigned long long cpu_power; #ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE struct cputime prev_cputime; #endif |