[104] | 1 | package example.energy; |
---|
| 2 | |
---|
| 3 | import java.util.Properties; |
---|
| 4 | |
---|
| 5 | import schedframe.resources.PowerState; |
---|
| 6 | import test.rewolucja.energy.EnergyEvent; |
---|
| 7 | import test.rewolucja.resources.ResourceStatus; |
---|
| 8 | import test.rewolucja.resources.physical.base.ComputingResource; |
---|
| 9 | import test.rewolucja.resources.physical.implementation.CPU; |
---|
| 10 | import test.rewolucja.scheduling.JobRegistryInterface; |
---|
| 11 | import test.rewolucja.scheduling.PluginConfiguration; |
---|
| 12 | |
---|
| 13 | public class CPUEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
| 14 | |
---|
| 15 | @Override |
---|
| 16 | public double estimatePowerConsumption(EnergyEvent event, JobRegistryInterface jobRegistry, |
---|
| 17 | ComputingResource resource) { |
---|
| 18 | CPU cpu = (CPU)resource; |
---|
| 19 | if(resource.getPowerInterface().getPowerState() == PowerState.OFF) |
---|
| 20 | return 0; |
---|
| 21 | if(resource.getStatus() == ResourceStatus.BUSY) |
---|
| 22 | return cpu.getPowerInterface().getPState().getPower(); |
---|
| 23 | else |
---|
| 24 | return 1; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | @Override |
---|
| 28 | public double estimateEnergyDissipation(EnergyEvent event, JobRegistryInterface jobRegistry, ComputingResource resourceManager) { |
---|
| 29 | // TODO Auto-generated method stub |
---|
| 30 | return 0; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | @Override |
---|
| 34 | public double estimateTemperature(EnergyEvent event, JobRegistryInterface jobRegistry, ComputingResource resourceManager) { |
---|
| 35 | // TODO Auto-generated method stub |
---|
| 36 | return 0; |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | @Override |
---|
| 40 | public String getName() { |
---|
| 41 | // TODO Auto-generated method stub |
---|
| 42 | return null; |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | @Override |
---|
| 46 | public void init(Properties properties) { |
---|
| 47 | // TODO Auto-generated method stub |
---|
| 48 | |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | @Override |
---|
| 52 | public PluginConfiguration getConfiguration() { |
---|
| 53 | // TODO Auto-generated method stub |
---|
| 54 | return null; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | } |
---|