aboutsummaryrefslogtreecommitdiff
path: root/kernel/sched
diff options
context:
space:
mode:
authorRuchi Kandoi <kandoiruchi@google.com>2015-04-17 16:33:29 -0700
committerMoyster <oysterized@gmail.com>2016-09-10 16:03:52 +0200
commitd568ebc24c10a87c465ada70d0009c2f707ef121 (patch)
treeefc4f6da8217325c5771436735ae189e7d635c6c /kernel/sched
parentbbc4c63b8fa5bb5d5e855a65714d9f57a02ac737 (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 'kernel/sched')
-rw-r--r--kernel/sched/cputime.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
index c23a8fd36..ee65c82af 100644
--- a/kernel/sched/cputime.c
+++ b/kernel/sched/cputime.c
@@ -1,3 +1,4 @@
+#include <linux/cpufreq.h>
#include <linux/export.h>
#include <linux/sched.h>
#include <linux/tsacct_kern.h>
@@ -149,6 +150,9 @@ void account_user_time(struct task_struct *p, cputime_t cputime,
/* Account for user time used */
acct_account_cputime(p);
+
+ /* Account power usage for user time */
+ acct_update_power(p, cputime);
}
/*
@@ -199,6 +203,9 @@ void __account_system_time(struct task_struct *p, cputime_t cputime,
/* Account for system time used */
acct_account_cputime(p);
+
+ /* Account power usage for system time */
+ acct_update_power(p, cputime);
}
/*