Revision 1415,
1.1 KB
checked in by wojtekp, 11 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[477] | 1 | package example.energy; |
---|
| 2 | |
---|
[1247] | 3 | import schedframe.resources.computing.Node; |
---|
[477] | 4 | import schedframe.resources.computing.Processor; |
---|
[1415] | 5 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
[1207] | 6 | import schedframe.resources.devices.Device; |
---|
| 7 | import schedframe.resources.devices.PhysicalResource; |
---|
[477] | 8 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
| 9 | |
---|
[1207] | 10 | public class NodeEnergyEstimationPlugin extends BaseEnergyEstimationPlugin { |
---|
[477] | 11 | |
---|
[1415] | 12 | public double estimatePowerConsumption(ResourceEvent event, JobRegistry jobRegistry, |
---|
[1207] | 13 | PhysicalResource resource) { |
---|
[532] | 14 | double powerConsumption = 0; |
---|
[1247] | 15 | Node node = (Node) resource; |
---|
[477] | 16 | for(Processor cpu: node.getProcessors()){ |
---|
| 17 | try{ |
---|
[532] | 18 | powerConsumption = powerConsumption + cpu.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
[497] | 19 | } catch (Exception e){ |
---|
| 20 | |
---|
[477] | 21 | } |
---|
| 22 | } |
---|
| 23 | try { |
---|
[532] | 24 | powerConsumption = powerConsumption + node.getPowerInterface().getPowerConsumption(node.getPowerInterface().getPowerState()); |
---|
[1207] | 25 | for(Device dev: node.getResourceCharacteristic().getDevices()){ |
---|
| 26 | powerConsumption = powerConsumption + dev.getPowerInterface().getRecentPowerUsage().getValue(); |
---|
| 27 | } |
---|
[477] | 28 | } catch (NoSuchFieldException e) { |
---|
| 29 | } |
---|
| 30 | |
---|
[532] | 31 | return powerConsumption; |
---|
[477] | 32 | } |
---|
| 33 | |
---|
| 34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.