[PATCH 3/9] Include nice values in cpuacct

From: Glauber Costa
Date: Wed Sep 14 2011 - 16:06:00 EST


Besides user and system.

Signed-off-by: Glauber Costa <glommer@xxxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/