Commit 43c8cc21 authored by Andrew Morton's avatar Andrew Morton Committed by Jens Axboe

[PATCH] export nr_running and nr_iowait tasks in /proc

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."
parent 7d196748
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/times.h> #include <linux/times.h>
#include <linux/profile.h> #include <linux/profile.h>
#include <linux/blkdev.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
...@@ -404,10 +405,14 @@ static int kstat_read_proc(char *page, char **start, off_t off, ...@@ -404,10 +405,14 @@ static int kstat_read_proc(char *page, char **start, off_t off,
len += sprintf(page + len, len += sprintf(page + len,
"\nctxt %lu\n" "\nctxt %lu\n"
"btime %lu\n" "btime %lu\n"
"processes %lu\n", "processes %lu\n"
"procs_running %lu\n"
"procs_blocked %u\n",
nr_context_switches(), nr_context_switches(),
xtime.tv_sec - jif / HZ, 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); return proc_calc_metrics(page, start, off, count, eof, len);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment