Phil
--------------------------------------------------------------------------
'The ultimate seal on any software product is not any sort of kite mark or
standards conformance certificate, it's that label that says, "Destruction
tested by Alan Cox.... Survived."' -- Clive Dolphin (3Com PDD)
--- linux/fs/proc/array.c Sun Aug 24 15:58:04 1997
+++ linux/fs/proc/array.c.new Sun Aug 24 14:14:54 1997
@@ -24,10 +24,13 @@
* <Jeff_Tranter@Mitel.COM>
*
* Bruno Haible : remove 4K limit for the maps file
- * <haible@ma2s2.mathematik.uni-karlsruhe.de>
+ * <haible@ma2s2.mathematik.uni-karlsruhe.de>
*
* Yves Arrouye : remove removal of trailing spaces in get_array.
* <Yves.Arrouye@marin.fdn.fr>
+ *
+ * Phil Schwan : added prstcnts line to /proc/stat
+ * <pschwan@apk.net>
*/
#include <linux/types.h>
@@ -193,7 +196,7 @@
static int get_kstat(char * buffer)
{
int i, len;
- unsigned sum = 0;
+ unsigned sleeping=0, zombie=0, stopped=0, running=0, disk_sleep=0, paging=0, sum=0;
extern unsigned long total_forks;
for (i = 0 ; i < NR_IRQS ; i++)
@@ -227,15 +230,44 @@
kstat.pswpin,
kstat.pswpout,
sum);
+ for (i = 1; i < NR_TASKS; i++) {
+ if (task[i] != NULL) {
+ switch(task[i]->state) {
+ case 0:
+ running++;
+ break;
+ case 1:
+ sleeping++;
+ break;
+ case 2:
+ disk_sleep++;
+ break;
+ case 3:
+ zombie++;
+ break;
+ case 4:
+ stopped++;
+ break;
+ case 5:
+ paging++;
+ break;
+ default:
+ /* eh!? */
+ }
+ }
+ }
+
for (i = 0 ; i < NR_IRQS ; i++)
len += sprintf(buffer + len, " %u", kstat.interrupts[i]);
len += sprintf(buffer + len,
"\nctxt %u\n"
"btime %lu\n"
- "processes %lu\n",
+ "processes %lu\n"
+ "prstcnts %u %u %u %u %u %u\n",
kstat.context_swtch,
xtime.tv_sec - jiffies / HZ,
- total_forks);
+ total_forks, running, sleeping, disk_sleep,
+ zombie, stopped, paging);
return len;
}