diff options
| author | Ruchi Kandoi <kandoiruchi@google.com> | 2015-04-17 16:33:29 -0700 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2016-09-10 16:03:52 +0200 |
| commit | d568ebc24c10a87c465ada70d0009c2f707ef121 (patch) | |
| tree | efc4f6da8217325c5771436735ae189e7d635c6c /include/linux | |
| parent | bbc4c63b8fa5bb5d5e855a65714d9f57a02ac737 (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.
Bug: 21498425
Change-Id: Ic535941e7b339aab5cae9081a34049daeb44b248
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cpufreq.h | 10 | ||||
| -rw-r--r-- | include/linux/sched.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 0ef97797b..0391ce43d 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -17,6 +17,8 @@ #include <linux/threads.h> #include <linux/kobject.h> #include <linux/sysfs.h> +#include <asm/cputime.h> + #include <linux/completion.h> #include <linux/workqueue.h> #include <linux/cpumask.h> @@ -26,7 +28,6 @@ /* Print length for names. Extra 1 space for accomodating '\n' in prints */ #define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1) - /********************************************************************* * CPUFREQ NOTIFIER INTERFACE * *********************************************************************/ @@ -448,4 +449,11 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, void cpufreq_frequency_table_update_policy_cpu(struct cpufreq_policy *policy); void cpufreq_frequency_table_put_attr(unsigned int cpu); + +/********************************************************************* + * 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 9e5800231..0217ec155 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1282,6 +1282,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 |
