Revision 1423,
1.2 KB
checked in by wojtekp, 11 years ago
(diff) |
|
-
Property svn:mime-type set to
text/plain
|
Rev | Line | |
---|
[1286] | 1 | package example.load; |
---|
| 2 | |
---|
[1423] | 3 | import schedframe.resources.ResourceStatus; |
---|
| 4 | import schedframe.resources.computing.Core; |
---|
[1286] | 5 | import schedframe.resources.computing.Processor; |
---|
[1415] | 6 | import schedframe.resources.computing.profiles.energy.ResourceEvent; |
---|
[1286] | 7 | import schedframe.resources.devices.PhysicalResource; |
---|
| 8 | import schedframe.scheduling.manager.tasks.JobRegistry; |
---|
| 9 | |
---|
| 10 | public class ProcessorLoadEstimationPlugin extends BaseLoadEstimationPlugin{ |
---|
| 11 | |
---|
[1415] | 12 | public double estimateUtlization(ResourceEvent event, JobRegistry jobRegistry, PhysicalResource resource) { |
---|
[1286] | 13 | Processor proc = (Processor) resource; |
---|
| 14 | double sumCoresLoad = 0; |
---|
[1423] | 15 | if(proc.getStatus().equals(ResourceStatus.BUSY)){ |
---|
| 16 | sumCoresLoad = 1; |
---|
| 17 | } else { |
---|
| 18 | if(proc.getCores().size() > 0){ |
---|
| 19 | for(Core core: proc.getCores()){ |
---|
| 20 | if(core.getStatus().equals(ResourceStatus.BUSY)){ |
---|
| 21 | sumCoresLoad = sumCoresLoad + 1; |
---|
| 22 | } |
---|
[1286] | 23 | } |
---|
[1423] | 24 | sumCoresLoad = sumCoresLoad / proc.getCores().size(); |
---|
[1299] | 25 | } |
---|
| 26 | } |
---|
| 27 | |
---|
[1286] | 28 | double processorLoad = 100 * sumCoresLoad; |
---|
| 29 | double calendarLoad = resource.getLoadInterface().getLoadCalendar().getCurrentLoad(); |
---|
| 30 | double totalLoad = processorLoad + calendarLoad; |
---|
| 31 | if (totalLoad > 100) |
---|
| 32 | return 100; |
---|
| 33 | else return totalLoad; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.