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/sched.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'kernel/sched.c') diff --git a/kernel/sched.c b/kernel/sched.c index 92721d1534b..12534421d7b 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -3333,6 +3333,16 @@ void account_guest_time(struct task_struct *p, cputime_t cputime) cpustat->guest = cputime64_add(cpustat->guest, tmp); } +/* + * Account scaled user cpu time to a process. + * @p: the process that the cpu time gets accounted to + * @cputime: the cpu time spent in user space since the last update + */ +void account_user_time_scaled(struct task_struct *p, cputime_t cputime) +{ + p->utimescaled = cputime_add(p->utimescaled, cputime); +} + /* * Account system cpu time to a process. * @p: the process that the cpu time gets accounted to @@ -3370,6 +3380,17 @@ void account_system_time(struct task_struct *p, int hardirq_offset, acct_update_integrals(p); } +/* + * Account scaled system cpu time to a process. + * @p: the process that the cpu time gets accounted to + * @hardirq_offset: the offset to subtract from hardirq_count() + * @cputime: the cpu time spent in kernel space since the last update + */ +void account_system_time_scaled(struct task_struct *p, cputime_t cputime) +{ + p->stimescaled = cputime_add(p->stimescaled, cputime); +} + /* * Account for involuntary wait time. * @p: the process from which the cpu time has been stolen -- cgit v1.2.3