1 | package example.energy; |
---|
2 | |
---|
3 | import java.util.Properties; |
---|
4 | |
---|
5 | import test.rewolucja.energy.EnergyEvent; |
---|
6 | import test.rewolucja.energy.plugin.EnergyEstimationPluginInterface; |
---|
7 | import test.rewolucja.resources.physical.base.ComputingResource; |
---|
8 | import test.rewolucja.resources.physical.implementation.CPU; |
---|
9 | import test.rewolucja.resources.physical.implementation.ComputingNode; |
---|
10 | import test.rewolucja.scheduling.JobRegistryInterface; |
---|
11 | import test.rewolucja.scheduling.PluginConfiguration; |
---|
12 | |
---|
13 | public class ComputingNodeEnergyEstimationPlugin implements EnergyEstimationPluginInterface { |
---|
14 | |
---|
15 | @Override |
---|
16 | public double estimatePowerConsumption(EnergyEvent event, JobRegistryInterface jobRegistry, |
---|
17 | ComputingResource resource) { |
---|
18 | double power = 0; |
---|
19 | ComputingNode node = (ComputingNode) resource; |
---|
20 | for(CPU cpu: node.getProcessors()){ |
---|
21 | //try{ |
---|
22 | power = power + cpu.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
23 | //} catch(Exception e){ |
---|
24 | // power = power + cpu.getPowerInterface().getPowerConsumption(cpu.getPowerInterface().getPowerState()); |
---|
25 | //} |
---|
26 | } |
---|
27 | power += node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); |
---|
28 | return power; |
---|
29 | } |
---|
30 | |
---|
31 | @Override |
---|
32 | public String getName() { |
---|
33 | // TODO Auto-generated method stub |
---|
34 | return null; |
---|
35 | } |
---|
36 | |
---|
37 | @Override |
---|
38 | public void init(Properties properties) { |
---|
39 | // TODO Auto-generated method stub |
---|
40 | |
---|
41 | } |
---|
42 | |
---|
43 | @Override |
---|
44 | public PluginConfiguration getConfiguration() { |
---|
45 | // TODO Auto-generated method stub |
---|
46 | return null; |
---|
47 | } |
---|
48 | |
---|
49 | @Override |
---|
50 | public double estimateEnergyDissipation(EnergyEvent event, JobRegistryInterface jobRegistry, ComputingResource resourceManager) { |
---|
51 | // TODO Auto-generated method stub |
---|
52 | return 0; |
---|
53 | } |
---|
54 | |
---|
55 | @Override |
---|
56 | public double estimateTemperature(EnergyEvent event, JobRegistryInterface jobRegistry, ComputingResource resourceManager) { |
---|
57 | // TODO Auto-generated method stub |
---|
58 | return 0; |
---|
59 | } |
---|
60 | |
---|
61 | } |
---|