[477] | 1 | package example.energy; |
---|
| 2 | |
---|
| 3 | import schedframe.Parameters; |
---|
| 4 | import schedframe.PluginConfiguration; |
---|
| 5 | import schedframe.resources.computing.ComputingResource; |
---|
| 6 | import schedframe.resources.computing.profiles.energy.EnergyEvent; |
---|
| 7 | import schedframe.resources.computing.profiles.energy.power.plugin.EnergyEstimationPlugin; |
---|
| 8 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
| 9 | |
---|
| 10 | public abstract class BaseEnergyEstimationPlugin implements EnergyEstimationPlugin { |
---|
| 11 | |
---|
| 12 | @Override |
---|
| 13 | public PluginConfiguration getConfiguration() { |
---|
| 14 | // TODO Auto-generated method stub |
---|
| 15 | return null; |
---|
| 16 | } |
---|
| 17 | |
---|
| 18 | @Override |
---|
| 19 | public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource) { |
---|
| 20 | double power = 0; |
---|
| 21 | try { |
---|
| 22 | return resource.getPowerInterface().getPowerConsumption(resource.getPowerInterface().getPowerState()); |
---|
| 23 | } catch (NoSuchFieldException e) { |
---|
| 24 | power = 0; |
---|
| 25 | } |
---|
| 26 | for(ComputingResource child:resource.getChildren()){ |
---|
| 27 | power = power + child.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 28 | } |
---|
| 29 | return power; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | @Override |
---|
| 33 | public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resourceManager) { |
---|
| 34 | throw new RuntimeException("Not implemented."); |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | @Override |
---|
| 38 | public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resourceManager) { |
---|
| 39 | throw new RuntimeException("Not implemented."); |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | public void init(Parameters parameters) { |
---|
| 43 | |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | public String getName() { |
---|
| 47 | return getClass().getName(); |
---|
| 48 | } |
---|
| 49 | } |
---|