diff options
author | Michael Neuling <mikey@neuling.org> | 2007-10-18 06:06:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-18 17:37:28 -0400 |
commit | c66f08be7e3ad0a28bcd9a0aef766fdf08ea0ec6 (patch) | |
tree | d147c0a43a66973014d924a6020388a249c509a7 /kernel/sched.c | |
parent | 898eb71cb17644964c5895fb190e79e3d0c49679 (diff) |
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>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 92721d1534b8..12534421d7b5 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3334,6 +3334,16 @@ void account_guest_time(struct task_struct *p, cputime_t cputime) | |||
3334 | } | 3334 | } |
3335 | 3335 | ||
3336 | /* | 3336 | /* |
3337 | * Account scaled user cpu time to a process. | ||
3338 | * @p: the process that the cpu time gets accounted to | ||
3339 | * @cputime: the cpu time spent in user space since the last update | ||
3340 | */ | ||
3341 | void account_user_time_scaled(struct task_struct *p, cputime_t cputime) | ||
3342 | { | ||
3343 | p->utimescaled = cputime_add(p->utimescaled, cputime); | ||
3344 | } | ||
3345 | |||
3346 | /* | ||
3337 | * Account system cpu time to a process. | 3347 | * Account system cpu time to a process. |
3338 | * @p: the process that the cpu time gets accounted to | 3348 | * @p: the process that the cpu time gets accounted to |
3339 | * @hardirq_offset: the offset to subtract from hardirq_count() | 3349 | * @hardirq_offset: the offset to subtract from hardirq_count() |
@@ -3371,6 +3381,17 @@ void account_system_time(struct task_struct *p, int hardirq_offset, | |||
3371 | } | 3381 | } |
3372 | 3382 | ||
3373 | /* | 3383 | /* |
3384 | * Account scaled system cpu time to a process. | ||
3385 | * @p: the process that the cpu time gets accounted to | ||
3386 | * @hardirq_offset: the offset to subtract from hardirq_count() | ||
3387 | * @cputime: the cpu time spent in kernel space since the last update | ||
3388 | */ | ||
3389 | void account_system_time_scaled(struct task_struct *p, cputime_t cputime) | ||
3390 | { | ||
3391 | p->stimescaled = cputime_add(p->stimescaled, cputime); | ||
3392 | } | ||
3393 | |||
3394 | /* | ||
3374 | * Account for involuntary wait time. | 3395 | * Account for involuntary wait time. |
3375 | * @p: the process from which the cpu time has been stolen | 3396 | * @p: the process from which the cpu time has been stolen |
3376 | * @steal: the cpu time spent in involuntary wait | 3397 | * @steal: the cpu time spent in involuntary wait |