public abstract class RecorderElement extends java.lang.Object implements IMonitoringGroup
| Modifier and Type | Field and Description |
|---|---|
private MonitoringGroupConfiguration |
conf
Stores the configuration.
|
private LongHashMap<RecorderElement> |
instanceElements
Stores the instance recorder elements.
|
private int |
varId
Stores a numerical (unique) identification of the variant this
recorder element is assigned to.
|
| Modifier | Constructor and Description |
|---|---|
protected |
RecorderElement(MonitoringGroupConfiguration conf)
Creates a recorder element.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accountResource(ResourceType type)
Returns whether the specified resource should be accounted.
|
(package private) abstract void |
addNetBytes(long netInBytes,
long netOutBytes)
Adds an external amount of input or output bytes to this recording
element.
|
void |
checkConf(MonitoringGroupConfiguration conf)
Checks the configuration of this recorder element and replaces it if
it is
MonitoringGroupConfiguration.STUB. |
void |
copy(RecorderElement from)
Copies the data stored in
from into this instance. |
static RecorderElement |
createForTest(MonitoringGroupConfiguration conf)
Factory method for creating test instances.
|
MonitoringGroupConfiguration |
getConfiguration()
Returns the monitoring group configuration.
|
abstract RecorderElement |
getContributing(int index)
Returns a contributing recording element, i.e. one of the elements
assigned to individual variants in a variability configuration.
|
(package private) abstract RecorderElement |
getContributing(int index,
RecorderElementFactory factory,
int max)
Returns the currently relevant recorder element (in case that
multiple subelements are supported).
|
abstract int |
getContributingSize()
Returns the number of contributing recording elements, i.e. the elements
recording individual variants in a variability configuration.
|
GroupAccountingType |
getGroupAccounting()
Stores the accounting type.
|
RecorderElement |
getInstanceRecorderElement(long instanceId)
Returns an instance recorder element for recording how the data in this recorder element
is composed.
|
ResourceType[] |
getResources()
Stores the resources to be accounted.
|
protected abstract long |
getStartCpuTime(long threadId)
Returns the CPU time when recording was started.
|
protected abstract long |
getStartSystemTime(long threadId)
Returns the system time when recording was started.
|
int |
getVarId()
Returns the (unique) numerical identification of the variant this
recorder element is assigned to.
|
boolean |
hasDebugStates(DebugState state)
Returns if this instance has the given
state selected. |
java.lang.Iterable<LongHashMap.MapElement<RecorderElement>> |
instanceRecorderElements()
Returns all instance recorder elements.
|
long[] |
instanceRecorderIds()
Returns all instance recorder keys.
|
boolean |
isIndirectAccounting()
Returns whether indirect accounting is activated, either in this
instance or (if
getGroupAccounting() is GroupAccountingType.DEFAULT)
than in Configuration.getGroupAccountingType(). |
boolean |
isVisible()
Returns whether this element is a pseudo element and should not be
visible to the user.
|
(package private) abstract void |
memoryAllocated(long size)
Records an amount of memory allocated by the underlying recording group.
|
(package private) abstract void |
memoryFreed(long size)
Records an amount of memory freed within the underlying recording
group (memory unallocation).
|
(package private) abstract void |
readIo(int bytes,
StreamType type)
Records an amount of bytes read from file or from network.
|
(package private) abstract void |
setCpuTimeTicks(long cpuTimeTicks)
Sets the current CPU time ticks for finishing recording of the entire
program.
|
(package private) void |
setVarId(int varId)
Changes the (unique) numerical identification of the variant this
recorder element is assigned to.
|
(package private) abstract boolean |
startTimeRecording(long nanoTime,
long threadTicks,
long threadId)
Start the time recording for this instance.
|
(package private) abstract boolean |
stopTimeRecording(long nanoTime,
long threadTicks,
long threadId)
Stops the time recording for this instance.
|
(package private) abstract void |
timeCorrection(long timeDiff,
long threadTimeFraction,
boolean decrement,
long threadId)
Adds (overhead) time correction information.
|
(package private) abstract void |
updateMemoryFreedFromJvm()
Updates freed memory from the JVM instead of recording this information
individually (memory unallocation).
|
(package private) abstract void |
writeIo(int bytes,
StreamType type)
Records an amount of bytes written to file or from network.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCpuTimeTicks, getFileIn, getFileOut, getIoRead, getIoWrite, getMemAllocated, getMemUse, getNetIn, getNetOut, getSystemTimeTicks, wasRecordedprivate int varId
private MonitoringGroupConfiguration conf
private LongHashMap<RecorderElement> instanceElements
protected RecorderElement(MonitoringGroupConfiguration conf)
conf - the group configuration (either from XML or from source code)public void copy(RecorderElement from)
from into this instance. (Deep
copy)from - the instance from where to copy (may also be a subclass)abstract boolean startTimeRecording(long nanoTime,
long threadTicks,
long threadId)
nanoTime - the current system time in nano secondsthreadTicks - the current number of thread ticksthreadId - the identifier of the thread causing the calltrue if recording started on this instance with
this call, false if recording was yet active, e.g. in
case of recursive or reentrant callsabstract boolean stopTimeRecording(long nanoTime,
long threadTicks,
long threadId)
nanoTime - the current system time in nano secondsthreadTicks - the current number of thread ticksthreadId - the identifier of the thread causing the calltrue if recording stopped on this instance with
this call, false if recording is still active, e.g. in
case of recursive or reentrant calls, a negative value causes
stopping time recording for all stored threaded timesabstract void memoryAllocated(long size)
size - the amount of memory allocatedabstract void memoryFreed(long size)
size - the amount of memory freedabstract void updateMemoryFreedFromJvm()
protected abstract long getStartCpuTime(long threadId)
threadId - the identifier of the thread the start time should be
returned forprotected abstract long getStartSystemTime(long threadId)
threadId - the identifier of the thread the start time should be
returned forabstract void readIo(int bytes,
StreamType type)
bytes - the amount of bytes readtype - the type of stream used for readingabstract void writeIo(int bytes,
StreamType type)
bytes - the amount of bytes writtentype - the type of stream used for writingabstract void setCpuTimeTicks(long cpuTimeTicks)
cpuTimeTicks - the current CPU time ticksabstract void addNetBytes(long netInBytes,
long netOutBytes)
netInBytes - the amount of bytes read from networknetOutBytes - the amount of bytes written to networkpublic boolean hasDebugStates(DebugState state)
state selected.state - the state to be testedtrue if the state is selected, false
elseabstract void timeCorrection(long timeDiff,
long threadTimeFraction,
boolean decrement,
long threadId)
timeDiff - time differencethreadTimeFraction - threaded time fractiondecrement - negative or positive correctionthreadId - the thread id of the causing threadabstract RecorderElement getContributing(int index, RecorderElementFactory factory, int max)
index - the index of the sub element (may be negative if not known)factory - a factory to create new elements if neededmax - the (current) number of maximum required subelements
(variabilities)public abstract RecorderElement getContributing(int index)
index - the element to be returnedjava.lang.ArrayIndexOutOfBoundsException - if
index<0 || index>=getContributingSize()public abstract int getContributingSize()
void setVarId(int varId)
varId - the new variability identificationpublic int getVarId()
public GroupAccountingType getGroupAccounting()
public ResourceType[] getResources()
public boolean accountResource(ResourceType type)
type - the type of the resource to query fortrue if it should be accounted,
false elsepublic boolean isIndirectAccounting()
getGroupAccounting() is GroupAccountingType.DEFAULT)
than in Configuration.getGroupAccountingType().true if indirect is activated,
false elsepublic MonitoringGroupConfiguration getConfiguration()
public static RecorderElement createForTest(MonitoringGroupConfiguration conf)
conf - the monitoring group configurationpublic boolean isVisible()
true if this element is visible, false
elsepublic void checkConf(MonitoringGroupConfiguration conf)
MonitoringGroupConfiguration.STUB.conf - the new configurationpublic RecorderElement getInstanceRecorderElement(long instanceId)
IMonitoringGroupgetInstanceRecorderElement in interface IMonitoringGroupinstanceId - the instance identifierpublic java.lang.Iterable<LongHashMap.MapElement<RecorderElement>> instanceRecorderElements()
IMonitoringGroupinstanceRecorderElements in interface IMonitoringGrouppublic long[] instanceRecorderIds()
IMonitoringGroupinstanceRecorderIds in interface IMonitoringGroup