hu.mta.sztaki.lpds.cloud.simulator
Class Timed
java.lang.Object
hu.mta.sztaki.lpds.cloud.simulator.Timed
- All Implemented Interfaces:
- Comparable<Timed>
- Direct Known Subclasses:
- DeferredEvent.AggregatedEventDispatcher, EnergyMeter, MonitorConsumption, ResourceSpreader.FreqSyncer
public abstract class Timed
- extends Object
- implements Comparable<Timed>
This is the base class for the simulation, every class that should receive
timing events should extend this and implement the function named "tick".
- Author:
- "Gabor Kecskemeti, Distributed and Parallel Systems Group, University of Innsbruck (c) 2013"
"Gabor Kecskemeti, Laboratory of Parallel and Distributed Systems, MTA SZTAKI (c) 2012"
Constructor Summary |
Timed()
|
timedlist
private static final PriorityQueue<Timed> timedlist
underProcessing
private static Timed underProcessing
fireCounter
private static long fireCounter
activeSubscription
private boolean activeSubscription
nextEvent
private long nextEvent
frequency
private long frequency
backPreference
private boolean backPreference
Timed
public Timed()
isSubscribed
public final boolean isSubscribed()
subscribe
protected final boolean subscribe(long freq)
realSubscribe
private void realSubscribe(long freq)
unsubscribe
protected final boolean unsubscribe()
updateFrequency
protected final long updateFrequency(long freq)
updateEvent
private void updateEvent(long freq)
getNextEvent
public long getNextEvent()
getFrequency
public long getFrequency()
nextEventDistance
public long nextEventDistance()
compareTo
public int compareTo(Timed o)
- Specified by:
compareTo
in interface Comparable<Timed>
setBackPreference
protected void setBackPreference(boolean backPreference)
fire
public static final void fire()
calcTimeJump
public static long calcTimeJump(long jump)
jumpTime
public static final long jumpTime(long desiredJump)
skipEventsTill
public static final void skipEventsTill(long desiredTime)
- Jumps the time until the time given by the user. If some events supposed
to happen during the jumped time period, then this function cancels them.
If some events should be recurring during the period, then the first
recurrence of the event will be after the given time instance. If the
given time instance has already occurred then this function does nothing!
- Parameters:
desiredTime
- the time at which the simulation should continue after this
call. If the time given here already happened then this
function will have no effect.
getFireCount
public static final long getFireCount()
getNextFire
public static final long getNextFire()
simulateUntilLastEvent
public static final void simulateUntilLastEvent()
simulateUntil
public static final void simulateUntil(long time)
resetTimed
public static final void resetTimed()
toString
public String toString()
- Overrides:
toString
in class Object
tick
public abstract void tick(long fires)
Copyright © 2012–2015 University of Innsbruck & MTA SZTAKI. All rights reserved.