Revision 1600,
1.2 KB
checked in by wojtekp, 8 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Line | |
---|
1 | package test.fips.models.i5; |
---|
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 | |
---|
24 | } catch (Exception e){ |
---|
25 | } |
---|
26 | } |
---|
27 | for(Device device: nodeGroup.getResourceCharacteristic().getDevices()){ |
---|
28 | if(device.getType().equals(StandardResourceType.Fan)){ |
---|
29 | Fan fan = (Fan) device; |
---|
30 | powerConsumption = powerConsumption + fan.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
31 | } |
---|
32 | } |
---|
33 | return powerConsumption; |
---|
34 | } |
---|
35 | |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.