class DefaultRecorderElement extends RecorderElement
| Modifier and Type | Field and Description |
|---|---|
private long |
cpuTimeTicks
Stores the CPU time ticks elapsed and allocated to this class.
|
private long |
fileInBytes
Stores the amount of bytes written to files.
|
private long |
fileOutBytes
Stores the amount of bytes read from files.
|
private long |
memAllocated
Stores the amount of memory allocated to this monitoring group.
|
private long |
memUse
Stores the memory use, i.e. the difference between memory allocation
and memory unallocation.
|
private long |
netInBytes
Stores the amount of bytes read from network interfaces.
|
private long |
netOutBytes
Stores the amount of bytes sent to network interfaces.
|
private TimeMap |
startTimes
Stores the system time when monitoring started on this group (temporary
value).
|
private long |
systemTimeTicks
Stores the system time ticks elapsed and allocated to this class.
|
| Modifier | Constructor and Description |
|---|---|
protected |
DefaultRecorderElement(MonitoringGroupConfiguration conf)
Creates a recorder element.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
addNetBytes(long netInBytes,
long netOutBytes)
Adds an external amount of input or output bytes to this recording
element.
|
void |
copy(RecorderElement from)
Copies the data stored in
from into this instance. |
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) RecorderElement |
getContributing(int index,
RecorderElementFactory factory,
int max)
Returns the currently relevant recorder element (in case that
multiple subelements are supported).
|
int |
getContributingSize()
Returns the number of contributing recording elements, i.e. the elements
recording individual variants in a variability configuration.
|
long |
getCpuTimeTicks()
Returns the entire number of CPU time ticks recorded for this
instance.
|
long |
getFileIn()
Returns the number of bytes read from files.
|
long |
getFileOut()
Returns the number of bytes written to files.
|
long |
getIoRead()
Returns the number of bytes read from files or network.
|
long |
getIoWrite()
Returns the number of bytes written to files or network.
|
long |
getMemAllocated()
Returns the amount of memory allocated for this instance.
|
long |
getMemUse()
Returns the amount of memory currently being used, i.e. difference
between allocated and unallocated memory.
|
long |
getNetIn()
Returns the number of bytes read from network.
|
long |
getNetOut()
Returns the number of bytes written to network.
|
protected long |
getStartCpuTime(long threadId)
Returns the CPU time when recording was started.
|
protected long |
getStartSystemTime(long threadId)
Returns the system time when recording was started.
|
long |
getSystemTimeTicks()
Returns the entire number of system time ticks recorded for this
instance.
|
(package private) void |
memoryAllocated(long size)
Records an amount of memory allocated by the underlying recording group.
|
(package private) void |
memoryFreed(long size)
Records an amount of memory freed within the underlying recording
group (memory unallocation).
|
(package private) void |
readIo(int bytes,
StreamType type)
Records an amount of bytes read from file or from network.
|
(package private) void |
setCpuTimeTicks(long cpuTimeTicks)
Sets the current CPI time ticks for finishing recording of the entire
program.
|
(package private) boolean |
startTimeRecording(long nanoTime,
long threadTicks,
long threadId)
Start the time recording for this instance.
|
(package private) boolean |
stopTimeRecording(long nanoTime,
long threadTicks,
long threadId)
Stops the time recording for this instance.
|
private boolean |
stopTimeRecordingImpl(long nanoTime,
long threadTicks,
long threadId)
Stops the time recording for this instance.
|
(package private) void |
timeCorrection(long timeDiff,
long threadTimeFraction,
boolean decrement,
long threadId)
Adds (overhead) time correction information.
|
(package private) void |
updateMemoryFreedFromJvm()
Updates freed memory from the JVM instead of recording this information
individually (memory unallocation).
|
boolean |
wasRecorded()
Returns if data on this instance was recorded or if it a dummy instance
created e.g. for some unused (automatic detected) variants.
|
(package private) void |
writeIo(int bytes,
StreamType type)
Records an amount of bytes written to file or from network.
|
accountResource, checkConf, createForTest, getConfiguration, getGroupAccounting, getInstanceRecorderElement, getResources, getVarId, hasDebugStates, instanceRecorderElements, instanceRecorderIds, isIndirectAccounting, isVisible, setVarIdprivate long memUse
private long memAllocated
private TimeMap startTimes
private long systemTimeTicks
private long cpuTimeTicks
private long netOutBytes
private long netInBytes
private long fileOutBytes
private long fileInBytes
protected DefaultRecorderElement(MonitoringGroupConfiguration conf)
conf - the configuration of the recorder elementpublic void copy(RecorderElement from)
from into this instance. (Deep
copy)copy in class RecorderElementfrom - the instance from where to copy (may also be a subclass)boolean startTimeRecording(long nanoTime,
long threadTicks,
long threadId)
startTimeRecording in class RecorderElementnanoTime - 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 callsboolean stopTimeRecording(long nanoTime,
long threadTicks,
long threadId)
stopTimeRecording in class RecorderElementnanoTime - 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 timesprivate boolean stopTimeRecordingImpl(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 callsprotected long getStartCpuTime(long threadId)
getStartCpuTime in class RecorderElementthreadId - the identifier of the thread the start time should be
returned forprotected long getStartSystemTime(long threadId)
getStartSystemTime in class RecorderElementthreadId - the identifier of the thread the start time should be
returned forvoid memoryAllocated(long size)
memoryAllocated in class RecorderElementsize - the amount of memory allocatedvoid memoryFreed(long size)
memoryFreed in class RecorderElementsize - the amount of memory freedvoid updateMemoryFreedFromJvm()
updateMemoryFreedFromJvm in class RecorderElementvoid readIo(int bytes,
StreamType type)
readIo in class RecorderElementbytes - the amount of bytes readtype - the type of stream used for readingvoid writeIo(int bytes,
StreamType type)
writeIo in class RecorderElementbytes - the amount of bytes writtentype - the type of stream used for writingvoid setCpuTimeTicks(long cpuTimeTicks)
setCpuTimeTicks in class RecorderElementcpuTimeTicks - the current CPU time ticksvoid addNetBytes(long netInBytes,
long netOutBytes)
addNetBytes in class RecorderElementnetInBytes - the amount of bytes read from networknetOutBytes - the amount of bytes written to networkpublic boolean wasRecorded()
true if valid data was recorded, false
elsepublic long getSystemTimeTicks()
public long getCpuTimeTicks()
public long getMemAllocated()
public long getMemUse()
public long getIoRead()
public long getIoWrite()
public long getNetIn()
public long getNetOut()
public long getFileIn()
public long getFileOut()
void timeCorrection(long timeDiff,
long threadTimeFraction,
boolean decrement,
long threadId)
timeCorrection in class RecorderElementtimeDiff - time differencethreadTimeFraction - threaded time fractiondecrement - negative or positive correctionthreadId - the thread id of the causing threadRecorderElement getContributing(int index, RecorderElementFactory factory, int max)
getContributing in class RecorderElementindex - the index of the sub elementfactory - a factory to create new elements if neededmax - the (current) number of maximum required subelements (
variabilities)public RecorderElement getContributing(int index)
getContributing in class RecorderElementindex - the element to be returnedjava.lang.ArrayIndexOutOfBoundsException - if
index<0 || index>=getContributingSize()public int getContributingSize()
getContributingSize in class RecorderElement