Class SpanToolkit
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.rules.jdk.combine.SpanToolkit
-
public class SpanToolkit extends Object
Toolkit for calculating combined span values. Creates spans which consist of at least a start time, an end time and a value. Spans are then combined together (seeCombinable
andCombiner
) to form the largest time span where the combined value is still deemed to be over some threshold. Threshold can be either a defined limit or a calculated density.Currently, it's up to the caller of this toolkit to call the methods with a subset of items that have only one item iterable, which means that events should not overlap in time.
-
-
Constructor Summary
Constructors Constructor Description SpanToolkit()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SpanSquare
getMaxCountCluster(IItemCollection items, IAttribute<IQuantity> countAttribute, IAttribute<IQuantity> timestampAttribute)
Calculates the largest count cluster.static SpanSquare
getMaxDurationCluster(IItemCollection items)
Calculates the largest duration cluster.static SpanLimit
getMaxSpanLimit(IItemCollection items, IAttribute<IQuantity> valueAttribute, IAttribute<IQuantity> endTimeAttribute, double limit)
Calculates the longest span where the combined value still is above the limit.
-
-
-
Method Detail
-
getMaxCountCluster
public static SpanSquare getMaxCountCluster(IItemCollection items, IAttribute<IQuantity> countAttribute, IAttribute<IQuantity> timestampAttribute)
Calculates the largest count cluster.- Parameters:
items
- the item collectioncountAttribute
- the attribute to get count value from, is assumed to be an accumulative value, for example exception statisticstimestampAttribute
- the attribute to get a time stamp from- Returns:
- The maximum count span
-
getMaxDurationCluster
public static SpanSquare getMaxDurationCluster(IItemCollection items)
Calculates the largest duration cluster.- Parameters:
items
- the item collection- Returns:
- The maximum duration span
-
getMaxSpanLimit
public static SpanLimit getMaxSpanLimit(IItemCollection items, IAttribute<IQuantity> valueAttribute, IAttribute<IQuantity> endTimeAttribute, double limit)
Calculates the longest span where the combined value still is above the limit.- Parameters:
items
- the item collectionvalueAttribute
- the value attributeendTimeAttribute
- the end time attributelimit
- the min limit- Returns:
- a span
-
-