Package haizea :: Package core :: Module manager :: Class RealClock
[hide private]
[frames] | no frames]

Class RealClock

source code


A realtime clock.

The real clock wakes up periodically to, in turn, tell the resource manager to wake up. The real clock can also be run in a "fastforward" mode for debugging purposes (however, unlike the simulated clock, the clock will always skip a fixed amount of time into the future).

Instance Methods [hide private]
 
__init__(self, manager, quantum, non_sched, fastforward=False)
Initializes the real clock.
source code
 
get_time(self)
See docstring in base Clock class.
source code
 
get_start_time(self)
See docstring in base Clock class.
source code
 
get_next_schedulable_time(self)
See docstring in base Clock class.
source code
 
run(self)
Runs the real clock through time.
source code
 
signalhandler_gracefulstop(self, signum, frame)
Handler for SIGTERM and SIGINT.
source code

Inherited from Clock: stop

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, manager, quantum, non_sched, fastforward=False)
(Constructor)

source code 
Initializes the real clock.

Arguments:
manager -- the resource manager
quantum -- interval between clock wakeups
fastforward -- if True, the clock won't actually sleep
               for the duration of the quantum.

Overrides: object.__init__

get_time(self)

source code 

See docstring in base Clock class.

Overrides: Clock.get_time

get_start_time(self)

source code 

See docstring in base Clock class.

Overrides: Clock.get_start_time

get_next_schedulable_time(self)

source code 

See docstring in base Clock class.

Overrides: Clock.get_next_schedulable_time

run(self)

source code 
Runs the real clock through time.

The clock starts when run() is called. In each iteration of the main loop
it will do the following:
- Wake up the resource manager
- Determine if there will be anything to do before the next
  time the clock will wake up (after the quantum has passed). Note
  that this information is readily available on the slot table.
  If so, set next-wakeup-time to (now + time until slot table
  event). Otherwise, set it to (now + quantum)
- Sleep until next-wake-up-time

The clock keeps on tickin' until a SIGINT signal (Ctrl-C if running in the
foreground) or a SIGTERM signal is received.

Overrides: Clock.run

signalhandler_gracefulstop(self, signum, frame)

source code 

Handler for SIGTERM and SIGINT. Allows Haizea to stop gracefully.