Revision 783,
1.3 KB
checked in by wojtekp, 12 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[783] | 1 | package example.energy.recs; |
---|
| 2 | |
---|
| 3 | import example.energy.BaseEnergyEstimationPlugin; |
---|
| 4 | import schedframe.resources.ResourceStatus; |
---|
| 5 | import schedframe.resources.computing.ComputingResource; |
---|
| 6 | import schedframe.resources.computing.Processor; |
---|
| 7 | import schedframe.resources.computing.profiles.energy.EnergyEvent; |
---|
| 8 | import schedframe.resources.computing.profiles.energy.power.StandardPowerStateName; |
---|
| 9 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
| 10 | |
---|
| 11 | public class ProcessorEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
| 12 | |
---|
| 13 | public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, |
---|
| 14 | ComputingResource resource) { |
---|
| 15 | double powerConsumption; |
---|
| 16 | Processor cpu = (Processor)resource; |
---|
| 17 | if(resource.getPowerInterface().getPowerState().equals(StandardPowerStateName.OFF)) |
---|
| 18 | powerConsumption = 0; |
---|
| 19 | else { |
---|
| 20 | try { |
---|
| 21 | if(resource.getStatus() == ResourceStatus.BUSY) |
---|
| 22 | powerConsumption = cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPState()); |
---|
| 23 | else { |
---|
| 24 | powerConsumption = cpu.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON); |
---|
| 25 | } |
---|
| 26 | } catch (NoSuchFieldException e) { |
---|
| 27 | try { |
---|
| 28 | powerConsumption = cpu.getPowerInterface().getPowerConsumption(StandardPowerStateName.ON); |
---|
| 29 | } catch (NoSuchFieldException e1) { |
---|
| 30 | powerConsumption = 10; |
---|
| 31 | } |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | return powerConsumption; |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.