reduce wakeups from smart scheduler

The smart scheduler itimer currently always fires after each request
(which in turn causes the CPU to wake out of idle, burning precious
power). Rather than doing this, just stop the timer before going into
the select() portion of the WaitFor loop. It's a cheap system call, and
it will only get called if there's no more commands batched up from the
active fd.

This change also allows some of the functions to be simplified;
setitimer() will only fail if it's passed invalid data, and we don't do
that... so make it void and remove all the conditional code that deals
with failure.

The change also allows us to remove a few variables that were used for
housekeeping between the signal handler and the main loop.

Signed-off-by: Keith Packard <keithp@koto.keithp.com>
This commit is contained in:
Arjan van de Ven
2007-10-28 09:37:52 +01:00
committed by Keith Packard
parent 692654b430
commit 2338d5c991
3 changed files with 8 additions and 37 deletions

View File

@@ -150,11 +150,9 @@ extern long SmartScheduleTime;
extern long SmartScheduleInterval;
extern long SmartScheduleSlice;
extern long SmartScheduleMaxSlice;
extern unsigned long SmartScheduleIdleCount;
extern Bool SmartScheduleDisable;
extern Bool SmartScheduleIdle;
extern Bool SmartScheduleTimerStopped;
extern Bool SmartScheduleStartTimer(void);
extern void SmartScheduleStartTimer(void);
extern void SmartScheduleStopTimer(void);
#define SMART_MAX_PRIORITY (20)
#define SMART_MIN_PRIORITY (-20)