From b0ccf5db311522b91cb770ce4c245a3f029b4ad5 Mon Sep 17 00:00:00 2001 From: Jeff Ohlstein Date: Tue, 19 Jun 2012 15:59:46 -0700 Subject: sched_avg: add run queue averaging Add code to calculate the run queue depth of a cpu and iowait depth of the cpu. The scheduler calls in to sched_update_nr_prod whenever there is a runqueue change. This function maintains the runqueue average and the iowait of that cpu in that time interval. Whoever wants to know the runqueue average is expected to call sched_get_nr_running_avg periodically to get the accumulated runqueue and iowait averages for all the cpus. Change-Id: Id8cb2ecf0ed479f090a83ccb72dd59c53fa73e0c Signed-off-by: Jeff Ohlstein (cherry picked from commit 0299fcaaad80e2c0ac9aa583c95107f6edc27750) [rameezmustafa@codeaurora.org: Port to msm-3.18] Signed-off-by: Syed Rameez Mustafa --- include/linux/sched.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/linux') diff --git a/include/linux/sched.h b/include/linux/sched.h index d9879da4b777..3be9ca55987a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -174,6 +174,9 @@ extern unsigned long nr_iowait(void); extern unsigned long nr_iowait_cpu(int cpu); extern void get_iowait_load(unsigned long *nr_waiters, unsigned long *load); +extern void sched_update_nr_prod(int cpu, unsigned long nr, bool inc); +extern void sched_get_nr_running_avg(int *avg, int *iowait_avg); + extern void calc_global_load(unsigned long ticks); #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) -- cgit v1.2.3