public abstract class AbstractMultipleRecorderElement extends RecorderElement
ContributingRecorderElement because it passes the
same recorded value to all represented recorder elements.| Modifier and Type | Field and Description |
|---|---|
private boolean |
distributeValues
Stores whether values should be distributed in accountable fractions
or passed to the elements as a whole.
|
private RecorderElement[] |
elements
Stores the contributing variant measurements.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMultipleRecorderElement(MonitoringGroupConfiguration conf)
Creates a recorder element.
|
protected |
AbstractMultipleRecorderElement(MonitoringGroupConfiguration conf,
RecorderElement[] elements,
boolean distributeValues)
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. |
protected int |
countAccountable(ResourceType type)
Counts the accountable resources.
|
protected int |
distributeIntValue(int value,
ResourceType type)
Distributes an int value to the accountable resources.
|
protected long |
distributeLongValue(long value,
ResourceType type)
Distributes a long value to the accountable resources.
|
protected abstract boolean |
enableRecording(RecorderElement elt,
ResourceType resource)
Returns whether the given element should record the specified resource.
|
protected void |
ensureSize(int index,
int max)
Enlarges the array storing the elements if needed.
|
protected RecorderElement |
firstElement()
Returns the first non-null element.
|
long |
getCpuTimeTicks()
Returns the entire number of CPU time ticks recorded for this
instance.
|
RecorderElement |
getElement(int index)
Returns a stored recording element.
|
int |
getElementCount()
Returns the number of stored recording elements.
|
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.
|
long |
getStartCpuTime(long threadId)
Returns the CPU time when recording was started.
|
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.
|
boolean |
hasElement(RecorderElement rElt)
Returns whether the given element is stored in this element.
|
(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.
|
protected void |
setElement(int index,
RecorderElement elt)
Changes a given element.
|
(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.
|
(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, getContributing, getContributing, getContributingSize, getGroupAccounting, getInstanceRecorderElement, getResources, getVarId, hasDebugStates, instanceRecorderElements, instanceRecorderIds, isIndirectAccounting, isVisible, setVarIdprivate RecorderElement[] elements
private boolean distributeValues
protected AbstractMultipleRecorderElement(MonitoringGroupConfiguration conf)
conf - the monitoring group configurationprotected AbstractMultipleRecorderElement(MonitoringGroupConfiguration conf, RecorderElement[] elements, boolean distributeValues)
conf - the monitoring group configurationelements - the elements to be storeddistributeValues - account the fraction of the values according to
the accountable elements or the entire value (indirect)public 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)protected long distributeLongValue(long value,
ResourceType type)
value - the value to be distributedtype - the resource typedistributeValues)protected int distributeIntValue(int value,
ResourceType type)
value - the value to be distributedtype - the resource typedistributeValues)protected int countAccountable(ResourceType type)
type - the resource typeboolean 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 callsvoid 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()
memoryFreed(long).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 networkvoid 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 threadprotected RecorderElement firstElement()
public boolean wasRecorded()
true if valid data was recorded, false
elsepublic long getStartCpuTime(long threadId)
getStartCpuTime in class RecorderElementthreadId - the identifier of the thread the start time should be
returned forpublic long getStartSystemTime(long threadId)
getStartSystemTime in class RecorderElementthreadId - the identifier of the thread the start time should be
returned forpublic 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()
public RecorderElement getElement(int index)
index - the element to be returnedjava.lang.ArrayIndexOutOfBoundsException - if
index<0 || index>=getElementCount()public boolean hasElement(RecorderElement rElt)
rElt - the element to search fortrue if it is stored, false elsepublic int getElementCount()
protected void setElement(int index,
RecorderElement elt)
ensureSize(int, int) before if needed.index - where to change the elementelt - the new recorder elementjava.lang.ArrayIndexOutOfBoundsException - if index < 0
|| index >=getElementCount()protected void ensureSize(int index,
int max)
index - the index to be usedmax - the expected maximum sizeprotected abstract boolean enableRecording(RecorderElement elt, ResourceType resource)
elt - the element to be consideredresource - the resource to be testedtrue if recording should be done,
false else