lkml.org 
[lkml]   [2001]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] /proc/uptime on SMP machines
> 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/

\
 
 \ /
  Last update: 2005-03-22 13:29    [W:0.070 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site