Class FixedSizeMeasurementsAggregator
java.lang.Object
org.palladiosimulator.simulizar.metrics.PRMRecorder
org.palladiosimulizar.aggregation.aggregators.AbstractMeasurementAggregator
org.palladiosimulizar.aggregation.aggregators.FixedSizeMeasurementsAggregator
- All Implemented Interfaces:
org.palladiosimulator.measurementframework.listener.IMeasurementSourceListener
Implementation of the
AbstractMeasurementAggregator
class dedicated to aggregate a fixed
number of consecutive measurements and to forward the aggregation result to a
RuntimeMeasurementModel
.-
Constructor Summary
ConstructorDescriptionFixedSizeMeasurementsAggregator
(org.palladiosimulator.metricspec.NumericalBaseMetricDescription expectedMetric, RuntimeMeasurementModel runtimeMeasurementModel, org.palladiosimulator.monitorrepository.FixedSizeAggregation fixedSizeAggregation) Initializes a new instance of theFixedSizeMeasurementsAggregator
class with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
This method has to be implemented by all subclasses.void
clear()
Discards all measurements collected for aggregation.protected void
collectMeasurement
(org.palladiosimulator.measurementframework.MeasuringValue newMeasurement) This method has to be implemented by subclasses to collect a new measurement for aggregation.protected Iterable<org.palladiosimulator.measurementframework.MeasuringValue>
Gets the sequence of measurements to be aggregated.protected org.jscience.physics.amount.Amount<javax.measure.quantity.Duration>
Gets the right (upper) bound of the interval that all measurements that are aggregated lie in.protected org.jscience.physics.amount.Amount<javax.measure.quantity.Duration>
Gets the left (lower) bound of the interval that all measurements that are aggregated lie in.Methods inherited from class org.palladiosimulizar.aggregation.aggregators.AbstractMeasurementAggregator
decrementCounter, getExpectedMetric, getPointInTimeOfMeasurement, newMeasurementAvailable, onPostAggregate, onPreAggregate, preUnregister, resetCounter
Methods inherited from class org.palladiosimulator.simulizar.metrics.PRMRecorder
detachFromPRM, getMeasurementSpecification, getPRMMeasurement, getPrmModel, updateMeasurementValue
-
Constructor Details
-
FixedSizeMeasurementsAggregator
public FixedSizeMeasurementsAggregator(org.palladiosimulator.metricspec.NumericalBaseMetricDescription expectedMetric, RuntimeMeasurementModel runtimeMeasurementModel, org.palladiosimulator.monitorrepository.FixedSizeAggregation fixedSizeAggregation) Initializes a new instance of theFixedSizeMeasurementsAggregator
class with the given parameters.- Parameters:
expectedMetric
- The expectedNumericalBaseMetricDescription
of the aggregated measurements to be forwarded to the runtime measurement model.prmAccess
- TheRuntimeMeasurementModel
where the aggregation results are forwarded to.aggregation
- TheFixedSizeAggregation
model element specifying the properties of measurement aggregation.- Throws:
NullPointerException
- In case any of the parameters isnull
.IllegalStateException
- If the value of the 'Number Of Measurements' attribute of the passedFixedSizeAggregation
is not positive.
-
-
Method Details
-
collectMeasurement
protected void collectMeasurement(org.palladiosimulator.measurementframework.MeasuringValue newMeasurement) Description copied from class:AbstractMeasurementAggregator
This method has to be implemented by subclasses to collect a new measurement for aggregation.- Specified by:
collectMeasurement
in classAbstractMeasurementAggregator
- Parameters:
newMeasurement
- AMeasuringValue
denoting the measurement to include for aggregation.
It is ensured that the measurement passed here is notnull
and adheres to the expected metric, hence no more checks with regards to this have to be done by the implementations.- See Also:
-
aggregationRequired
protected boolean aggregationRequired()Description copied from class:AbstractMeasurementAggregator
This method has to be implemented by all subclasses. It is invoked by this instance each time a new measurements has been collected, i.e., directly afterAbstractMeasurementAggregator.collectMeasurement(MeasuringValue)
andAbstractMeasurementAggregator.decrementCounter()
have been invoked, and the counter for the next upcoming aggregation has reached zero.
In case an aggregation is required, it is directly performed hereafter, yet preceded by the invocation ofAbstractMeasurementAggregator.onPreAggregate()
and followed by the invocation ofAbstractMeasurementAggregator.onPostAggregate()
andAbstractMeasurementAggregator.resetCounter()
.- Specified by:
aggregationRequired
in classAbstractMeasurementAggregator
- Returns:
true
if an aggregation of the collected measurements shall be triggered,false
otherwise.- See Also:
-
getIntervalStartTime
protected org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> getIntervalStartTime()Description copied from class:AbstractMeasurementAggregator
Gets the left (lower) bound of the interval that all measurements that are aggregated lie in.- Specified by:
getIntervalStartTime
in classAbstractMeasurementAggregator
- Returns:
- A non-negative
Amount
denoting the left bound of the interval. - See Also:
-
getIntervalEndTime
protected org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> getIntervalEndTime()Description copied from class:AbstractMeasurementAggregator
Gets the right (upper) bound of the interval that all measurements that are aggregated lie in.- Specified by:
getIntervalEndTime
in classAbstractMeasurementAggregator
- Returns:
- A non-negative
Amount
denoting the right bound of the interval. - See Also:
-
getDataToAggregate
Description copied from class:AbstractMeasurementAggregator
Gets the sequence of measurements to be aggregated.- Specified by:
getDataToAggregate
in classAbstractMeasurementAggregator
- Returns:
- An
Iterable
encapsulating the sequence of measurements to be aggregated.
-
clear
public void clear()Description copied from class:AbstractMeasurementAggregator
Discards all measurements collected for aggregation.- Specified by:
clear
in classAbstractMeasurementAggregator
-