lkml.org 
[lkml]   [2008]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] sched: Keep total / count stats in addition to the max for wait time
From: Arjan van de Ven <arjan@linux.intel.com>
Subject: sched: Keep total / count stats in addition to the max for wait time

Right now, the linux kernel (with scheduler statistics enabled) keeps track
of the maximum time a process is waiting to be scheduled. While the maximum
is a very useful metric, tracking average and total is equally useful
(at least for latencytop) to figure out the accumulated effect of scheduler
delays. The accumulated effect is important to judge the performance impact
of scheduler tuning/behavior.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>

---
include/linux/sched.h | 2 ++
kernel/sched_debug.c | 4 ++++
kernel/sched_fair.c | 3 +++
3 files changed, 9 insertions(+)

Index: linux-2.6.24-rc8/include/linux/sched.h
===================================================================
--- linux-2.6.24-rc8.orig/include/linux/sched.h
+++ linux-2.6.24-rc8/include/linux/sched.h
@@ -877,6 +877,8 @@ struct sched_entity {
#ifdef CONFIG_SCHEDSTATS
u64 wait_start;
u64 wait_max;
+ u64 wait_count;
+ u64 wait_sum;

u64 sleep_start;
u64 sleep_max;
Index: linux-2.6.24-rc8/kernel/sched_debug.c
===================================================================
--- linux-2.6.24-rc8.orig/kernel/sched_debug.c
+++ linux-2.6.24-rc8/kernel/sched_debug.c
@@ -299,6 +299,8 @@ void proc_sched_show_task(struct task_st
PN(se.exec_max);
PN(se.slice_max);
PN(se.wait_max);
+ PN(se.wait_sum);
+ P(se.wait_count);
P(sched_info.bkl_count);
P(se.nr_migrations);
P(se.nr_migrations_cold);
@@ -366,6 +368,8 @@ void proc_sched_set_task(struct task_str
{
#ifdef CONFIG_SCHEDSTATS
p->se.wait_max = 0;
+ p->se.wait_sum = 0;
+ p->se.wait_count = 0;
p->se.sleep_max = 0;
p->se.sum_sleep_runtime = 0;
p->se.block_max = 0;
Index: linux-2.6.24-rc8/kernel/sched_fair.c
===================================================================
--- linux-2.6.24-rc8.orig/kernel/sched_fair.c
+++ linux-2.6.24-rc8/kernel/sched_fair.c
@@ -385,6 +385,9 @@ update_stats_wait_end(struct cfs_rq *cfs
{
schedstat_set(se->wait_max, max(se->wait_max,
rq_of(cfs_rq)->clock - se->wait_start));
+ schedstat_set(se->wait_count, se->wait_count + 1);
+ schedstat_set(se->wait_sum, se->wait_sum +
+ rq_of(cfs_rq)->clock - se->wait_start);
schedstat_set(se->wait_start, 0);
}

--
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings,
visit http://www.lesswatts.org


\
 
 \ /
  Last update: 2008-01-21 20:11    [W:0.230 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site