Commit 27bf8712 authored by Michael Abbott's avatar Michael Abbott Committed by Martin Schwidefsky

[PATCH] Fix idle time field in /proc/uptime

Git commit 79741dd3 changes idle cputime accounting, but unfortunately
the /proc/uptime file hasn't caught up.  Here the idle time calculation
from /proc/stat is copied over.
Signed-off-by: default avatarMichael Abbott <michael.abbott@diamond.ac.uk>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent f234012f
...@@ -4,13 +4,18 @@ ...@@ -4,13 +4,18 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/kernel_stat.h>
#include <asm/cputime.h> #include <asm/cputime.h>
static int uptime_proc_show(struct seq_file *m, void *v) static int uptime_proc_show(struct seq_file *m, void *v)
{ {
struct timespec uptime; struct timespec uptime;
struct timespec idle; struct timespec idle;
cputime_t idletime = cputime_add(init_task.utime, init_task.stime); int i;
cputime_t idletime = cputime_zero;
for_each_possible_cpu(i)
idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle);
do_posix_clock_monotonic_gettime(&uptime); do_posix_clock_monotonic_gettime(&uptime);
monotonic_to_bootbased(&uptime); monotonic_to_bootbased(&uptime);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment