Commit eb32911f authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] /proc/stat:btime fix

From: George Anzinger <george@mvista.com>,
      Petri Kaukasoina <kaukasoi@elektroni.ee.tut.fi>

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.
parent 03718ae0
...@@ -360,23 +360,12 @@ int show_stat(struct seq_file *p, void *v) ...@@ -360,23 +360,12 @@ int show_stat(struct seq_file *p, void *v)
{ {
int i; int i;
extern unsigned long total_forks; 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; 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 */ jif = - wall_to_monotonic.tv_sec;
do { if (wall_to_monotonic.tv_nsec)
seq = read_seqbegin(&xtime_lock); --jif;
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);
for_each_cpu(i) { for_each_cpu(i) {
int j; int j;
......
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