From eb32911f1d4f9e27e10fa23c0dd500e11d9e6802 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 3 Feb 2004 18:48:03 -0800 Subject: [PATCH] [PATCH] /proc/stat:btime fix From: George Anzinger , Petri Kaukasoina btime in /proc/stat does not stay constant but decreases at a rate of 15 secs/day, because we're assuming that HZ is exactly 100. Use the correct adjustments to fix that up. --- fs/proc/proc_misc.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index f07eb3637cfd4..dcb20c541adda 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c @@ -360,23 +360,12 @@ int show_stat(struct seq_file *p, void *v) { int i; extern unsigned long total_forks; - u64 jif; + unsigned long jif; unsigned int sum = 0, user = 0, nice = 0, system = 0, idle = 0, iowait = 0, irq = 0, softirq = 0; - struct timeval now; - unsigned long seq; - /* Atomically read jiffies and time of day */ - do { - seq = read_seqbegin(&xtime_lock); - - jif = get_jiffies_64(); - do_gettimeofday(&now); - } while (read_seqretry(&xtime_lock, seq)); - - /* calc # of seconds since boot time */ - jif -= INITIAL_JIFFIES; - jif = ((u64)now.tv_sec * HZ) + (now.tv_usec/(1000000/HZ)) - jif; - do_div(jif, HZ); + jif = - wall_to_monotonic.tv_sec; + if (wall_to_monotonic.tv_nsec) + --jif; for_each_cpu(i) { int j; -- 2.53.0