|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.realtime.DSS.DSS
The class implementing all discrete state simulation (DSS) features. Concepts and methods are directly modeled on Simula.
State variables are maintained as static variables, to eliminate the need to pass a reference to a DSS object to class instances using DSS features.
Supporting classes are EventList
,
EventNotice
, and
WaiterSet
.
Field Summary | |
static SimulationClock |
clock
The clock of this simulation. |
static java.util.HashMap |
eventBindings
The HashMap mapping happening names to
AsynchEvent 's. |
static EventList |
eventList
The EventList for this simulation. |
static AbsoluteTime |
nominalByteCodeCost
|
static java.lang.ThreadGroup |
realtimeThreads
|
static TestClientStubs |
testClient
A fixed instance of TestClient used
when running under JPF to
hold main program state variables, e.g., accumulator variables maintained by JVM
listeners. |
static boolean |
usingJPF
true iff this program is being run under JPF, rather than a native JVM |
Method Summary | |
static double |
absoluteTimeNanos(AbsoluteTime time)
|
static void |
activate(RealtimeThread thread)
Activate the given thread at the current time. |
static void |
activate(RealtimeThread thread,
AbsoluteTime time)
Activate the given thread at the given time. |
static void |
activate(RealtimeThread thread,
AbsoluteTime time,
boolean verbose)
Activate the given thread at given time. |
static void |
activate(RealtimeThread thread,
boolean verbose)
Activate the given thread at the current time. |
static void |
cancel(RealtimeThread thread)
Remove any event notice for given thread. |
static void |
causeHappening(java.lang.String string)
Cause a happening to occur, i.e., an external stimulus, which must be bound to an AsynchEvent . |
static AbsoluteTime |
currentTime()
Fetches the current simulation time |
static RelativeTime |
fetchAndClearActivePhaseCost()
If running under JPF, use the MJI interface to obtain the byte code execution cost of this active phase as observed through a JPF JVM listener. |
static void |
hold(RelativeTime t)
Passivate and activate the current RealtimeThread
at current time plus t. |
static void |
hold(RelativeTime t,
boolean simulateActivePhaseTime)
|
static void |
hold(RelativeTime t,
boolean simulateActivePhaseTime,
Resource resource)
Passivate and activate the current RealtimeThread
at current time plus t. |
static void |
hold(RelativeTime t,
Resource resource)
|
static void |
holdGivingUpResource(RelativeTime t,
Resource resource,
boolean simulateActivePhaseTime)
Perform a hold operation bracketing it by release() and
seize() operations on a resource. |
static void |
holdWithResource(RelativeTime holdTime,
Resource resource,
boolean simulateActivePhaseTime)
Perform a hold operation wherein periods when the resource has been stolen do not count toward the hold time. |
static void |
passivate()
Suspend current RealtimeThread
without scheduling a reactivation scheduled event. |
static void |
passivate(boolean simulateActivePhaseCost)
Suspend current RealtimeThread
without scheduling a reactivation scheduled event. |
static void |
printTime()
Print current time in format (millis ms, nanos ns)]. |
static void |
reactivate(RealtimeThread thread)
Cancel current thread, and activate at the current time. |
static void |
reactivate(RealtimeThread thread,
AbsoluteTime time)
Cancel current thread, and activate at given time. |
static double |
relativeTimeNanos(RelativeTime time)
|
static void |
runSimulation()
Run current simulation with no randomization. |
static void |
runSimulation(java.lang.String choiceMode)
Run current simulation. |
static void |
shutdown()
Abruptly shuts down the simulation. |
static void |
simulateActivePhaseCost()
If running under JPF, simulate the time consumed thus far by this active phase. |
static void |
verifyChoiceMode(java.lang.String choiceMode)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static SimulationClock clock
EventNotice
is dequeued
from the EventList
public static EventList eventList
EventList
for this simulation.
public static java.util.HashMap eventBindings
HashMap
mapping happening names to
AsynchEvent
's.
public static boolean usingJPF
public static final TestClientStubs testClient
TestClient
used
when running under JPF to
hold main program state variables, e.g., accumulator variables maintained by JVM
listeners.
public static java.lang.ThreadGroup realtimeThreads
public static AbsoluteTime nominalByteCodeCost
Method Detail |
public static void holdGivingUpResource(RelativeTime t, Resource resource, boolean simulateActivePhaseTime) throws java.lang.InterruptedException, ThreadTerminatedException
release()
and
seize()
operations on a resource.
This models a non-computational hold, e.g., waiting for a timer.
t
- The hold timeresource
- The resourcesimulateActivePhaseTime
- indicates whether the hold time should be increased
by the observed byte code execution time of this active phase
(must be running under JPF for this effect).
java.lang.InterruptedException
ThreadTerminatedException
public static void holdWithResource(RelativeTime holdTime, Resource resource, boolean simulateActivePhaseTime) throws java.lang.InterruptedException, ThreadTerminatedException
holdTime
- The hold timeresource
- The resourcesimulateActivePhaseTime
- indicates whether the hold time should be increased
by the observed byte code execution time of this active phase (must be running under
JPF for this effect).
java.lang.InterruptedException
ThreadTerminatedException
public static void hold(RelativeTime t) throws java.lang.InterruptedException
RealtimeThread
at current time plus t. The hold time should be increased
by the observed byte code execution time of this active phase (must be running under
JPF for this effect).
t
- the duration of the hold
java.lang.InterruptedException
public static void hold(RelativeTime t, Resource resource) throws java.lang.InterruptedException
java.lang.InterruptedException
public static void hold(RelativeTime t, boolean simulateActivePhaseTime) throws java.lang.InterruptedException
java.lang.InterruptedException
public static void hold(RelativeTime t, boolean simulateActivePhaseTime, Resource resource) throws java.lang.InterruptedException
RealtimeThread
at current time plus t.
t
- the duration of the holdsimulateActivePhaseTime
- indicates whether the hold time should be increased
by the observed byte code execution time of this active phase (must be running under
JPF for this effect).
java.lang.InterruptedException
public static void cancel(RealtimeThread thread)
thread
- the RealtimeThread
whose
event notice is to be canceled.public static void passivate() throws java.lang.InterruptedException
RealtimeThread
without scheduling a reactivation scheduled event. The observed byte code execution
time of this active phase should be simulated before passivating (must be running under
JPF for this effect).
java.lang.InterruptedException
public static void passivate(boolean simulateActivePhaseCost) throws java.lang.InterruptedException
RealtimeThread
without scheduling a reactivation scheduled event.
simulateActivePhaseCost
- indicates whether the observed byte code execution
time of this active phase should be simulated before passivating (must be running under
JPF for this effect).
java.lang.InterruptedException
public static void activate(RealtimeThread thread, boolean verbose)
thread
- the RealtimeThread
to
be activated.verbose
- indicates whether trace messages should be printedpublic static void activate(RealtimeThread thread)
thread
- the RealtimeThread
to
be activated.public static void activate(RealtimeThread thread, AbsoluteTime time)
thread
- the RealtimeThread
to
be activated.time
- the activation timepublic static void activate(RealtimeThread thread, AbsoluteTime time, boolean verbose)
thread
- the RealtimeThread
to
be activated.time
- the activation timeverbose
- true if trace messages are desiredpublic static void reactivate(RealtimeThread thread)
thread
- the RealtimeThread
to
be reactivated.public static void reactivate(RealtimeThread thread, AbsoluteTime time)
thread
- the RealtimeThread
to
be reactivated.time
- the reactivation timepublic static void printTime()
public static void runSimulation()
public static void runSimulation(java.lang.String choiceMode)
choiceMode
- If equal to:
public static void verifyChoiceMode(java.lang.String choiceMode)
public static AbsoluteTime currentTime()
public static void causeHappening(java.lang.String string) throws UnknownHappeningException
AsynchEvent
.
string
- name of external happening
UnknownHappeningException
- if happening name is unknown to system
UnknownHappeningException
public static RelativeTime fetchAndClearActivePhaseCost()
Otherwise, return null
public static void simulateActivePhaseCost() throws java.lang.InterruptedException
java.lang.InterruptedException
public static void shutdown() throws ThreadTerminatedException
ThreadTerminatedException
public static double absoluteTimeNanos(AbsoluteTime time)
public static double relativeTimeNanos(RelativeTime time)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |