aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuchi Kandoi <kandoiruchi@google.com>2015-04-17 16:52:54 -0700
committerrogersb11 <brettrogers11@gmail.com>2015-12-02 12:28:59 -0500
commit2ec8bf1130245caf4b9edd97759d120b66bc6c74 (patch)
treecc28ccc5b08d0c6f20d18d51cabc370ada76eed0
parentcaeb5f22c00261ebbc49093473defc6a60c1b1af (diff)
downloadkernel_samsung_smdk4412-2ec8bf1130245caf4b9edd97759d120b66bc6c74.zip
kernel_samsung_smdk4412-2ec8bf1130245caf4b9edd97759d120b66bc6c74.tar.gz
kernel_samsung_smdk4412-2ec8bf1130245caf4b9edd97759d120b66bc6c74.tar.bz2
uid_cputime: Extends the cputime functionality to report power per uid
/proc/uid_cputime/show_uid_stats shows a third field power for each of the uids. It represents the power in the units (uAusec) Bug: 21498425 Change-Id: I52fdc5e59647e9dc97561a26d56f462a2689ba9c Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
-rw-r--r--drivers/misc/uid_cputime.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/misc/uid_cputime.c b/drivers/misc/uid_cputime.c
index 1bcb6d1..ad32727 100644
--- a/drivers/misc/uid_cputime.c
+++ b/drivers/misc/uid_cputime.c
@@ -38,6 +38,8 @@ struct uid_entry {
cputime_t stime;
cputime_t active_utime;
cputime_t active_stime;
+ unsigned long long active_power;
+ unsigned long long power;
struct hlist_node hash;
};
@@ -86,6 +88,7 @@ static int uid_stat_show(struct seq_file *m, void *v)
hash_for_each(hash_table, bkt, node, uid_entry, hash) {
uid_entry->active_stime = 0;
uid_entry->active_utime = 0;
+ uid_entry->active_power = 0;
}
read_lock(&tasklist_lock);
@@ -101,6 +104,7 @@ static int uid_stat_show(struct seq_file *m, void *v)
task_times(task, &utime, &stime);
uid_entry->active_utime += utime;
uid_entry->active_stime += stime;
+ uid_entry->active_power += task->cpu_power;
}
read_unlock(&tasklist_lock);
@@ -109,9 +113,12 @@ static int uid_stat_show(struct seq_file *m, void *v)
uid_entry->active_utime;
cputime_t total_stime = uid_entry->stime +
uid_entry->active_stime;
- seq_printf(m, "%d: %u %u\n", uid_entry->uid,
+ unsigned long long total_power = uid_entry->power +
+ uid_entry->active_power;
+ seq_printf(m, "%d: %u %u %llu\n", uid_entry->uid,
cputime_to_usecs(total_utime),
- cputime_to_usecs(total_stime));
+ cputime_to_usecs(total_stime),
+ total_power);
}
mutex_unlock(&uid_lock);
@@ -204,6 +211,7 @@ static int process_notifier(struct notifier_block *self,
task_times(task, &utime, &stime);
uid_entry->utime += utime;
uid_entry->stime += stime;
+ uid_entry->power += task->cpu_power;
exit:
mutex_unlock(&uid_lock);