Class SimulationTimeEvaluationScope
- java.lang.Object
-
- de.fzi.power.interpreter.AbstractEvaluationScope
-
- org.palladiosimulator.simulizar.power.evaluationscope.SimulationTimeEvaluationScope
-
- All Implemented Interfaces:
Iterable<Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Map<org.palladiosimulator.metricspec.MetricDescription,org.palladiosimulator.measurementframework.MeasuringValue>>>
public class SimulationTimeEvaluationScope extends de.fzi.power.interpreter.AbstractEvaluationScopeThis class is an implementation of an evaluation scope to gather utilization measurements required for power consumption measurements at runtime, i.e., during runs of SimuLizar.
In the current implementation, the utilization is evaluated for allProcessingResourceSpecifications that are supplied by a givenPowerProvidingEntity. That is, the utilization of aProcessingResourceSpecificationis evaluated if it corresponds toPowerConsumingResourcesubsumed by the givenPowerProvidingEntity. In order to keep track of new measurements (i.e., to obtain a new power consumption measurement) client have to attach themselves by calling
addListener(ISimulationEvaluationScopeListener).
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimulationTimeEvaluationScope(de.fzi.power.infrastructure.PowerProvidingEntity entityUnderMeasurement, de.uka.ipd.sdq.simucomframework.model.SimuComModel model)Initializes a new instance of theSimulationTimeEvaluationScopewith the given properties.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(ISimulationEvaluationScopeListener listener)Adds the given listener to collection of scope observers.static SimulationTimeEvaluationScopecreateScope(de.fzi.power.infrastructure.PowerProvidingEntity entityUnderMeasurement, de.uka.ipd.sdq.simucomframework.model.SimuComModel model, javax.measure.Measure<Double,javax.measure.quantity.Duration> windowLength, javax.measure.Measure<Double,javax.measure.quantity.Duration> windowIncrement)Gets aSimulationTimeEvaluationScopeinstance initialized with the given parameters.voidremoveAllListeners()Removes all currently attached listeners, i.e., call is equivalent to invocation ofremoveListener(ISimulationEvaluationScopeListener)once per attached listener.voidremoveListener(ISimulationEvaluationScopeListener listener)Detaches the given listener from the scope.voidreset()voidsetResourceMetricsToEvaluate(Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Set<org.palladiosimulator.metricspec.MetricDescription>> metricsMap)This implementation does nothing.-
Methods inherited from class de.fzi.power.interpreter.AbstractEvaluationScope
getCurrentPointInTime, getMeasurements, getMeasurementsForProcessingResource, hasNext, iterator, next
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
SimulationTimeEvaluationScope
protected SimulationTimeEvaluationScope(de.fzi.power.infrastructure.PowerProvidingEntity entityUnderMeasurement, de.uka.ipd.sdq.simucomframework.model.SimuComModel model)Initializes a new instance of theSimulationTimeEvaluationScopewith the given properties.- Parameters:
entityUnderMeasurement- ThePowerProvidingEntitythat shall be evaluated.model- A reference indicating theSimuComModelthat is used for the current simulation run.- Throws:
NullPointerException- If either of the arguments isnull, anNullPointerExceptionis thrown.- See Also:
createScope(PowerProvidingEntity, SimuComModel, Measure, Measure),initialize(Measure, Measure)
-
-
Method Detail
-
createScope
public static SimulationTimeEvaluationScope createScope(de.fzi.power.infrastructure.PowerProvidingEntity entityUnderMeasurement, de.uka.ipd.sdq.simucomframework.model.SimuComModel model, javax.measure.Measure<Double,javax.measure.quantity.Duration> windowLength, javax.measure.Measure<Double,javax.measure.quantity.Duration> windowIncrement)
Gets aSimulationTimeEvaluationScopeinstance initialized with the given parameters.- Parameters:
entityUnderMeasurement- ThePowerProvidingEntitythat shall be evaluated.model- A reference indicating theSimuComModelthat is used for the current simulation run.windowLength- The length of the underlying sliding window, given in any arbitraryDuration.windowIncrement- ThisMeasureindicates the increment by what the underlying sliding window is moved on, given in any arbitraryDuration.- Returns:
- A valid
SimulationTimeEvaluationScopeinstance with the given properties. - Throws:
NullPointerException- IfentityUnderMeasurementormodelarenull.IllegalArgumentException- In casewindowLengthorwindowIncrementarenullor denote a negative duration.IllegalStateException- This exception is thrown, if any of theProcessingResourceSpecifications subsumed by the givenentityUnderMeasurementis not associated withMetricDescriptionConstants.STATE_OF_ACTIVE_RESOURCE_METRIC_TUPLEmeasurements.
-
reset
public void reset()
- Overrides:
resetin classde.fzi.power.interpreter.AbstractEvaluationScope
-
addListener
public void addListener(ISimulationEvaluationScopeListener listener)
Adds the given listener to collection of scope observers.- Parameters:
listener- TheISimulationEvaluationScopeListenerto observe this scope.- Throws:
IllegalArgumentException- In case the given listener isnullor already attached.- See Also:
removeListener(ISimulationEvaluationScopeListener),removeAllListeners()
-
removeListener
public void removeListener(ISimulationEvaluationScopeListener listener)
Detaches the given listener from the scope. Prior to that, the listener'sISimulationEvaluationScopeListener.preUnregister()callback implementation is invoked.- Parameters:
listener- TheISimulationEvaluationScopeListenerto detach.- Throws:
IllegalArgumentException- In case the given listener has not been attached or isnull.- See Also:
addListener(ISimulationEvaluationScopeListener),removeAllListeners()
-
removeAllListeners
public void removeAllListeners()
Removes all currently attached listeners, i.e., call is equivalent to invocation ofremoveListener(ISimulationEvaluationScopeListener)once per attached listener.
-
setResourceMetricsToEvaluate
public void setResourceMetricsToEvaluate(Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Set<org.palladiosimulator.metricspec.MetricDescription>> metricsMap)
This implementation does nothing.- Specified by:
setResourceMetricsToEvaluatein classde.fzi.power.interpreter.AbstractEvaluationScope
-
-