Line | |
---|
1 | package experiments.simpat2014.models.article; |
---|
2 | |
---|
3 | import schedframe.resources.StandardResourceType; |
---|
4 | import schedframe.resources.computing.Node; |
---|
5 | import schedframe.resources.computing.coolemall.NodeGroup; |
---|
6 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
7 | import schedframe.resources.devices.Device; |
---|
8 | import schedframe.resources.devices.Fan; |
---|
9 | import schedframe.resources.devices.PhysicalResource; |
---|
10 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
11 | import example.energy.BaseEnergyEstimationPlugin; |
---|
12 | |
---|
13 | public class NodeGroupEnergyEstimationPlugin extends BaseEnergyEstimationPlugin{ |
---|
14 | |
---|
15 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
16 | PhysicalResource resource) { |
---|
17 | |
---|
18 | double powerConsumption = 0; |
---|
19 | NodeGroup nodeGroup = (NodeGroup)resource; |
---|
20 | for(Node node: nodeGroup.getNodes()){ |
---|
21 | try{ |
---|
22 | powerConsumption = powerConsumption + node.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
23 | powerConsumption = powerConsumption + node.getProcessors().get(0).getResourceCharacteristic().getDevices().get(0).getPowerInterface().getRecentPowerUsage().getValue(); |
---|
24 | |
---|
25 | } catch (Exception e){ |
---|
26 | } |
---|
27 | } |
---|
28 | for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ |
---|
29 | if(device.getType().equals(StandardResourceType.Fan)){ |
---|
30 | Fan fan = (Fan) device; |
---|
31 | powerConsumption = powerConsumption + fan.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
32 | } |
---|
33 | } |
---|
34 | return powerConsumption; |
---|
35 | } |
---|
36 | |
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.