From 7b88e5e0bdf25a3c7d7b6efd5caa54cbcdfec861 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 2 Oct 2002 22:58:25 -0700 Subject: [PATCH] "io wait" process accounting Patch from Rik adds "I/O wait" statistics to /proc/stat. This allows us to determine how much system time is being spent awaiting IO completion. This is an important statistic, as it tends to directly subtract from job completion time. procps-2.0.9 is OK with this, but doesn't report it. --- kernel/sched.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'kernel') diff --git a/kernel/sched.c b/kernel/sched.c index aa13d6a55721..d28180b44322 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -866,6 +867,10 @@ void scheduler_tick(int user_ticks, int sys_ticks) /* note: this timer irq context must be accounted for as well */ if (irq_count() - HARDIRQ_OFFSET >= SOFTIRQ_OFFSET) kstat.per_cpu_system[cpu] += sys_ticks; + else if (atomic_read(&nr_iowait_tasks) > 0) + kstat.per_cpu_iowait[cpu] += sys_ticks; + else + kstat.per_cpu_idle[cpu] += sys_ticks; #if CONFIG_SMP idle_tick(rq); #endif -- cgit v1.2.3