source: DCWoRMS/trunk/src/example/energy/BaseEnergyEstimationPlugin.java @ 477

Revision 477, 1.5 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package example.energy;
2
3import schedframe.Parameters;
4import schedframe.PluginConfiguration;
5import schedframe.resources.computing.ComputingResource;
6import schedframe.resources.computing.profiles.energy.EnergyEvent;
7import schedframe.resources.computing.profiles.energy.power.plugin.EnergyEstimationPlugin;
8import schedframe.scheduling.manager.tasks.JobRegistry;
9
10public abstract class BaseEnergyEstimationPlugin implements EnergyEstimationPlugin {
11
12        @Override
13        public PluginConfiguration getConfiguration() {
14                // TODO Auto-generated method stub
15                return null;
16        }
17       
18        @Override
19        public double estimatePowerConsumption(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resource) {
20                double power = 0;
21                try {
22                        return resource.getPowerInterface().getPowerConsumption(resource.getPowerInterface().getPowerState());
23                } catch (NoSuchFieldException e) {
24                        power = 0;
25                }
26                for(ComputingResource child:resource.getChildren()){
27                        power = power + child.getPowerInterface().getRecentPowerUsage().getValue();
28                }
29                return power;
30        }
31
32        @Override
33        public double estimateAirThroughput(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resourceManager) {
34                throw new RuntimeException("Not implemented.");
35        }
36
37        @Override
38        public double estimateTemperature(EnergyEvent event, JobRegistry jobRegistry, ComputingResource resourceManager) {
39                throw new RuntimeException("Not implemented.");
40        }
41       
42        public void init(Parameters parameters) {
43
44        }
45
46        public String getName() {
47                return getClass().getName();
48        }
49}
Note: See TracBrowser for help on using the repository browser.