Revision 150,
1.1 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 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 | |
---|
[150] | 11 | public class DataCenterEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{ |
---|
[104] | 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 | } |
---|
[150] | 22 | |
---|
[104] | 23 | //System.out.println( new DateTime() + "ENERGY CONSUMPT BY: " + resMan.getResourceName() +" IS: " + power); |
---|
| 24 | return power; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | public String getName() { |
---|
[150] | 28 | return getClass().getName(); |
---|
[104] | 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.