]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] export nr_running and nr_iowait tasks in /proc
authorAndrew Morton <akpm@digeo.com>
Tue, 29 Oct 2002 00:22:43 +0000 (16:22 -0800)
committerJens Axboe <axboe@suse.de>
Tue, 29 Oct 2002 00:22:43 +0000 (16:22 -0800)
From Rik.

"this trivial patch, against 2.5-current, exports nr_running and
 nr_iowait_tasks in /proc/stat.  With this patch in vmstat will no
 longer need to walk all the processes in the system just to determine
 the number of running and blocked processes."

fs/proc/proc_misc.c

index cbafa4129498c0f244299342b3e6d0124f2dd65f..42724d37dd73dc5e21b53eea069becea23042c04 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/seq_file.h>
 #include <linux/times.h>
 #include <linux/profile.h>
+#include <linux/blkdev.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -404,10 +405,14 @@ static int kstat_read_proc(char *page, char **start, off_t off,
        len += sprintf(page + len,
                "\nctxt %lu\n"
                "btime %lu\n"
-               "processes %lu\n",
+               "processes %lu\n"
+               "procs_running %lu\n"
+               "procs_blocked %u\n",
                nr_context_switches(),
                xtime.tv_sec - jif / HZ,
-               total_forks);
+               total_forks,
+               nr_running(),
+               atomic_read(&nr_iowait_tasks));
 
        return proc_calc_metrics(page, start, off, count, eof, len);
 }