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
ConstructorsConstructorDescriptionFixedSizeMeasurementsAggregator(org.palladiosimulator.metricspec.NumericalBaseMetricDescription expectedMetric, RuntimeMeasurementModel runtimeMeasurementModel, org.palladiosimulator.monitorrepository.FixedSizeAggregation fixedSizeAggregation) Initializes a new instance of theFixedSizeMeasurementsAggregatorclass with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanThis method has to be implemented by all subclasses.voidclear()Discards all measurements collected for aggregation.protected voidcollectMeasurement(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, resetCounterMethods 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 theFixedSizeMeasurementsAggregatorclass with the given parameters.- Parameters:
expectedMetric- The expectedNumericalBaseMetricDescriptionof the aggregated measurements to be forwarded to the runtime measurement model.prmAccess- TheRuntimeMeasurementModelwhere the aggregation results are forwarded to.aggregation- TheFixedSizeAggregationmodel 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 passedFixedSizeAggregationis not positive.
-
-
Method Details
-
collectMeasurement
protected void collectMeasurement(org.palladiosimulator.measurementframework.MeasuringValue newMeasurement) Description copied from class:AbstractMeasurementAggregatorThis method has to be implemented by subclasses to collect a new measurement for aggregation.- Specified by:
collectMeasurementin classAbstractMeasurementAggregator- Parameters:
newMeasurement- AMeasuringValuedenoting the measurement to include for aggregation.
It is ensured that the measurement passed here is notnulland 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:AbstractMeasurementAggregatorThis 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:
aggregationRequiredin classAbstractMeasurementAggregator- Returns:
trueif an aggregation of the collected measurements shall be triggered,falseotherwise.- See Also:
-
getIntervalStartTime
protected org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> getIntervalStartTime()Description copied from class:AbstractMeasurementAggregatorGets the left (lower) bound of the interval that all measurements that are aggregated lie in.- Specified by:
getIntervalStartTimein classAbstractMeasurementAggregator- Returns:
- A non-negative
Amountdenoting the left bound of the interval. - See Also:
-
getIntervalEndTime
protected org.jscience.physics.amount.Amount<javax.measure.quantity.Duration> getIntervalEndTime()Description copied from class:AbstractMeasurementAggregatorGets the right (upper) bound of the interval that all measurements that are aggregated lie in.- Specified by:
getIntervalEndTimein classAbstractMeasurementAggregator- Returns:
- A non-negative
Amountdenoting the right bound of the interval. - See Also:
-
getDataToAggregate
Description copied from class:AbstractMeasurementAggregatorGets the sequence of measurements to be aggregated.- Specified by:
getDataToAggregatein classAbstractMeasurementAggregator- Returns:
- An
Iterableencapsulating the sequence of measurements to be aggregated.
-
clear
public void clear()Description copied from class:AbstractMeasurementAggregatorDiscards all measurements collected for aggregation.- Specified by:
clearin classAbstractMeasurementAggregator
-