Re: [PATCH] /proc/uptime on SMP machines

Tim Moore (timothymoore@bigfoot.com)
Sat, 17 Mar 2001 19:41:12 -0800


> Same for 2.2.19p17

except that init_tasks is a 2.4 struc. Corrected as below.

rgds,
tim

--- 2.2.19pre17/fs/proc/array.c.old Fri Mar 16 04:09:41 2001
+++ 2.2.19pre17/fs/proc/array.c.idle Sat Mar 17 19:35:36 2001
@@ -339,9 +339,16 @@
{
unsigned long uptime;
unsigned long idle;
+ int i;

uptime = jiffies;
+#ifdef CONFIG_SMP
+ for (idle =0,i = 0; i < smp_num_cpus; i++)
+ idle += (task[i]->times.tms_utime +
+ task[i]->times.tms_stime)/smp_num_cpus;
+#else
idle = task[0]->times.tms_utime + task[0]->times.tms_stime;
+#endif

/* The formula for the fraction parts really is ((t * 100) / HZ) % 100, but
that would overflow about every five days at HZ == 100.

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