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 EvaluationScopeIteratoriteratorprotected Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Set<org.palladiosimulator.edp2.datastream.IDataStream<org.palladiosimulator.measurementframework.MeasuringValue>>>resourceMeasurements
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractEvaluationScope()Initializes a new instance of theAbstractEvaluationScopeclass.
-
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 theMeasuringValues of a certainProcessingResourceSpecificationfor a certainMetricDescription.booleanhasNext()Returntrueif the evaluation scope can move forward in a timely fashion.EvaluationScopeIteratoriterator()voidnext()Moves on to the next set of context elements.voidreset()Resets the scope to its initial state.
In particular, the currently available set of measurements is discarded.abstract voidsetResourceMetricsToEvaluate(Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Set<org.palladiosimulator.metricspec.MetricDescription>> metricsMap)Sets for eachProcessingResourceSpecificationwhich 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 theAbstractEvaluationScopeclass.
-
-
Method Detail
-
setResourceMetricsToEvaluate
public abstract void setResourceMetricsToEvaluate(Map<org.palladiosimulator.pcm.resourceenvironment.ProcessingResourceSpecification,Set<org.palladiosimulator.metricspec.MetricDescription>> metricsMap)
Sets for eachProcessingResourceSpecificationwhich metrics are supposed to be evaluated. The method is to be provided by implementing subclasses.
A call to this method results in initializing theresourceMeasurementsused to when iterating the scope. If for a certainProcessingResourceSpecificationandMetricDescriptionthere are no measurements available or there is no way to create the measurements from the available data, anIllegalArgumentExceptionis thrown.- Parameters:
metricsMap- the Map linkingProcessingResourceSpecifications to the metrics needed by theAbstractResourcePowerModelCalculatorin 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()
Returntrueif 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 theMeasuringValues of a certainProcessingResourceSpecificationfor a certainMetricDescription.- Parameters:
processingResourceSpecification- TheProcessingResourceSpecificationto retrieve the measurements for.metric- TheMetricDescriptionwhich characterizes the measurements to collect.- Returns:
- An
Iteratorthat 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()
-
-