Changeset 1415 for DCWoRMS/branches/coolemall/src/schedframe/scheduling
- Timestamp:
- 07/15/14 16:26:31 (11 years ago)
- Location:
- DCWoRMS/branches/coolemall/src/schedframe/scheduling
- Files:
-
- 9 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceItem.java
r1396 r1415 1 1 package schedframe.scheduling; 2 2 3 import java.util.HashSet;4 3 import java.util.LinkedList; 5 4 import java.util.List; 6 5 import java.util.Map; 7 6 import java.util.Set; 7 import java.util.TreeSet; 8 8 9 9 import schedframe.resources.computing.ComputingResource; … … 16 16 17 17 protected Map<ResourceUnitName, ResourceUnit> usedResources; 18 protected Set<String> visitedResources;18 protected Set<String> resourceNames; 19 19 20 20 public ResourceItem(Map<ResourceUnitName, ResourceUnit> usedResources){ 21 21 this.usedResources = usedResources; 22 this. visitedResources = new HashSet<String>();22 this.resourceNames = new TreeSet<String>(); 23 23 saveResourceNames(); 24 24 } … … 29 29 30 30 public Set<String> getResourceNames(){ 31 return visitedResources;31 return resourceNames; 32 32 } 33 33 … … 43 43 List<ComputingResource> resources = compResource.getChildren(); 44 44 if(resources.isEmpty()){ 45 if(! visitedResources.contains(compResource.getFullName())){46 visitedResources.add(compResource.getFullName());45 if(!resourceNames.contains(compResource.getFullName())){ 46 resourceNames.add(compResource.getFullName()); 47 47 } 48 48 } else { -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/Scheduler.java
r1362 r1415 63 63 List<Integer> schedRes = GridSim.getGridResourceList(); 64 64 schedRes.add(schedulerIdObj); 65 66 /*if (supportsAR) {67 res = GridSim.getAdvancedReservationList();68 res.add(resIdObj);69 } */70 71 65 } 72 66 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ClusterResourceManager.java
r1247 r1415 1 1 package schedframe.scheduling.manager.resources; 2 2 3 import java.util.ArrayList;4 3 import java.util.List; 5 4 import java.util.Properties; 6 5 7 import schedframe.exceptions.ResourceException;8 6 import schedframe.resources.StandardResourceType; 7 import schedframe.resources.computing.ComputingResource; 9 8 import schedframe.resources.computing.Node; 10 import schedframe.resources.computing.ComputingResource;11 9 import schedframe.resources.computing.Processor; 12 10 import schedframe.scheduling.Scheduler; … … 22 20 @SuppressWarnings("unchecked") 23 21 public List<Node> getNodes(){ 24 try { 25 return (List<Node>) getResourcesOfType(StandardResourceType.Node); 26 } catch (ResourceException e) { 27 return new ArrayList<Node>(); 28 } 22 return (List<Node>) getResourcesOfType(StandardResourceType.Node); 29 23 } 30 24 31 25 @SuppressWarnings("unchecked") 32 26 public List<Processor> getProcessors(){ 33 try { 34 return (List<Processor>) getResourcesOfType(StandardResourceType.Processor); 35 } catch (Exception e) { 36 return new ArrayList<Processor>(); 37 } 27 return (List<Processor>) getResourcesOfType(StandardResourceType.Processor); 38 28 } 39 29 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java
r1396 r1415 107 107 } 108 108 109 public List<? extends ComputingResource> getResourcesOfType(ResourceType type) throws ResourceException{109 public List<? extends ComputingResource> getResourcesOfType(ResourceType type) { 110 110 List<ComputingResource> resourcesOfType = new ArrayList<ComputingResource>(); 111 111 for (ComputingResource resource : computingResources) { … … 118 118 } 119 119 120 public List<? extends ComputingResource> getResourcesByTypeWithStatus(ResourceType type, ResourceStatus status) 121 throws ResourceException { 120 public List<? extends ComputingResource> getResourcesByTypeWithStatus(ResourceType type, ResourceStatus status){ 122 121 123 122 List<ComputingResource> resourcesOfType = new ArrayList<ComputingResource>(); … … 225 224 List<ComputingResource> computingResources = null; 226 225 if(areResourcesAchievable(StandardResourceType.Core)){ 227 try { 228 computingResources = (List<ComputingResource>) getResourcesOfType(StandardResourceType.Core); 229 } catch (ResourceException e) { 230 throw new RuntimeException("DCWorms internal error"); 231 } 226 227 computingResources = (List<ComputingResource>) getResourcesOfType(StandardResourceType.Core); 228 232 229 PEUnit peUnit = new ProcessingElements(computingResources); 233 230 peUnits = new ArrayList<ResourceUnit>(); … … 236 233 237 234 else if(areResourcesAchievable(StandardResourceType.Processor)){ 238 try { 239 computingResources = (List<ComputingResource>) getResourcesOfType(StandardResourceType.Processor); 240 } catch (ResourceException e) { 241 throw new RuntimeException("DCWorms internal error"); 242 } 235 236 computingResources = (List<ComputingResource>) getResourcesOfType(StandardResourceType.Processor); 237 243 238 PEUnit peUnit = new ProcessingElements(computingResources); 244 239 peUnits = new ArrayList<ResourceUnit>(); -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java
r1396 r1415 55 55 Set<String> visitedResource = task.getAllocatedResources().getLast().getResourceNames(); 56 56 for(String res: visitedResource){ 57 if(res. contains(context)){57 if(res.equals(context) || res.substring(0, res.lastIndexOf("/")).contains(context)){ 58 58 taskList.add(task); 59 59 break; 60 60 } 61 61 } 62 if(task.getSchedulerName(). contains(context)) {62 if(task.getSchedulerName().equals(context)) { 63 63 taskList.add(task); 64 64 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/local/LocalSchedulingPlugin.java
r1396 r1415 1 1 package schedframe.scheduling.plugin.local; 2 2 3 import schedframe.events.scheduling.SchedulingEvent;4 import schedframe.events.scheduling.SchedulingResponseType;5 import schedframe.scheduling.manager.resources.ResourceManager;6 import schedframe.scheduling.manager.tasks.JobRegistry;7 import schedframe.scheduling.plugin.ModuleList;8 3 import schedframe.scheduling.plugin.SchedulingPlugin; 9 import schedframe.scheduling.queue.TaskQueueList;10 4 11 5 12 6 public interface LocalSchedulingPlugin extends SchedulingPlugin { 13 7 14 public SchedulingResponseType handleResourceAllocationViolation(SchedulingEvent event,15 TaskQueueList queues,16 JobRegistry jobRegistry,17 ResourceManager resourceManager, ModuleList modules);18 8 19 9 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/global/GlobalManagementSystem.java
r1385 r1415 78 78 return; 79 79 } 80 81 80 registerWorkloadUnit(wu); 82 81 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
r1396 r1415 19 19 import schedframe.events.scheduling.StartTaskExecutionEvent; 20 20 import schedframe.events.scheduling.TaskFinishedEvent; 21 import schedframe.events.scheduling.TaskPausedEvent; 21 22 import schedframe.events.scheduling.TaskRequestedTimeExpiredEvent; 23 import schedframe.events.scheduling.TaskResumedEvent; 22 24 import schedframe.exceptions.ResourceException; 23 25 import schedframe.resources.StandardResourceType; 24 26 import schedframe.resources.computing.ComputingResource; 25 import schedframe.resources.computing.profiles.energy. EnergyEvent;26 import schedframe.resources.computing.profiles.energy. EnergyEventType;27 import schedframe.resources.computing.profiles.energy.ResourceEvent; 28 import schedframe.resources.computing.profiles.energy.ResourceEventType; 27 29 import schedframe.resources.units.PEUnit; 28 30 import schedframe.resources.units.ProcessingElements; … … 163 165 String[] ids = (String[]) ev.get_data(); 164 166 execTask = jobRegistry.getTask(ids[0], ids[1]); 165 taskPause(execTask);167 pauseTask(execTask); 166 168 if (pluginSupportsEvent(tag)) { 167 SchedulingEvent event = new SchedulingEvent(SchedulingEventType.TASK_PAUSED);169 SchedulingEvent event = new TaskPausedEvent(ids[0], ids[1]); 168 170 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 169 171 queues, jobRegistry, getResourceManager(), moduleList); … … 176 178 String[] ids = (String[]) ev.get_data(); 177 179 execTask = jobRegistry.getTask(ids[0], ids[1]); 178 taskResume(execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), true);180 resumeTask(execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), true); 179 181 if (pluginSupportsEvent(tag)) { 180 SchedulingEvent event = new StartTaskExecutionEvent(ids[0], ids[1]);182 SchedulingEvent event = new TaskResumedEvent(ids[0], ids[1]); 181 183 SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 182 184 queues, jobRegistry, getResourceManager(), moduleList); … … 189 191 Object[] data = (Object[]) ev.get_data(); 190 192 execTask = jobRegistry.getTask((String)data[0], (String)data[1]); 191 double migrationTime = execTimeEstimationPlugin.estimateMigrationTime(new StartTaskExecutionEvent((String)data[0], (String)data[1]), execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), (Map<ResourceUnitName, ResourceUnit>)data[2]); 193 double migrationTime = execTimeEstimationPlugin.estimateMigrationTime(new StartTaskExecutionEvent((String)data[0], 194 (String)data[1]), execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), (Map<ResourceUnitName, ResourceUnit>)data[2]); 192 195 scheduler.sendInternal(migrationTime, DCWormsTags.TASK_MOVE, data); 193 196 } … … 197 200 Object[] data = (Object[]) ev.get_data(); 198 201 execTask = jobRegistry.getTask((String)data[0], (String)data[1]); 199 taskMove(execTask, (Map<ResourceUnitName, ResourceUnit>)data[2]);202 moveTask(execTask, (Map<ResourceUnitName, ResourceUnit>)data[2]); 200 203 if (pluginSupportsEvent(tag)) { 201 204 SchedulingEvent event = new StartTaskExecutionEvent((String)data[0], (String)data[1]); … … 209 212 case DCWormsTags.TASK_EXECUTION_CHANGED: 210 213 execTask = (ExecTask) ev.get_data(); 211 updateTaskExecutionPhase(execTask , SchedulingEventType.RESOURCE_STATE_CHANGED);214 updateTaskExecutionPhase(execTask); 212 215 break; 213 216 … … 231 234 } 232 235 break; 233 } 234 } 235 236 237 public void taskPause(ExecTask execTask) { 236 default: 237 238 break; 239 } 240 } 241 242 243 protected void pauseTask(ExecTask execTask) { 238 244 if (execTask == null) { 239 245 return; … … 246 252 getAllocationManager().freeResources(lastUsed, true); 247 253 248 saveExecutionHistory(exec, exec.get CompletionPercentage(), exec.getEstimatedDuration());254 saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), exec.getEstimatedDuration()); 249 255 250 256 ExecTaskFilter filter = new ExecTaskFilter(exec.getUniqueId(), -1); … … 252 258 253 259 PEUnit peUnit = (PEUnit)lastUsed.get(StandardResourceUnitName.PE); 254 updateComputingResources(peUnit, EnergyEventType.TASK_FINISHED, exec);260 updateComputingResources(peUnit, ResourceEventType.TASK_FINISHED, exec); 255 261 } catch (Exception e) { 256 262 // TODO Auto-generated catch block … … 260 266 } 261 267 262 p ublic void taskResume(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> resources, boolean exclusive) {268 protected void resumeTask(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> resources, boolean exclusive) { 263 269 if (execTask == null) { 264 270 return; … … 278 284 279 285 PEUnit peUnit = (PEUnit)resources.get(StandardResourceUnitName.PE); 280 updateComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec);286 updateComputingResources(peUnit, ResourceEventType.TASK_STARTED, exec); 281 287 } 282 288 … … 288 294 } 289 295 290 p ublic void taskMove(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> map) {291 taskPause(execTask);292 taskResume(execTask, map, false);296 protected void moveTask(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> map) { 297 pauseTask(execTask); 298 resumeTask(execTask, map, false); 293 299 } 294 300 … … 351 357 352 358 PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE); 353 updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);359 updateComputingResources(peUnit, ResourceEventType.UTILIZATION_CHANGED, exec); 354 360 355 361 … … 377 383 378 384 int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.START_TASK_EXECUTION), 379 execTask, resources, exec.get CompletionPercentage())).intValue();380 381 saveExecutionHistory(exec, exec.get CompletionPercentage(), phaseDuration);385 execTask, resources, exec.getExecutionProfile().getCompletionPercentage())).intValue(); 386 387 saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), phaseDuration); 382 388 if(exec.getExecutionProfile().isLast()){ 383 389 scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_FINISHED, execTask);; … … 387 393 388 394 PEUnit peUnit = (PEUnit)resources.get(StandardResourceUnitName.PE); 389 updateComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec);395 updateComputingResources(peUnit, ResourceEventType.TASK_STARTED, exec); 390 396 391 397 } … … 429 435 430 436 PEUnit peUnit = (PEUnit)lastUsed.get(StandardResourceUnitName.PE); 431 updateComputingResources(peUnit, EnergyEventType.TASK_FINISHED, exec);437 updateComputingResources(peUnit, ResourceEventType.TASK_FINISHED, exec); 432 438 433 439 log.debug(execTask.getJobId() + "_" + execTask.getId() + " finished execution on " + new DateTime()); 434 440 log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad()); 435 441 436 updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);442 updateComputingResources(peUnit, ResourceEventType.UTILIZATION_CHANGED, exec); 437 443 } 438 444 … … 452 458 //System.out.println("--- upadteProgressX: " + Sim_system.sim_clock() ); 453 459 //System.out.println("taskId: " + exec.getId() + "; completion percentage: " + exec.getCompletionPercentage() + "; timespan: " + timeSpan + "; estimatedDuration: " + execHistItem.getCompletionPercentage()); 454 exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / (execHistItem.getEstimatedDuration()) * (1.0 - execHistItem.getCompletionPercentage()/100.0))); 460 exec.getExecutionProfile().setCompletionPercentage(exec.getExecutionProfile().getCompletionPercentage() + 100 * (timeSpan / (execHistItem.getEstimatedDuration()) * (1.0 - execHistItem.getCompletionPercentage()/100.0))); 461 exec.setTotalCompletionPercentage(exec.getTotalCompletionPercentage() + 100 * (timeSpan / execHistItem.getEstimatedDuration()) * exec.getExecutionProfile().getCurrentResourceConsumption().getLenght() / exec.getExecutionProfile().getLength()); 455 462 //System.out.println("newProgress: " + exec.getCompletionPercentage() ); 456 463 … … 458 465 } 459 466 460 private void updateComputingResources(PEUnit peUnit, EnergyEventType eventType, Object obj){467 private void updateComputingResources(PEUnit peUnit, ResourceEventType eventType, Object obj){ 461 468 if(peUnit instanceof ProcessingElements){ 462 469 ProcessingElements pes = (ProcessingElements) peUnit; 463 470 for (ComputingResource resource : pes) { 464 resource.handleEvent(new EnergyEvent(eventType, obj, scheduler.getFullName()));471 resource.handleEvent(new ResourceEvent(eventType, obj, scheduler.getFullName())); 465 472 //DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(eventType, obj)); 466 473 } … … 480 487 return; 481 488 } 482 resource.handleEvent(new EnergyEvent(eventType, obj, scheduler.getFullName()));489 resource.handleEvent(new ResourceEvent(eventType, obj, scheduler.getFullName())); 483 490 } 484 491 } … … 492 499 493 500 int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.RESOURCE_STATE_CHANGED), 494 execTask, choosenResources, exec.get CompletionPercentage())).intValue();501 execTask, choosenResources, exec.getExecutionProfile().getCompletionPercentage())).intValue(); 495 502 496 503 ExecutionHistoryItem execHistItem = exec.getExecutionHistory().getLast(); 497 double lastTimeStamp = execHistItem.getTimeStamp().getMillis() /1000;498 if(DoubleMath.subtract((lastTimeStamp + execHistItem.getEstimatedDuration()), (new DateTime().getMillis() /1000 + phaseDuration)) == 0.0){504 double lastTimeStamp = execHistItem.getTimeStamp().getMillis() / 1000; 505 if(DoubleMath.subtract((lastTimeStamp + execHistItem.getEstimatedDuration()), (new DateTime().getMillis() / 1000 + phaseDuration)) == 0.0){ 499 506 continue; 500 507 } … … 504 511 //System.out.println("completionPercantage: " + exec.getCompletionPercentage() + "; basic duration: " +exec.getResourceConsumptionProfile().getCurrentResourceConsumption().getDuration() + "; phaseDuration: " + phaseDuration); 505 512 506 saveExecutionHistory(exec, exec.get CompletionPercentage(), phaseDuration);513 saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), phaseDuration); 507 514 508 515 if(exec.getExecutionProfile().isLast()){ … … 522 529 } 523 530 524 protected void updateTaskExecutionPhase(ExecTask execTask , SchedulingEventType schedEvType) {531 protected void updateTaskExecutionPhase(ExecTask execTask) { 525 532 526 533 if (execTask.getStatus() == DCWormsTags.INEXEC) { … … 535 542 Map<ResourceUnitName, ResourceUnit> choosenResources = exec.getAllocatedResources().getLast().getResourceUnits(); 536 543 537 int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent( schedEvType),538 execTask, choosenResources, exec.get CompletionPercentage())).intValue();539 540 saveExecutionHistory(exec, exec.get CompletionPercentage(), phaseDuration);544 int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.TASK_EXECUTION_CHANGED), 545 execTask, choosenResources, exec.getExecutionProfile().getCompletionPercentage())).intValue(); 546 547 saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), phaseDuration); 541 548 542 549 if(exec.getExecutionProfile().isLast()){ … … 547 554 548 555 PEUnit peUnit = (PEUnit)exec.getAllocatedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE); 549 updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);556 updateComputingResources(peUnit, ResourceEventType.UTILIZATION_CHANGED, exec); 550 557 } 551 558 } 552 559 553 p ublicdouble calculateTotalLoad() {560 protected double calculateTotalLoad() { 554 561 555 562 DCwormsAccumulator loadAcc = new DCwormsAccumulator(); 556 try { 557 for(ComputingResource compRes: getResourceManager().getResourcesOfType(StandardResourceType.Node)){ 558 loadAcc.add(compRes.getLoadInterface().getRecentUtilization().getValue()); 559 } 560 } catch (ResourceException e) { 561 // TODO Auto-generated catch block 562 e.printStackTrace(); 563 } 564 563 564 for(ComputingResource compRes: getResourceManager().getResourcesOfType(StandardResourceType.Node)){ 565 loadAcc.add(compRes.getLoadInterface().getRecentUtilization().getValue()); 566 } 567 565 568 return loadAcc.getMean(); 566 569 } … … 703 706 704 707 private void saveExecutionHistory(Executable exec, double completionPercentage, double estimatedDuration){ 705 706 708 ExecutionHistoryItem execHistoryItem = new ExecutionHistoryItem(new DateTime()); 707 709 execHistoryItem.setCompletionPercentage(completionPercentage); … … 710 712 execHistoryItem.setStatus(exec.getStatus()); 711 713 exec.addExecHistory(execHistoryItem); 712 713 714 } 714 715 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionPhase.java
r1207 r1415 13 13 import org.qcg.broker.schemas.resreqs.ResourceConsumptionType; 14 14 15 public class ResourceConsumption{15 public class ExecutionPhase { 16 16 17 17 protected String id; 18 18 protected Map<String, String> referenceHardware; 19 protected long duration; 20 protected List<PhaseBehaviour> phaseBehaviourList; 19 protected long originDuration; 20 protected long lenght; 21 protected List<PhaseSystemLoad> systemLoad; 21 22 22 public ResourceConsumption(long duration, ComputingResourceBaseTypeItem item[]){23 public ExecutionPhase(long duration, ComputingResourceBaseTypeItem item[]){ 23 24 this.id = null; 24 25 this.referenceHardware = null; 25 this. duration = duration;26 this. phaseBehaviourList = new ArrayList<PhaseBehaviour>();26 this.originDuration = duration; 27 this.systemLoad = new ArrayList<PhaseSystemLoad>(); 27 28 for(ComputingResourceBaseTypeItem compResItem: item){ 28 29 ComputingResourceParameterType hostParameter = compResItem.getHostParameter(); 29 Phase Behaviour pb = new PhaseBehaviour(hostParameter.getName().toString());30 phaseBehaviourList.add(pb);30 PhaseSystemLoad pb = new PhaseSystemLoad(hostParameter.getName().toString()); 31 systemLoad.add(pb); 31 32 } 33 this.lenght = duration; 32 34 } 33 35 34 public ResourceConsumption(ResourceConsumptionType resConsumptionType){36 public ExecutionPhase(ResourceConsumptionType resConsumptionType){ 35 37 this.id = resConsumptionType.getId(); 36 38 this.referenceHardware = new HashMap<String, String>(); 39 this.originDuration = resConsumptionType.getDuration().toLong() / 1000; 40 41 double speed = 1; 37 42 if(resConsumptionType.getReferenceHardware() != null){ 38 43 for (int i = 0; i < resConsumptionType.getReferenceHardware().getReference().length; i++){ 39 44 StringParameterType spt = resConsumptionType.getReferenceHardware().getReference(i); 40 referenceHardware.put(spt.getName(), spt.getContent()); 45 this.referenceHardware.put(spt.getName(), spt.getContent()); 46 if(spt.getName().equals("cpu_maxfreq")){ 47 speed = new Double(spt.getContent()); 48 } 41 49 } 42 50 } 43 this. duration = resConsumptionType.getDuration().toLong()/1000;44 this.phaseBehaviourList = new ArrayList<PhaseBehaviour>();51 this.systemLoad = new ArrayList<PhaseSystemLoad>(); 52 int nrOfThreads = 1; 45 53 for(PhaseBehaviourType pbt: resConsumptionType.getBehaviour()){ 46 PhaseBehaviour pb = new PhaseBehaviour(pbt); 47 phaseBehaviourList.add(pb); 54 PhaseSystemLoad pb = new PhaseSystemLoad(pbt); 55 this.systemLoad.add(pb); 56 if(pbt.getName().equals("PM_Threads")){ 57 nrOfThreads = new Double(pbt.getParameterTypeChoice().getParameterTypeChoiceItem(0).getParameterValue().getContent()).intValue(); 58 } 48 59 } 60 this.lenght = (long) (originDuration * nrOfThreads * speed); 49 61 } 50 62 … … 62 74 63 75 public long getDuration() { 64 return duration;76 return originDuration; 65 77 } 66 78 67 public List<PhaseBehaviour> getBehaviourList() { 68 return phaseBehaviourList; 79 public List<PhaseSystemLoad> getSystemLoad() { 80 return systemLoad; 81 } 82 83 public long getLenght() { 84 return lenght; 69 85 } 70 86 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java
r1362 r1415 5 5 public class ExecutionProfile { 6 6 7 protected LinkedList< ResourceConsumption> resourceConsumptionList;7 protected LinkedList<ExecutionPhase> resourceConsumptionList; 8 8 protected long usefulWork; 9 protected double completionPercentage; 9 10 private int currentPhase; 11 10 12 11 public ExecutionProfile(LinkedList< ResourceConsumption> resourceConsumptionList) {13 public ExecutionProfile(LinkedList<ExecutionPhase> resourceConsumptionList) { 12 14 this.resourceConsumptionList = resourceConsumptionList; 15 this.completionPercentage = 0; 13 16 this.currentPhase = 0; 14 17 } 15 18 16 public LinkedList< ResourceConsumption> getResourceConsumptionList(){19 public LinkedList<ExecutionPhase> getResourceConsumptionList(){ 17 20 return resourceConsumptionList; 18 21 } 19 22 20 public ResourceConsumptiongetCurrentResourceConsumption(){23 public ExecutionPhase getCurrentResourceConsumption(){ 21 24 return resourceConsumptionList.get(currentPhase); 22 25 } … … 44 47 return false; 45 48 } 49 50 public double getCompletionPercentage() { 51 return completionPercentage; 52 } 53 54 public void setCompletionPercentage(double completionPercentage) { 55 this.completionPercentage = completionPercentage; 56 } 57 58 public long getLength() { 59 long length = 0; 60 for(ExecutionPhase execPhase: resourceConsumptionList){ 61 length = length + execPhase.getLenght(); 62 } 63 return length; 64 } 46 65 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/PhaseSystemLoad.java
r883 r1415 3 3 import org.qcg.broker.schemas.resreqs.PhaseBehaviourType; 4 4 5 public class Phase Behaviour{5 public class PhaseSystemLoad { 6 6 7 7 protected String resName; 8 8 protected double utilization; 9 9 10 Phase Behaviour(String resName, double utilization) {10 PhaseSystemLoad(String resName, double utilization) { 11 11 this.resName = resName; 12 12 this.utilization = utilization; 13 13 } 14 14 15 Phase Behaviour(String resName) {15 PhaseSystemLoad(String resName) { 16 16 this.resName = resName; 17 17 this.utilization = 100; 18 18 } 19 19 20 Phase Behaviour(PhaseBehaviourType pbt) {20 PhaseSystemLoad(PhaseBehaviourType pbt) { 21 21 this.resName = pbt.getName(); 22 22 this.utilization = pbt.getParameterTypeChoice().getParameterTypeChoiceItem(0).getParameterValue().getContent();
Note: See TracChangeset
for help on using the changeset viewer.