Changeset 1423 for DCWoRMS/branches/coolemall/src/example/load
- Timestamp:
- 07/30/14 12:25:00 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/example/load
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/example/load/ProcessorLoadEstimationPlugin.java
r1415 r1423 1 1 package example.load; 2 2 3 import schedframe.resources.ResourceStatus; 4 import schedframe.resources.computing.Core; 3 5 import schedframe.resources.computing.Processor; 4 6 import schedframe.resources.computing.profiles.energy.ResourceEvent; 5 7 import schedframe.resources.devices.PhysicalResource; 6 8 import schedframe.scheduling.manager.tasks.JobRegistry; 7 import schedframe.scheduling.manager.tasks.JobRegistryImpl;8 import schedframe.scheduling.tasks.phases.PhaseSystemLoad;9 import dcworms.schedframe.scheduling.ExecTask;10 9 11 10 public class ProcessorLoadEstimationPlugin extends BaseLoadEstimationPlugin{ … … 14 13 Processor proc = (Processor) resource; 15 14 double sumCoresLoad = 0; 16 17 double nrOfThreadsOnCpu = proc.getCores().size(); 18 19 if(proc.getResourceCharacteristic().getParameters().get("threads") != null){ 20 nrOfThreadsOnCpu = nrOfThreadsOnCpu * Integer.valueOf(proc.getResourceCharacteristic().getParameters().get("threads").get(0).getContent()).intValue(); 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 } 23 } 24 sumCoresLoad = sumCoresLoad / proc.getCores().size(); 25 } 21 26 } 22 23 24 JobRegistry jr = new JobRegistryImpl(proc.getFullName());25 for(ExecTask task: jr.getRunningTasks()){26 double cpuUsage = 1 / nrOfThreadsOnCpu;27 28 for(PhaseSystemLoad pb: task.getExecutionProfile().getCurrentResourceConsumption().getSystemLoad()){29 if(pb.getResouceName().equals("PM_CPU_Usage")){30 cpuUsage = pb.getUtilization();31 }32 }33 sumCoresLoad = sumCoresLoad + cpuUsage;34 35 }36 37 27 38 28 double processorLoad = 100 * sumCoresLoad;
Note: See TracChangeset
for help on using the changeset viewer.