lkml.org 
[lkml]   [2001]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] /proc/uptime on SMP machines
Hallo,

I didn't see a maintainer for the /proc filesystem, to I send this mail to
linux-kernel for discussion.

At present the idle value in /proc/uptime is only the idle time for the first
processor. With 2.4, processes seam "stickier" for my, and e.g "yes
>/dev/null" on an otherwise idle machine can stay for a long time on one
processor of my (intel) SMP machine. That way, the present output of
/proc/uptime can lead to a wrong conclusion.

Appended patch returns the average of all idle processes an all
processors.

If I don't hear back, I will send to Linus and Alan for inclusion.

Bye

Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de

Free Software: If you contribute nothing, expect nothing
--

--- linux-2.4.2.SuSE/fs/proc/proc_misc.c Thu Mar 15 16:48:04 2001
+++ linux-2.4.2.SuSE-5/fs/proc/proc_misc.c Sat Mar 17 23:11:47 2001
@@ -105,11 +105,15 @@
{
unsigned long uptime;
unsigned long idle;
- int len;
+ int len,i;

uptime = jiffies;
+#ifdef CONFIG_SMP
+ for (idle =0,i = 0; i < smp_num_cpus; i++)
+ idle += (init_tasks[i]->times.tms_utime + init_tasks[i]->times.tms_stime)/smp_num_cpus;
+#else
idle = init_tasks[0]->times.tms_utime + init_tasks[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.
Therefore the identity a = (a / b) * b + a % b is used so that it is
-
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/
\
 
 \ /
  Last update: 2005-03-22 13:29    [W:0.033 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site