Revision 150,
1.1 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 schedframe.resources.profile.PowerUsage; |
---|
6 | import test.rewolucja.energy.EnergyEvent; |
---|
7 | import test.rewolucja.resources.physical.base.ComputingResource; |
---|
8 | import test.rewolucja.resources.physical.implementation.ComputingNode; |
---|
9 | import test.rewolucja.scheduling.JobRegistryInterface; |
---|
10 | |
---|
11 | public class DataCenterEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{ |
---|
12 | |
---|
13 | @Override |
---|
14 | public double estimatePowerConsumption(EnergyEvent event, JobRegistryInterface jobRegistry, |
---|
15 | ComputingResource resource) { |
---|
16 | double power = 0; |
---|
17 | for(ComputingResource child:resource.getChildren()){ |
---|
18 | ComputingNode node = (ComputingNode)child; |
---|
19 | PowerUsage powerUsage = node.getPowerInterface().getRecentPowerUsage(); |
---|
20 | power += (powerUsage == null ? 0 : powerUsage.getValue()); |
---|
21 | } |
---|
22 | |
---|
23 | //System.out.println( new DateTime() + "ENERGY CONSUMPT BY: " + resMan.getResourceName() +" IS: " + power); |
---|
24 | return power; |
---|
25 | } |
---|
26 | |
---|
27 | public String getName() { |
---|
28 | return getClass().getName(); |
---|
29 | } |
---|
30 | |
---|
31 | public void init(Properties properties) { |
---|
32 | // TODO Auto-generated method stub |
---|
33 | |
---|
34 | } |
---|
35 | |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.