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.AbstractEvaluationScope
This 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 allProcessingResourceSpecification
s that are supplied by a givenPowerProvidingEntity
. That is, the utilization of aProcessingResourceSpecification
is evaluated if it corresponds toPowerConsumingResource
subsumed 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 protected
SimulationTimeEvaluationScope(de.fzi.power.infrastructure.PowerProvidingEntity entityUnderMeasurement, de.uka.ipd.sdq.simucomframework.model.SimuComModel model)
Initializes a new instance of theSimulationTimeEvaluationScope
with the given properties.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(ISimulationEvaluationScopeListener listener)
Adds the given listener to collection of scope observers.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 aSimulationTimeEvaluationScope
instance initialized with the given parameters.void
removeAllListeners()
Removes all currently attached listeners, i.e., call is equivalent to invocation ofremoveListener(ISimulationEvaluationScopeListener)
once per attached listener.void
removeListener(ISimulationEvaluationScopeListener listener)
Detaches the given listener from the scope.void
reset()
void
setResourceMetricsToEvaluate(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 theSimulationTimeEvaluationScope
with the given properties.- Parameters:
entityUnderMeasurement
- ThePowerProvidingEntity
that shall be evaluated.model
- A reference indicating theSimuComModel
that is used for the current simulation run.- Throws:
NullPointerException
- If either of the arguments isnull
, anNullPointerException
is 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 aSimulationTimeEvaluationScope
instance initialized with the given parameters.- Parameters:
entityUnderMeasurement
- ThePowerProvidingEntity
that shall be evaluated.model
- A reference indicating theSimuComModel
that is used for the current simulation run.windowLength
- The length of the underlying sliding window, given in any arbitraryDuration
.windowIncrement
- ThisMeasure
indicates the increment by what the underlying sliding window is moved on, given in any arbitraryDuration
.- Returns:
- A valid
SimulationTimeEvaluationScope
instance with the given properties. - Throws:
NullPointerException
- IfentityUnderMeasurement
ormodel
arenull
.IllegalArgumentException
- In casewindowLength
orwindowIncrement
arenull
or denote a negative duration.IllegalStateException
- This exception is thrown, if any of theProcessingResourceSpecification
s subsumed by the givenentityUnderMeasurement
is not associated withMetricDescriptionConstants.STATE_OF_ACTIVE_RESOURCE_METRIC_TUPLE
measurements.
-
reset
public void reset()
- Overrides:
reset
in classde.fzi.power.interpreter.AbstractEvaluationScope
-
addListener
public void addListener(ISimulationEvaluationScopeListener listener)
Adds the given listener to collection of scope observers.- Parameters:
listener
- TheISimulationEvaluationScopeListener
to observe this scope.- Throws:
IllegalArgumentException
- In case the given listener isnull
or 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
- TheISimulationEvaluationScopeListener
to 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:
setResourceMetricsToEvaluate
in classde.fzi.power.interpreter.AbstractEvaluationScope
-
-