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