public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] sched: Keep total / count stats in addition to the max for wait time
@ 2008-01-21 19:08 Arjan van de Ven
  2008-01-22 21:06 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Arjan van de Ven @ 2008-01-21 19:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] sched: Keep total / count stats in addition to the max for wait time
  2008-01-21 19:08 [patch] sched: Keep total / count stats in addition to the max for wait time Arjan van de Ven
@ 2008-01-22 21:06 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-01-22 21:06 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel


* Arjan van de Ven <arjan@infradead.org> wrote:

> 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.

thanks, applied to sched-devel.git.

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-22 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-21 19:08 [patch] sched: Keep total / count stats in addition to the max for wait time Arjan van de Ven
2008-01-22 21:06 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox