avrora.sim.util
Class GlobalClock
java.lang.Object
avrora.sim.util.GlobalClock
- Direct Known Subclasses:
- FreeSpaceAir.RadioClock, SimpleAir.RadioClock
- public class GlobalClock
- extends java.lang.Object
The GlobalClock class implements a global timer among multiple simulators by inserting
periodic timers into each simulator. It is an alternate version of the GlobalClock class that
was developed for use with the synchronization policy used in the CC1000 - SimpleAir radio implementation.
A verbose printer for this class can be accessed through "sim.global".
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
period
public final long period
cycles is the number of cycles on a member local clock per cycle on the global clock. Some
re-coding must be done if microcontrollers running at difference speeds are to be accurately
simulated.
threadMap
protected final java.util.HashMap threadMap
ticker
public final GlobalClock.Ticker ticker
gqPrinter
protected final Verbose.Printer gqPrinter
GlobalClock
public GlobalClock(long p)
GlobalClock
protected GlobalClock(long p,
GlobalClock.Ticker t)
add
public void add(SimulatorThread t)
remove
public void remove(SimulatorThread t)
insertEvent
public void insertEvent(Simulator.Event event,
long ticks)
- Adds an
Event to this global event queue. It is important to note that this method adds an
event executed once at the appropriate global time. It does not execute once in each thread
participating in the clock. For such functionality, see LocalMeet. Note that the event,
when fired, may run in any one of the threads participating in the global clock, and not necessarily
the same thread each time.
removeEvent
public void removeEvent(Simulator.Event event)
addLocalMeet
public void addLocalMeet(GlobalClock.LocalMeet m,
long delay)
- Adds a
LocalMeet event to the event queue of every simulator participating in the global
clock.
getCount
public long getCount()
globalTime
public long globalTime()
getNumberOfThreads
public int getNumberOfThreads()