Revision 241,
1.4 KB
checked in by piontek, 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; |
---|
[241] | 7 | import test.rewolucja.resources.physical.implementation.ComputingNode; |
---|
[206] | 8 | import test.rewolucja.resources.physical.implementation.Processor; |
---|
[104] | 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; |
---|
[241] | 18 | |
---|
| 19 | if( node.getCategory().getName().equals("A")) |
---|
| 20 | power = 240; |
---|
| 21 | else if( node.getCategory().getName().equals("B")) |
---|
| 22 | power = 95; |
---|
| 23 | else |
---|
| 24 | { |
---|
| 25 | System.err.println("Unknown Model: " +node.getCategory().getName()); |
---|
| 26 | System.exit(1); |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | |
---|
[206] | 31 | for(Processor cpu: node.getProcessors()){ |
---|
[104] | 32 | //try{ |
---|
| 33 | power = power + cpu.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 34 | //} catch(Exception e){ |
---|
| 35 | // power = power + cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPowerState()); |
---|
| 36 | //} |
---|
| 37 | } |
---|
[241] | 38 | //power += node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); |
---|
[104] | 39 | return power; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | public String getName() { |
---|
[152] | 43 | return getClass().getName(); |
---|
[104] | 44 | } |
---|
| 45 | |
---|
| 46 | public void init(Properties properties) { |
---|
| 47 | // TODO Auto-generated method stub |
---|
| 48 | |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.