Changeset 539 for DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/EnergyExtension.java
- Timestamp:
- 10/31/12 13:52:06 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/build/classes/schedframe/resources/computing/profiles/energy/EnergyExtension.java
r477 r539 11 11 import schedframe.resources.computing.extensions.ExtensionException; 12 12 import schedframe.resources.computing.extensions.ExtensionType; 13 import schedframe.resources.computing.profiles.energy.airthroughput.AirThroughputProfile; 14 import schedframe.resources.computing.profiles.energy.airthroughput.ui.AirThroughputInterface; 13 15 import schedframe.resources.computing.profiles.energy.power.PowerProfile; 14 16 import schedframe.resources.computing.profiles.energy.power.ui.PowerInterface; 15 17 import schedframe.scheduling.manager.tasks.JobRegistryImpl; 16 18 17 public class EnergyExtension implements Extension /*, ResourceVisitor */{19 public class EnergyExtension implements Extension{ 18 20 19 21 private Log log = LogFactory.getLog(EnergyExtension.class); … … 21 23 protected PowerInterface powerInterface; 22 24 protected PowerProfile powerProfile; 23 25 26 protected AirThroughputInterface airFlowInterface; 27 protected AirThroughputProfile airFlowProfile; 28 24 29 protected ComputingResource computingResource; 25 30 … … 29 34 } 30 35 31 @Override 36 public EnergyExtension(PowerInterface powerInterface, PowerProfile powerProfile, 37 AirThroughputInterface airFlowInterface, AirThroughputProfile airFlowProfile) { 38 super(); 39 this.powerInterface = powerInterface; 40 this.powerProfile = powerProfile; 41 this.airFlowInterface = airFlowInterface; 42 this.airFlowProfile = airFlowProfile; 43 } 44 32 45 public boolean supportsEvent(Event event) { 33 46 34 47 if(powerProfile == null || powerProfile.getEnergyEstimationPlugin() == null) 35 48 return false; 36 37 49 if(event.getType().getName().equals(EnergyEventType.POWER_STATE_CHANGED.getName())) 38 50 return true; … … 43 55 else if(event.getType().getName().equals(EnergyEventType.TASK_FINISHED.getName())) 44 56 return true; 57 58 if(airFlowProfile == null) 59 return false; 60 if(event.getType().getName().equals(EnergyEventType.AIRFLOW_STATE_CHANGED.getName())) 61 return true; 62 45 63 else return false; 46 64 47 65 } 48 49 66 50 @Override51 67 public void handleEvent(Event event) { 52 68 EnergyEvent enEvent = (EnergyEvent)event; … … 87 103 //System.out.println(this.resource.getName() + " - ESTIMATED ENERGY:" + power); 88 104 powerProfile.addToPowerUsageHistory(power); 89 105 break; 106 case AIRFLOW_STATE_CHANGED: 107 System.out.println("====="); 108 double airFlow = powerProfile.getEnergyEstimationPlugin().estimateAirThroughput(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 109 airFlowProfile.addToPowerUsageHistory(airFlow); 110 power = powerProfile.getEnergyEstimationPlugin().estimatePowerConsumption(enEvent, new JobRegistryImpl(computingResource.getName()), computingResource); 111 powerProfile.addToPowerUsageHistory(power); 90 112 break; 91 113 } 92 114 } 93 94 @Override 115 95 116 public void init(Properties properties) throws ExtensionException { 96 117 // TODO Auto-generated method stub 97 118 } 98 119 99 @Override100 120 public ExtensionType getType() { 101 121 return ExtensionType.ENERGY_EXTENSION; … … 118 138 } 119 139 140 public AirThroughputInterface getAirThroughputInterface() { 141 return airFlowInterface; 142 } 143 144 public AirThroughputProfile getAirFlowProfile() { 145 return airFlowProfile; 146 } 120 147 121 148 }
Note: See TracChangeset
for help on using the changeset viewer.