lkml.org 
[lkml]   [2011]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/9] Include nice values in cpuacct
Date
Besides user and system.

Signed-off-by: Glauber Costa <glommer@parallels.com>
---
kernel/sched.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 8fd3f8b..93aa666 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1446,6 +1446,7 @@ static const u32 prio_to_wmult[40] = {
/* Time spent by the tasks of the cpu accounting group executing in ... */
enum cpuacct_stat_index {
CPUACCT_STAT_USER, /* ... user mode */
+ CPUACCT_STAT_NICE, /* ... user nice */
CPUACCT_STAT_SYSTEM, /* ... kernel mode */

CPUACCT_STAT_NSTATS,
@@ -3758,6 +3759,7 @@ void account_user_time(struct task_struct *p, cputime_t cputime,
cputime_t cputime_scaled)
{
struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
+ int stat = CPUACCT_STAT_USER;
cputime64_t tmp;

/* Add user time to process. */
@@ -3767,12 +3769,13 @@ void account_user_time(struct task_struct *p, cputime_t cputime,

/* Add user time to cpustat. */
tmp = cputime_to_cputime64(cputime);
- if (TASK_NICE(p) > 0)
+ if (TASK_NICE(p) > 0) {
cpustat->nice = cputime64_add(cpustat->nice, tmp);
- else
+ stat = CPUACCT_STAT_NICE;
+ } else
cpustat->user = cputime64_add(cpustat->user, tmp);

- cpuacct_update_stats(p, CPUACCT_STAT_USER, cputime);
+ cpuacct_update_stats(p, stat, cputime);
/* Account for user time used */
acct_update_integrals(p);
}
--
1.7.6


\
 
 \ /
  Last update: 2011-09-14 22:09    [W:0.249 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site