Skip to content
Snippets Groups Projects
Commit b37034b2 authored by Nikolaus Huber's avatar Nikolaus Huber
Browse files

git-svn-id: https://se1.informatik.uni-wuerzburg.de/usvn/svn/code/code/DMM/trunk@10507 9e42b895-fcda-4063-8a3b-11be15eb1bbd
parent 879ff254
No related branches found
No related tags found
No related merge requests found
...@@ -158,15 +158,11 @@ public class AdaptationControl { ...@@ -158,15 +158,11 @@ public class AdaptationControl {
wFunction.updateWeight(tactic); wFunction.updateWeight(tactic);
} }
private void processResults(WeightedTactic tactic) { private void processResults(WeightedTactic tactic) {
// TODO Parse the new analysis results into the Performance Data
// Repository
Impact latestImpact = PerfDataRepoHelper.getImpactAt(perfDataRepo, iteration); Impact latestImpact = PerfDataRepoHelper.getImpactAt(perfDataRepo, iteration);
// Connect parsed results to the executed tactic // Connect parsed results to the executed tactic
tactic.setLastImpact(latestImpact); if (latestImpact != null)
tactic.setLastImpact(latestImpact);
} }
private void analyzeModel() { private void analyzeModel() {
......
...@@ -21,11 +21,11 @@ import edu.kit.ipd.descartes.mm.adaptationpoints.ModelVariableConfigurationRange ...@@ -21,11 +21,11 @@ import edu.kit.ipd.descartes.mm.adaptationpoints.ModelVariableConfigurationRange
import edu.kit.ipd.descartes.mm.containerrepository.ContainerTemplate; import edu.kit.ipd.descartes.mm.containerrepository.ContainerTemplate;
import edu.kit.ipd.descartes.mm.resourceconfiguration.ConfigurationSpecification; import edu.kit.ipd.descartes.mm.resourceconfiguration.ConfigurationSpecification;
import edu.kit.ipd.descartes.mm.resourceconfiguration.NumberOfParallelProcessingUnits; import edu.kit.ipd.descartes.mm.resourceconfiguration.NumberOfParallelProcessingUnits;
import edu.kit.ipd.descartes.mm.resourceconfiguration.ResourceconfigurationPackage;
import edu.kit.ipd.descartes.mm.resourcelandscape.Container; import edu.kit.ipd.descartes.mm.resourcelandscape.Container;
import edu.kit.ipd.descartes.mm.resourcelandscape.RuntimeEnvironment; import edu.kit.ipd.descartes.mm.resourcelandscape.RuntimeEnvironment;
public class DmmModelChanger { public class DmmModelChanger {
/** /**
* Denotes a Container as a copy of another by * Denotes a Container as a copy of another by
...@@ -43,19 +43,22 @@ public class DmmModelChanger { ...@@ -43,19 +43,22 @@ public class DmmModelChanger {
*/ */
public static void scaleModelVariable(ModelVariableConfigurationRange range, AdaptationDirection direction) public static void scaleModelVariable(ModelVariableConfigurationRange range, AdaptationDirection direction)
throws OperationNotPerformedException { throws OperationNotPerformedException {
scaleModelVariable(range.getAdaptableEntity(), range, direction);
switch (range.getAdaptableEntity().eClass().getClassifierID()) {
case ResourceconfigurationPackage.NUMBER_OF_PARALLEL_PROCESSING_UNITS:
adaptNumberOfCores(range.getAdaptableEntity(), range, direction);
break;
default:
logger.error("SCALING THIS TYPE OF MODEL VARIABLE HAS NOT BEEN IMPLEMENTED YET!");
break;
}
} }
private static void scaleModelVariable(AdaptableEntity adaptedEntity, ModelVariableConfigurationRange range, AdaptationDirection direction) private static void adaptNumberOfCores(AdaptableEntity adaptedEntity, ModelVariableConfigurationRange range,
throws OperationNotPerformedException { AdaptationDirection direction) throws OperationNotPerformedException {
/*
* TODO: 1) Find all subtypes of AdaptableEntity 2) Add switch/case logic to instantiate the
* correct class
*/
// Here I assume that I found the correct class
NumberOfParallelProcessingUnits adaptableModelEntity = (NumberOfParallelProcessingUnits) adaptedEntity; NumberOfParallelProcessingUnits adaptableModelEntity = (NumberOfParallelProcessingUnits) adaptedEntity;
Entity containingEntity = (Entity) adaptableModelEntity.getProcessingResourceSpec().getParentResourceSpecification().eContainer(); Entity containingEntity = (Entity) adaptableModelEntity.getProcessingResourceSpec().getParentResourceSpecification().eContainer();
Integer currentValue = adaptableModelEntity.getNumber(); Integer currentValue = adaptableModelEntity.getNumber();
Integer maxValue = (int) Math.floor(range.getMaxValue()); Integer maxValue = (int) Math.floor(range.getMaxValue());
Integer minValue = (int) Math.ceil(range.getMinValue()); Integer minValue = (int) Math.ceil(range.getMinValue());
...@@ -167,14 +170,14 @@ public class DmmModelChanger { ...@@ -167,14 +170,14 @@ public class DmmModelChanger {
container = pickRandomReferringContainer(actuallyConfiguredInstance); container = pickRandomReferringContainer(actuallyConfiguredInstance);
break; break;
case LEAST_UTILIZED_FIRST: case LEAST_UTILIZED_FIRST:
logger.error("NOT IMPLEMENTED YET"); // TODO logger.error("NOT IMPLEMENTED YET");
break; break;
case MOST_UTILIZED_FIRST: case MOST_UTILIZED_FIRST:
logger.error("NOT IMPLEMENTED YET"); // TODO logger.error("NOT IMPLEMENTED YET");
break; break;
default: default:
logger.error("No adaptation operation defined for " + scope.getLiteral() + ", " logger.error("No adaptation operation defined for " + scope.getLiteral() + ", "
+ direction.getLiteral()); // TODO + direction.getLiteral());
break; break;
} }
if (container != null) if (container != null)
...@@ -237,7 +240,7 @@ public class DmmModelChanger { ...@@ -237,7 +240,7 @@ public class DmmModelChanger {
if (changedElement != null && changedElement instanceof AdaptableEntity) { if (changedElement != null && changedElement instanceof AdaptableEntity) {
AdaptableEntity adaptableEntity = (AdaptableEntity) changedElement; AdaptableEntity adaptableEntity = (AdaptableEntity) changedElement;
try { try {
scaleModelVariable(adaptableEntity, range, direction); adaptNumberOfCores(adaptableEntity, range, direction);
// in case operation was not executed, e.g. because min was reached // in case operation was not executed, e.g. because min was reached
} catch (OperationNotPerformedException e) { } catch (OperationNotPerformedException e) {
//undo copy of config spec //undo copy of config spec
......
...@@ -38,9 +38,8 @@ public class PerfDataRepoHelper { ...@@ -38,9 +38,8 @@ public class PerfDataRepoHelper {
*/ */
public static Impact getImpactAt(PerformanceDataRepository perfDataRepo, int position) { public static Impact getImpactAt(PerformanceDataRepository perfDataRepo, int position) {
EList<Impact> impactHistory = perfDataRepo.getImpactHistory(); EList<Impact> impactHistory = perfDataRepo.getImpactHistory();
// FIXME: Add more data to PerfDataRepo
if (position > impactHistory.size() - 1) if (position > impactHistory.size() - 1)
return impactHistory.get(0); return null;
return impactHistory.get(position); return impactHistory.get(position);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment