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 <mikey@neuling.org>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Jay Lan <jlan@engr.sgi.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Michael Neuling 2007-10-18 03:06:34 -07:00 committed by Linus Torvalds
parent 898eb71cb1
commit c66f08be7e
8 changed files with 50 additions and 5 deletions

View file

@ -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