TimerHandler Class Reference

#include <TimerHandler.h>

Inheritance diagram for TimerHandler:

Inheritance graph
[legend]

List of all members.


Detailed Description

base class for timers which can be scheduled with the scheduler

Definition at line 11 of file TimerHandler.h.


Public Member Functions

 TimerHandler (std::string desc="")
 Timers are constructed with a description string, so you can ask them what timer they are.
void fire ()
 called by the scheduler to fire the timer
uint64_t schedule (uint64_t time, bool abs=false, bool align=false)
 call this on the timer handler to schedule it with the scheduler
void cancel ()
 used to cancel a timer.
const std::string & getDescription () const
 returns the description of the timer
unsigned getId () const
 returns the unique timer id
bool isScheduled () const
 returns true if the timer is currently scheduled
bool isRunning () const
 returns true if the timer is scheduled or trying to fire (acquiring a lock)

Protected Member Functions

virtual void expire ()=0
void clearRunning ()
 call this during expire to indicate that the timer is firing (lock acquired) and is ready to be scheduled again.

Member Function Documentation

uint64_t TimerHandler::schedule ( uint64_t  time,
bool  abs = false,
bool  align = false 
)

call this on the timer handler to schedule it with the scheduler

Parameters:
time the time to schedule in microseconds
abs true means time is absolute, false means it is now+time
align if true the timer will try to schedule itself for a second boundary (no parts of a second)
Returns:
the absolute time the timer is scheduled for

Definition at line 18 of file TimerHandler.cc.

References Scheduler::schedule(), and TimeUtil::timeu().

Referenced by VMRSSLimit::expire(), SwapMonitor::expire(), LoadMonitor::expire(), HiResLoadMonitor::expire(), LoadMonitor::runLoadMonitor(), SwapMonitor::runSwapMonitor(), VMRSSLimit::runVMRSSLimit(), and HiResLoadMonitor::start().

virtual void TimerHandler::expire (  )  [protected, pure virtual]

implemented by each timer subclass with the action to take when the timer fires

Implemented in HiResLoadMonitor, LoadMonitor, SwapMonitor, and VMRSSLimit.

Referenced by fire().


The documentation for this class was generated from the following files:

Generated on Sat Oct 4 21:30:31 2008 for Mace Library by  doxygen 1.5.5