Revision 152,
1.2 KB
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 test.rewolucja.energy.EnergyEvent; |
---|
| 6 | import test.rewolucja.resources.physical.base.ComputingResource; |
---|
| 7 | import test.rewolucja.resources.physical.implementation.CPU; |
---|
| 8 | import test.rewolucja.resources.physical.implementation.ComputingNode; |
---|
| 9 | import test.rewolucja.scheduling.JobRegistryInterface; |
---|
| 10 | |
---|
[152] | 11 | public class ComputingNodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
[104] | 12 | |
---|
| 13 | @Override |
---|
| 14 | public double estimatePowerConsumption(EnergyEvent event, JobRegistryInterface jobRegistry, |
---|
| 15 | ComputingResource resource) { |
---|
| 16 | double power = 0; |
---|
| 17 | ComputingNode node = (ComputingNode) resource; |
---|
| 18 | for(CPU cpu: node.getProcessors()){ |
---|
| 19 | //try{ |
---|
| 20 | power = power + cpu.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 21 | //} catch(Exception e){ |
---|
| 22 | // power = power + cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPowerState()); |
---|
| 23 | //} |
---|
| 24 | } |
---|
| 25 | power += node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); |
---|
| 26 | return power; |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | public String getName() { |
---|
[152] | 30 | return getClass().getName(); |
---|
[104] | 31 | } |
---|
| 32 | |
---|
| 33 | public void init(Properties properties) { |
---|
| 34 | // TODO Auto-generated method stub |
---|
| 35 | |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.