Revision 206,
994 bytes
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[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; |
---|
[206] | 9 | import test.rewolucja.resources.physical.implementation.Processor; |
---|
[104] | 10 | import test.rewolucja.scheduling.JobRegistryInterface; |
---|
| 11 | |
---|
| 12 | public class CPUEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
| 13 | |
---|
| 14 | @Override |
---|
| 15 | public double estimatePowerConsumption(EnergyEvent event, JobRegistryInterface jobRegistry, |
---|
| 16 | ComputingResource resource) { |
---|
[206] | 17 | Processor cpu = (Processor)resource; |
---|
[104] | 18 | if(resource.getPowerInterface().getPowerState() == PowerState.OFF) |
---|
| 19 | return 0; |
---|
| 20 | if(resource.getStatus() == ResourceStatus.BUSY) |
---|
| 21 | return cpu.getPowerInterface().getPState().getPower(); |
---|
| 22 | else |
---|
| 23 | return 1; |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | public String getName() { |
---|
[151] | 27 | return getClass().getName(); |
---|
[104] | 28 | } |
---|
| 29 | |
---|
| 30 | public void init(Properties properties) { |
---|
| 31 | // TODO Auto-generated method stub |
---|
| 32 | |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.