From c66f08be7e3ad0a28bcd9a0aef766fdf08ea0ec6 Mon Sep 17 00:00:00 2001 From: Michael Neuling Date: Thu, 18 Oct 2007 03:06:34 -0700 Subject: Add scaled time to taskstats based process accounting This adds items to the taststats struct to account for user and system time based on scaling the CPU frequency and instruction issue rates. Adds account_(user|system)_time_scaled callbacks which architectures can use to account for time using this mechanism. Signed-off-by: Michael Neuling Cc: Balbir Singh Cc: Jay Lan Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/delayacct.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'kernel/delayacct.c') diff --git a/kernel/delayacct.c b/kernel/delayacct.c index 09e9574eeb2..10e43fd8b72 100644 --- a/kernel/delayacct.c +++ b/kernel/delayacct.c @@ -115,6 +115,12 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk) tmp += timespec_to_ns(&ts); d->cpu_run_real_total = (tmp < (s64)d->cpu_run_real_total) ? 0 : tmp; + tmp = (s64)d->cpu_scaled_run_real_total; + cputime_to_timespec(tsk->utimescaled + tsk->stimescaled, &ts); + tmp += timespec_to_ns(&ts); + d->cpu_scaled_run_real_total = + (tmp < (s64)d->cpu_scaled_run_real_total) ? 0 : tmp; + /* * No locking available for sched_info (and too expensive to add one) * Mitigate by taking snapshot of values -- cgit v1.2.3