public abstract class AbstractEventRecorderStrategy extends AbstractRecorderStrategy
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractEventRecorderStrategy.HandleException
A specific exception type which may occur during
handleEvent(de.uni_hildesheim.sse.monitoring.runtime.recordingStrategiesElements.RecordingStrategiesElement). |
private class |
AbstractEventRecorderStrategy.HandleThread
Implements a thread which sends the gathered data to the specified
server.
|
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
DOPOOLING
true if elements should be pooled, otherwise
false. |
private RecordingStrategiesElementLinkedList |
elements
Stores the generated elements for sending them to the specified server.
|
private java.lang.Object |
lock
The internal lock for the message producer-consumer.
|
private boolean |
record
true while recording, otherwise false. |
private AbstractEventRecorderStrategy.HandleThread |
thread
Stores the handling thread.
|
REGISTER_END, REGISTER_FORCE| Constructor and Description |
|---|
AbstractEventRecorderStrategy(StrategyStorage storage)
Creates a new recorder strategy.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
add(RecordingStrategiesElement elt)
Adds an element to the processing list.
|
boolean |
assignAllTo(java.lang.String recId,
boolean enter,
long now,
ThreadsInfo threadInfo)
Notifies that the following values (if not further calls
to this method or other recording ids occur) should be assigned
to the given
recId. |
void |
clearTemporaryData()
Notify that temporary data e.g. from instrumentation shall be cleared.
|
void |
endSystem()
Called as the last event from the monitored program.
|
boolean |
enter(java.lang.String recId,
long now,
ThreadsInfo threadsInfo,
boolean exclude)
Notifies the recorder about a method being called.
|
void |
enterConfiguration(java.lang.String id)
Notify the recorder that a new variability configuration might have
been entered.
|
boolean |
exit(java.lang.String recId,
long now,
ThreadsInfo threadsInfo,
boolean exclude)
Notifies the recorder about a method being exited.
|
boolean |
finishRecording(long now,
long threadId,
LongLongHashMap curCpuTime)
Notifies this strategy that recording should be stopped (second stage
of stopping the recorder).
|
protected abstract void |
handleEvent(RecordingStrategiesElement event)
Handles an event.
|
protected boolean |
isRecording()
Returns whether recording is activated.
|
void |
memoryAllocated(java.lang.String recId,
long threadId,
long id,
long size)
Notifies the recorder about an object allocated to memory.
|
void |
memoryFreedByRecId(java.lang.String recId,
long size)
Notifies the recorder about an object freed from memory.
|
void |
notifyProgramRecordCreation()
Notify the listeners about the program record creation (if not done
implicitly before).
|
void |
notifyTimer(java.lang.String id,
TimerState state,
long now,
long threadId)
Notifies about a timer event.
|
void |
notifyValueChange(java.lang.String id,
ValueType type,
java.lang.Object value)
Notifies about a changing attribute value.
|
boolean |
printCurrentState(ProcessData data)
Prints the current (aggregated) state to the output formatter.
|
boolean |
printStatistics(ProcessData data)
Emits the values collected so far.
|
protected int |
processEvent(RecordingStrategiesElement event)
Processes a single element.
|
void |
readIo(java.lang.String recId,
java.lang.String caller,
long threadId,
int bytes,
StreamType type)
Notifies the recorder about an amount of bytes read from some I/O
channel.
|
void |
register(long threadId,
long newId,
long threadTicks,
long now)
Registers a thread id with a recording id.
|
protected void |
start()
Starts the
AbstractEventRecorderStrategy.HandleThread. |
void |
startRecording(long now,
long threadId,
long threadTicks)
Notifies this strategy that recording should be start.
|
boolean |
stopTimeRecording(long now,
ThreadsInfo threadInfo)
Notifies this strategy that time recording should be stopped (first
stage of stopping the recorder).
|
void |
writeIo(java.lang.String recId,
java.lang.String caller,
long threadId,
int bytes,
StreamType type)
Notifies the recorder about an amount of bytes written to some I/O
channel.
|
enableVariabilityDetection, getRecorderElement, getRecorderElements, getRecorderId, getStorage, getVariabilitySeparatorChar, isVariabilityDetectionEnabled, registerForRecordingprivate static final boolean DOPOOLING
true if elements should be pooled, otherwise
false. This affects the EnterElement,
ExitElement and the MemoryAllocatedElement.private RecordingStrategiesElementLinkedList elements
private java.lang.Object lock
private boolean record
true while recording, otherwise false.private AbstractEventRecorderStrategy.HandleThread thread
public AbstractEventRecorderStrategy(StrategyStorage storage)
storage - the storage objectprotected void start()
AbstractEventRecorderStrategy.HandleThread.protected boolean isRecording()
true if recording is activated, false
elsepublic boolean enter(java.lang.String recId,
long now,
ThreadsInfo threadsInfo,
boolean exclude)
recId - a unique identification where to assign this event tonow - the current system time in nano secondsthreadsInfo - information on the currently running threadsexclude - is this an exclusion from monitoringtrue if the threadsInfo object should be released
to the pool, false if it should not be releasedpublic boolean assignAllTo(java.lang.String recId,
boolean enter,
long now,
ThreadsInfo threadInfo)
recId.recId - the recording id (may be also the variability prefix)enter - true if this is a method enter event,
false elsenow - the current system timethreadInfo - information on the current threadtrue if the threadsInfo object should be released
to the pool, false if it should not be releasedpublic void enterConfiguration(java.lang.String id)
id - an optional group identification (may be empty or null)public boolean exit(java.lang.String recId,
long now,
ThreadsInfo threadsInfo,
boolean exclude)
recId - a unique identification where to assign this event tonow - the current time in nano secondsthreadsInfo - information on the currently running threadsexclude - is this an exclusion from monitoringtrue if the threadsInfo object should be released
to the pool, false if it should not be releasedpublic boolean finishRecording(long now,
long threadId,
LongLongHashMap curCpuTime)
now - the current time in nano secondsthreadId - the id of the current threadcurCpuTime - the id-cpu time mapping of all threadstrue if the curCpuTime object should be released
to the pool, false if it should not be releasedpublic void memoryAllocated(java.lang.String recId,
long threadId,
long id,
long size)
recId - a unique identification where to assign this event tothreadId - the identification of the calling threadid - the unique identification of the object being allocatedsize - the affected amount of bytes in memorypublic boolean printStatistics(ProcessData data)
data - additional information collected for system and JVM processtrue if the data object should be released
to the pool, false if it should not be releasedpublic void endSystem()
RecorderStrategy.finishRecording(long, long, de.uni_hildesheim.sse.monitoring.runtime.utils.LongLongHashMap) and optionally
RecorderStrategy.printStatistics(de.uni_hildesheim.sse.monitoring.runtime.recordingStrategies.ProcessData).public void readIo(java.lang.String recId,
java.lang.String caller,
long threadId,
int bytes,
StreamType type)
recId - a unique identification where to assign this event tocaller - optional class name of the calling classthreadId - the identification of the calling threadbytes - the number of bytestype - the type of the channelpublic void register(long threadId,
long newId,
long threadTicks,
long now)
threadId - the read id to be recordednewId - RecorderStrategy.REGISTER_FORCE the thread specified by
threadId and threadTicks is registered
with the recorderRecorderStrategy.REGISTER_END the thread specified by
threadId and threadTicks is marked as
terminated in the recorderthreadTicks - the ticks of threadIdnow - the current time in nano secondspublic void writeIo(java.lang.String recId,
java.lang.String caller,
long threadId,
int bytes,
StreamType type)
recId - a unique identification where to assign this event tocaller - optional class name of the calling classthreadId - the identification of the calling threadbytes - the number of bytestype - the type of the channelpublic void memoryFreedByRecId(java.lang.String recId,
long size)
Object cannot be instrumented).recId - a unique identification where to assign this event tosize - the affected amount of bytes in memorypublic boolean stopTimeRecording(long now,
ThreadsInfo threadInfo)
now - the current time in nano secondsthreadInfo - information on the currently running threadstrue if the threadsInfo object should be released
to the pool, false if it should not be releasedpublic void startRecording(long now,
long threadId,
long threadTicks)
now - the current time in nano secondsthreadId - the thread id of the executing (main) threadthreadTicks - the thread ticks for threadIdpublic void notifyTimer(java.lang.String id,
TimerState state,
long now,
long threadId)
id - the timer identification (may overlap with recorder ids)state - the new timer statenow - the current system time in millisecondsthreadId - the id of the currently executing thread, may be
negative if it should be ignoredpublic boolean printCurrentState(ProcessData data)
data - additional information collected for system and JVM process (may be null)true if the threadsInfo object should be released
to the pool, false if it should not be releasedpublic void clearTemporaryData()
public void notifyValueChange(java.lang.String id,
ValueType type,
java.lang.Object value)
id - the identification of the attribute (may overlap with
recorder ids)type - the type of the valuevalue - the new value (after changing)public void notifyProgramRecordCreation()
private void add(RecordingStrategiesElement elt)
elt - element the element to be addedprotected int processEvent(RecordingStrategiesElement event)
event - the event to be processedprotected abstract void handleEvent(RecordingStrategiesElement event) throws AbstractEventRecorderStrategy.HandleException
event - the event to be handledAbstractEventRecorderStrategy.HandleException - any kind of throwable exception which should
cause aborting the event loop