|
DRCL JavaSim API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--drcl.DrclObj
|
+--drcl.comp.ForkManager
|
+--drcl.comp.ACARuntime
|
+--drcl.comp.ARuntime
A realization of ACA runtime.
AWorkerThread, Serialized Form| Field Summary | |
protected int |
cwf
|
static java.lang.String |
Debug_Q
|
static java.lang.String |
Debug_RECYCLE
|
static java.lang.String |
Debug_STATE
|
static java.lang.String |
Debug_THREAD
|
static java.lang.String |
Debug_THREAD_STATE
|
static java.lang.String |
Debug_WORKFORCE
|
protected long |
ltime
|
protected long |
nEvents
|
protected long |
nLags
|
protected int |
nthreadsWaiting
|
protected FIFOQueue |
qBufferedTask
Used to store tasks. |
protected boolean |
rtEnabled
|
protected long |
rtTol
|
protected long |
startTime
|
static java.lang.String |
State_RESETTING
Transitional state to INACTIVE when system is being reset. |
static java.lang.String |
State_SUSPENDING
Transitional state to SUSPENDED. |
protected java.lang.ThreadGroup |
threadGroup
|
protected FIFOQueue |
threadPool
|
protected double |
time
|
protected int |
total
|
protected long |
totalThreadRequests
|
protected drcl.comp.ARuntime.WakeupThread |
wakeupThread
|
protected int |
wf
|
| Fields inherited from class drcl.comp.ACARuntime |
debug, DEFAULT_RUNTIME, logenabled, name, resetting, state, State_INACTIVE, State_RUNNING, State_SUSPENDED, tf, timeScale, timeScaleReciprocal, tr, vStateListener |
| Fields inherited from class drcl.comp.ForkManager |
parent, runtime |
| Constructor Summary | |
ARuntime()
|
|
ARuntime(java.lang.String name_)
|
|
| Method Summary | |
void |
___PROFILE___()
|
protected double |
_getEventRate(long numArrivals_)
|
protected double |
_getTime()
Asynchronized version of getTime(), for diagnosis. |
protected void |
_stop(boolean block_)
|
java.lang.String |
a_info(boolean listWaitingTasks_)
Asynchronous version of ACARuntime.diag(). |
protected void |
adjustTime()
Adjust startTime according to wall time and ltime
Called when simulation started and resumed. |
void |
forceReset()
Forces to reset this runtime. |
int |
getAvailableWorkforce()
Returns the amount of available workforce in this runtime. |
double |
getEfficiencyIndex()
Returns the efficiency index of thread recycling. |
double |
getEventEfficiencyIndex(long numberOfArrivalEvents_)
|
java.lang.Object |
getEventQueue()
|
double |
getEventRate()
Returns the event processing rate of this runtime. |
int |
getMaxWorkforce()
Returns the maximum workforce managed by this runtime. |
long |
getNumberOfArrivalEvents()
Returns the number of arrival events. |
int |
getNumberOfIdleThreads()
Returns the number of [idle] worker threads in the recycling pool. |
long |
getNumberOfThreadRequests()
Returns the number of requests for worker threads. |
int |
getNumberOfThreadsCreated()
Returns the number of worker threads being created. |
int |
getNumberOfWorkingThreads()
Returns the number of worker threads that are currently executing some tasks. |
long |
getNumLaggingEvents()
|
Queue |
getQ()
|
double |
getRTEvaluation()
Returns the percentage where events are processed in real time (within tolerance specified by setRTTolerance() (not implemented). |
long |
getRTTolerance()
|
java.lang.ThreadGroup |
getThreadGroup()
|
double |
getThreadRequestRate()
|
long |
getWallTimeElapsed()
Returns the actual time (in ms) this runtime has run for. |
AWorkerThread |
getWorkingThread(int index_)
Returns the worker thread, for diagnosis |
protected AWorkerThread[] |
getWorkingThreads()
|
protected AWorkerThread |
grabOne()
Grabs a AWorkerThread from recycling pool, creates one if necessary. |
java.lang.String |
info()
Returns general information of this runtime. |
boolean |
isIdle()
Returns true if the runtime is stopped (inactive or suspended) or running but all working threads are waiting. |
boolean |
isResetting()
Returns true if the runtime is in resetting. |
boolean |
isRTEnabled()
|
void |
listThreads()
|
protected void |
newTask(Task task_,
WorkerThread currentThread_)
The only way to trigger new tasks to be executed. |
protected AWorkerThread |
newThread()
For subclasses to provide its own worker thread class. |
protected void |
off(ACATimer handle_)
Cancels a fork event. |
void |
print(java.lang.String which_,
AWorkerThread current_,
java.lang.String msg_)
|
void |
println(java.lang.String which_,
AWorkerThread current_,
java.lang.String msg_)
|
protected void |
recordTime()
|
protected void |
recycle(AWorkerThread thread_)
Used by AWorkerThread to return itself to the pool. |
void |
reset()
The workerpool enters a transitional period when reset() is issued. |
void |
resume()
Resumes the system. |
java.lang.String |
s_info()
Returns statistics of this runtime. |
java.lang.String |
s_info(boolean listWaitingTasks_)
Returns statistics of this runtime. |
void |
setMaxWorkforce(int value_)
Set the amount for all. |
void |
setRTEnabled(boolean value_)
Can only be set when INACTIVE (not implemented). |
void |
setRTTolerance(long v_)
|
protected void |
setState(java.lang.String new_)
|
java.lang.String |
ss_info()
Synchronized version of s_info(). |
java.lang.String |
sthreads()
|
java.lang.String |
swthreads()
Synchronized version of wthreads(). |
protected void |
systemBecomesIdle(AWorkerThread exe_)
Subclasses should override this method to handle the event when all workerthreads in the system become either waiting or idle. |
protected void |
systemBecomesInactive()
Called when system becomes inactive, that is, no thread is active or all threads are waiting. |
java.lang.String |
t_info()
|
protected java.lang.String |
t_info(java.lang.String prefix_)
|
java.lang.String |
tasks()
Returns information of the task queue. |
protected void |
threadBecomesWaiting(AWorkerThread exe_)
|
protected boolean |
threadRequestsSleeping(AWorkerThread exe_,
double time_)
Subclasses should override this method to handle the event when a workerthread requests to become waiting. |
java.lang.String |
threads()
Returns information of the associate thread group. |
protected void |
threadStateChange(AWorkerThread thread_,
java.lang.String oldState_,
java.lang.String newState_)
|
protected void |
triggerWakeupThread()
|
java.lang.String |
wakeupThreadInfo()
|
java.lang.String |
wthreads()
Returns information of working threads. |
| Methods inherited from class drcl.comp.ACARuntime |
_openlog, a_info, addDebugLevel, addRunnable, addRunnable, addRunnableAt, addRunnableAt, addStateListener, childManager, containsDebugLevel, debug_info, diag, diag, finalized, getAllDebugLevels, getAllStateListeners, getName, getParent, getState, getTime, getTimeScale, isDebugEnabled, isDebugEnabledAt, isRunning, isStopped, isSuspended, notifyStateListeners, process, reboot, receive, receiveAt, removeDebugLevel, removeStateListener, resumeFor, resumeTo, send, sendAt, setDebugEnabled, setDebugEnabledAt, setDebugLevels, setName, setParent, setRuntime, setTimeScale, stop, stop, stopAt, takeover, takeover, toString, tr_info |
| Methods inherited from class drcl.comp.ForkManager |
a_list, getRuntime, info, list, takeover |
| Methods inherited from class drcl.DrclObj |
clone, duplicate |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String Debug_THREAD
public static final java.lang.String Debug_THREAD_STATE
public static final java.lang.String Debug_WORKFORCE
public static final java.lang.String Debug_Q
public static final java.lang.String Debug_RECYCLE
public static final java.lang.String Debug_STATE
public static final java.lang.String State_SUSPENDING
public static final java.lang.String State_RESETTING
protected int wf
protected int cwf
protected FIFOQueue threadPool
protected int total
protected long totalThreadRequests
protected long startTime
protected long ltime
protected double time
protected java.lang.ThreadGroup threadGroup
protected FIFOQueue qBufferedTask
protected drcl.comp.ARuntime.WakeupThread wakeupThread
protected int nthreadsWaiting
protected boolean rtEnabled
protected long nLags
protected long nEvents
protected long rtTol
| Constructor Detail |
public ARuntime()
public ARuntime(java.lang.String name_)
| Method Detail |
protected void newTask(Task task_,
WorkerThread currentThread_)
newTask in class ACARuntimepublic void setMaxWorkforce(int value_)
setMaxWorkforce in class ACARuntimepublic int getMaxWorkforce()
public int getAvailableWorkforce()
public java.lang.ThreadGroup getThreadGroup()
public void listThreads()
public java.lang.String info()
info in class ACARuntimepublic java.lang.String ss_info()
s_info().public java.lang.String s_info()
public java.lang.String s_info(boolean listWaitingTasks_)
public java.lang.String a_info(boolean listWaitingTasks_)
ACARuntime.diag().a_info in class ACARuntimepublic java.lang.String sthreads()
public java.lang.String threads()
public java.lang.String swthreads()
wthreads().public java.lang.String wthreads()
public java.lang.String tasks()
protected AWorkerThread grabOne()
protected AWorkerThread newThread()
protected void recycle(AWorkerThread thread_)
public void forceReset()
public AWorkerThread getWorkingThread(int index_)
public void ___PROFILE___()
public int getNumberOfThreadsCreated()
public int getNumberOfIdleThreads()
public long getNumberOfThreadRequests()
public long getNumberOfArrivalEvents()
getNumberOfArrivalEvents in class ACARuntimepublic double getEfficiencyIndex()
getNumberOfThreadRequests() over
getNumberOfThreadsCreated().public double getEventEfficiencyIndex(long numberOfArrivalEvents_)
public int getNumberOfWorkingThreads()
public double getEventRate()
getEventRate in class ACARuntimeprotected double _getEventRate(long numArrivals_)
public double getThreadRequestRate()
protected AWorkerThread[] getWorkingThreads()
protected double _getTime()
_getTime in class ACARuntimeprotected void adjustTime()
startTime according to wall time and ltime
Called when simulation started and resumed.protected void recordTime()
protected void _stop(boolean block_)
_stop in class ACARuntimepublic void resume()
resume in class ACARuntimepublic void reset()
CAUTION: 1. This method is better be executed by a thread that is not created from this worker pool, unless you know what you're doing. 2. Current implementation does not work if a thread executes indefinitely.
reset in class ACARuntimepublic long getWallTimeElapsed()
getWallTimeElapsed in class ACARuntimepublic java.lang.String t_info()
t_info in class ACARuntimeprotected java.lang.String t_info(java.lang.String prefix_)
t_info in class ACARuntimeprotected void setState(java.lang.String new_)
setState in class ACARuntimepublic boolean isResetting()
public boolean isIdle()
isIdle in class ACARuntime
protected void threadStateChange(AWorkerThread thread_,
java.lang.String oldState_,
java.lang.String newState_)
public void print(java.lang.String which_,
AWorkerThread current_,
java.lang.String msg_)
public void println(java.lang.String which_,
AWorkerThread current_,
java.lang.String msg_)
public void setRTEnabled(boolean value_)
public boolean isRTEnabled()
public long getNumLaggingEvents()
public double getRTEvaluation()
public void setRTTolerance(long v_)
public long getRTTolerance()
public Queue getQ()
public java.lang.Object getEventQueue()
getEventQueue in class ACARuntimeprotected void threadBecomesWaiting(AWorkerThread exe_)
protected boolean threadRequestsSleeping(AWorkerThread exe_,
double time_)
protected void systemBecomesIdle(AWorkerThread exe_)
exe_ - current thread, requesting waiting and causing the system to become idle
if the request is granted.protected void systemBecomesInactive()
public java.lang.String wakeupThreadInfo()
protected void triggerWakeupThread()
protected void off(ACATimer handle_)
off in class ACARuntime
|
DRCL JavaSim API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||