show nr_running and nr_iowait_tasks

show nr_running and nr_iowait_tasks

Post by Rik van Rie » Thu, 17 Oct 2002 22:30:05



Hi,

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.

please apply,

Rik
--
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/             http://distro.conectiva.com/

===== fs/proc/proc_misc.c 1.49 vs edited =====
--- 1.49/fs/proc/proc_misc.c    Tue Oct 15 20:32:38 2002

 #include <linux/seq_file.h>
 #include <linux/times.h>
 #include <linux/profile.h>
+#include <linux/blkdev.h>

 #include <asm/uaccess.h>

        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);
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/