package example.energy; import schedframe.Parameters; import schedframe.PluginConfiguration; import schedframe.resources.computing.ComputingResource; import schedframe.resources.computing.profiles.energy.EnergyEvent; import schedframe.resources.computing.profiles.energy.power.plugin.EnergyEstimationPlugin; import schedframe.scheduling.manager.tasks.JobRegistry; public abstract class BaseEnergyEstimationPlugin implements EnergyEstimationPlugin { @Override public PluginConfiguration getConfiguration() { // TODO Auto-generated method stub return null; } @Override public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource) { double power = 0; try { return resource.getPowerInterface().getPowerConsumption(resource.getPowerInterface().getPowerState()); } catch (NoSuchFieldException e) { power = 0; } for(ComputingResource child:resource.getChildren()){ power = power + child.getPowerInterface().getRecentPowerUsage().getValue(); } return power; } @Override public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resourceManager) { throw new RuntimeException("Not implemented."); } @Override public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resourceManager) { throw new RuntimeException("Not implemented."); } public void init(Parameters parameters) { } public String getName() { return getClass().getName(); } }