Revision 206,
1.2 KB
checked in by wojtekp, 13 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Line | |
---|
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.Processor; |
---|
8 | import test.rewolucja.resources.physical.implementation.ComputingNode; |
---|
9 | import test.rewolucja.scheduling.JobRegistryInterface; |
---|
10 | |
---|
11 | public class ComputingNodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
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(Processor 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() { |
---|
30 | return getClass().getName(); |
---|
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.