Package de.fzi.power.interpreter
Class AbstractEvaluationScope
- java.lang.Object
-
- de.fzi.power.interpreter.AbstractEvaluationScope
-
- All Implemented Interfaces:
Iterable<Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Map<org.palladiosimulator.metricspec.MetricDescription,org.palladiosimulator.measurementframework.MeasuringValue>>>
- Direct Known Subclasses:
EvaluationScope
public abstract class AbstractEvaluationScope extends Object implements Iterable<Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Map<org.palladiosimulator.metricspec.MetricDescription,org.palladiosimulator.measurementframework.MeasuringValue>>>
This class provides basic functionality for all classes that wish to provide a scope to evaluate the power/energy consumption of resources.
-
-
Field Summary
Fields Modifier and Type Field Description protected EvaluationScopeIterator
iterator
protected Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Set<org.palladiosimulator.edp2.datastream.IDataStream<org.palladiosimulator.measurementframework.MeasuringValue>>>
resourceMeasurements
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractEvaluationScope()
Initializes a new instance of theAbstractEvaluationScope
class.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description javax.measure.Measure<Double,javax.measure.quantity.Duration>
getCurrentPointInTime()
Collection<org.palladiosimulator.measurementframework.MeasuringValue>
getMeasurements(org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification processingResourceSpecification)
Gets the current set of measurements that are evaluated for a specific resource.Iterator<org.palladiosimulator.measurementframework.MeasuringValue>
getMeasurementsForProcessingResource(org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification processingResourceSpecification, org.palladiosimulator.metricspec.MetricDescription metric)
This methods provides access to all theMeasuringValue
s of a certainProcessingResourceSpecification
for a certainMetricDescription
.boolean
hasNext()
Returntrue
if the evaluation scope can move forward in a timely fashion.EvaluationScopeIterator
iterator()
void
next()
Moves on to the next set of context elements.void
reset()
Resets the scope to its initial state.
In particular, the currently available set of measurements is discarded.abstract void
setResourceMetricsToEvaluate(Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Set<org.palladiosimulator.metricspec.MetricDescription>> metricsMap)
Sets for eachProcessingResourceSpecification
which metrics are supposed to be evaluated.-
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
-
-
-
-
Field Detail
-
resourceMeasurements
protected final Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Set<org.palladiosimulator.edp2.datastream.IDataStream<org.palladiosimulator.measurementframework.MeasuringValue>>> resourceMeasurements
-
iterator
protected EvaluationScopeIterator iterator
-
-
Constructor Detail
-
AbstractEvaluationScope
protected AbstractEvaluationScope()
Initializes a new instance of theAbstractEvaluationScope
class.
-
-
Method Detail
-
setResourceMetricsToEvaluate
public abstract void setResourceMetricsToEvaluate(Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Set<org.palladiosimulator.metricspec.MetricDescription>> metricsMap)
Sets for eachProcessingResourceSpecification
which metrics are supposed to be evaluated. The method is to be provided by implementing subclasses.
A call to this method results in initializing theresourceMeasurements
used to when iterating the scope. If for a certainProcessingResourceSpecification
andMetricDescription
there are no measurements available or there is no way to create the measurements from the available data, anIllegalArgumentException
is thrown.- Parameters:
metricsMap
- the Map linkingProcessingResourceSpecification
s to the metrics needed by theAbstractResourcePowerModelCalculator
in use.
-
reset
public void reset()
Resets the scope to its initial state.
In particular, the currently available set of measurements is discarded.- See Also:
next()
-
hasNext
public final boolean hasNext()
Returntrue
if the evaluation scope can move forward in a timely fashion. That is basically the case if there is at least one datastream that contains additional measurements.- Returns:
- true, if scope can move forward.
-
next
public final void next()
Moves on to the next set of context elements. Specifically, this moves the underlying utilization sliding window forward and evaluates the utilization to the next point in time for which we want to evaluate the power consumption.- See Also:
reset()
-
getCurrentPointInTime
public javax.measure.Measure<Double,javax.measure.quantity.Duration> getCurrentPointInTime()
-
getMeasurementsForProcessingResource
public final Iterator<org.palladiosimulator.measurementframework.MeasuringValue> getMeasurementsForProcessingResource(org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification processingResourceSpecification, org.palladiosimulator.metricspec.MetricDescription metric)
This methods provides access to all theMeasuringValue
s of a certainProcessingResourceSpecification
for a certainMetricDescription
.- Parameters:
processingResourceSpecification
- TheProcessingResourceSpecification
to retrieve the measurements for.metric
- TheMetricDescription
which characterizes the measurements to collect.- Returns:
- An
Iterator
that contains all the measurements this scope evaluated for the given processing resource. If no measurements are available for the resource or for the specified metric, the method returns an empty iterator.
-
getMeasurements
public final Collection<org.palladiosimulator.measurementframework.MeasuringValue> getMeasurements(org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification processingResourceSpecification)
Gets the current set of measurements that are evaluated for a specific resource.- Parameters:
processingResourceSpecification
- The resource for which the utilization is retrieved.- Returns:
- An UNMODIFIABLE collection consisting of the utilization measurements for the requested resource for the current scope state, or an empty collection if no measurements are present.
-
iterator
public EvaluationScopeIterator iterator()
-
-