Class RuntimeAggregation
- java.lang.Object
-
- com.microsoft.gctoolkit.integration.aggregation.RuntimeAggregation
-
- All Implemented Interfaces:
Aggregation
- Direct Known Subclasses:
PauseTimeAggregation
public class RuntimeAggregation extends Object implements Aggregation
An Aggregation that collates runtime data. This class is meant to be extended by other implementations that need access to runtime data to perform calculations.The following code shows recommended practice for using this Aggregation. The example uses
RuntimeAggregationto calculate the ratio of pause time to runtime duration for a G1GC log.@Collates(G1PauseTimeAggregator.class) public abstract class G1PauseTimeAggregation extends RuntimeAggregation { public abstract void recordPause(double pauseTime); } @Aggregates({EventSource.G1GC) public class G1PauseTimeAggregator extends RuntimeAggregator<G1PauseTimeAggregation> { public G1PauseTimeAggregator(G1PauseTimeAggregation aggregation) { super(aggregation); register(G1RealPause.class, this::process); } private void process(G1RealPause event) { aggregation().recordPause(event.getDuration()); } } public class G1PauseTimeRatio extends G1PauseTimeAggregation { long totalPauseTime; public MaxFullGCPauseTime() {} @Override public void recordPause(double pauseTime) { totalPauseTime += pauseTime; } public double getPauseTimeRatio() { return getRuntimeDuration() > 0.0 ? totalPauseTime / getRuntimeDuration() : 0.0; } @Override public boolean hasWarning() { return false; } @Override public boolean isEmpty() { return getRuntimeDuration() <= 0.0; } }
-
-
Constructor Summary
Constructors Constructor Description RuntimeAggregation()This class is meant to be extended.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetRuntimeDuration()Return the duration of the GC log.DateTimeStampgetTimeOfFirstEvent()Return the time of the first event of the GC log.DateTimeStampgetTimeOfLastEvent()Return the time of the last event of the GC log.booleanhasWarning()booleanisEmpty()voidrecord(DateTimeStamp eventTime, double duration)RuntimeAggregation collates the time of an event and the duration of the event.
-
-
-
Method Detail
-
record
public void record(DateTimeStamp eventTime, double duration)
RuntimeAggregation collates the time of an event and the duration of the event.- Parameters:
eventTime- The time a JVMEvent occurred.duration- The duration of the JVMEvent.
-
getTimeOfFirstEvent
public DateTimeStamp getTimeOfFirstEvent()
Return the time of the first event of the GC log.- Returns:
- The time of the first event.
-
getTimeOfLastEvent
public DateTimeStamp getTimeOfLastEvent()
Return the time of the last event of the GC log. Note well! The time of the last event is not the start time of the event, but is the time the event ended (event start time plus the event duration).- Returns:
- The time of the last event.
-
getRuntimeDuration
public double getRuntimeDuration()
Return the duration of the GC log. Fundamentally, this is the difference between the time of the last event and the time of the first event.- Returns:
- The duration of the JVM runtime represented by the log.
-
hasWarning
public boolean hasWarning()
- Specified by:
hasWarningin interfaceAggregation
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceAggregation
-
-