Ignore:
Timestamp:
07/15/14 16:26:31 (11 years ago)
Author:
wojtekp
Message:
 
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  
    11package schedframe.scheduling; 
    22 
    3 import java.util.HashSet; 
    43import java.util.LinkedList; 
    54import java.util.List; 
    65import java.util.Map; 
    76import java.util.Set; 
     7import java.util.TreeSet; 
    88 
    99import schedframe.resources.computing.ComputingResource; 
     
    1616 
    1717        protected Map<ResourceUnitName, ResourceUnit> usedResources; 
    18         protected Set<String> visitedResources; 
     18        protected Set<String> resourceNames; 
    1919 
    2020        public ResourceItem(Map<ResourceUnitName, ResourceUnit> usedResources){ 
    2121                this.usedResources = usedResources; 
    22                 this.visitedResources = new HashSet<String>(); 
     22                this.resourceNames = new TreeSet<String>(); 
    2323                saveResourceNames(); 
    2424        } 
     
    2929         
    3030        public Set<String> getResourceNames(){ 
    31                 return visitedResources; 
     31                return resourceNames; 
    3232        } 
    3333         
     
    4343                                List<ComputingResource> resources = compResource.getChildren(); 
    4444                                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()); 
    4747                                        } 
    4848                                } else { 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/Scheduler.java

    r1362 r1415  
    6363                List<Integer> schedRes = GridSim.getGridResourceList(); 
    6464                schedRes.add(schedulerIdObj); 
    65  
    66                 /*if (supportsAR) { 
    67                         res = GridSim.getAdvancedReservationList(); 
    68                         res.add(resIdObj); 
    69                 } */ 
    70  
    7165        } 
    7266         
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/ClusterResourceManager.java

    r1247 r1415  
    11package schedframe.scheduling.manager.resources; 
    22 
    3 import java.util.ArrayList; 
    43import java.util.List; 
    54import java.util.Properties; 
    65 
    7 import schedframe.exceptions.ResourceException; 
    86import schedframe.resources.StandardResourceType; 
     7import schedframe.resources.computing.ComputingResource; 
    98import schedframe.resources.computing.Node; 
    10 import schedframe.resources.computing.ComputingResource; 
    119import schedframe.resources.computing.Processor; 
    1210import schedframe.scheduling.Scheduler; 
     
    2220        @SuppressWarnings("unchecked") 
    2321        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); 
    2923        } 
    3024         
    3125        @SuppressWarnings("unchecked") 
    3226        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); 
    3828        } 
    3929 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/resources/LocalResourceManager.java

    r1396 r1415  
    107107        } 
    108108 
    109         public List<? extends ComputingResource> getResourcesOfType(ResourceType type) throws ResourceException { 
     109        public List<? extends ComputingResource> getResourcesOfType(ResourceType type) { 
    110110                List<ComputingResource> resourcesOfType = new ArrayList<ComputingResource>(); 
    111111                for (ComputingResource resource : computingResources) { 
     
    118118        } 
    119119 
    120         public List<? extends ComputingResource> getResourcesByTypeWithStatus(ResourceType type, ResourceStatus status) 
    121                         throws ResourceException { 
     120        public List<? extends ComputingResource> getResourcesByTypeWithStatus(ResourceType type, ResourceStatus status){ 
    122121 
    123122                List<ComputingResource> resourcesOfType = new ArrayList<ComputingResource>(); 
     
    225224                List<ComputingResource> computingResources = null; 
    226225                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 
    232229                        PEUnit peUnit = new ProcessingElements(computingResources); 
    233230                        peUnits = new ArrayList<ResourceUnit>(); 
     
    236233 
    237234                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 
    243238                        PEUnit peUnit = new ProcessingElements(computingResources); 
    244239                        peUnits = new ArrayList<ResourceUnit>(); 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java

    r1396 r1415  
    5555                                        Set<String> visitedResource = task.getAllocatedResources().getLast().getResourceNames(); 
    5656                                        for(String res: visitedResource){ 
    57                                                 if(res.contains(context)){ 
     57                                                if(res.equals(context) || res.substring(0, res.lastIndexOf("/")).contains(context)){ 
    5858                                                        taskList.add(task); 
    5959                                                        break; 
    6060                                                } 
    6161                                        } 
    62                                         if(task.getSchedulerName().contains(context)) { 
     62                                        if(task.getSchedulerName().equals(context)) { 
    6363                                                taskList.add(task); 
    6464                                        } 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/plugin/local/LocalSchedulingPlugin.java

    r1396 r1415  
    11package schedframe.scheduling.plugin.local; 
    22 
    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; 
    83import schedframe.scheduling.plugin.SchedulingPlugin; 
    9 import schedframe.scheduling.queue.TaskQueueList; 
    104 
    115 
    126public interface LocalSchedulingPlugin extends SchedulingPlugin { 
    137 
    14         public SchedulingResponseType handleResourceAllocationViolation(SchedulingEvent event, 
    15                                         TaskQueueList queues,  
    16                                         JobRegistry jobRegistry,  
    17                                         ResourceManager resourceManager, ModuleList modules); 
    188 
    199} 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/global/GlobalManagementSystem.java

    r1385 r1415  
    7878                        return; 
    7979                } 
    80                  
    8180                registerWorkloadUnit(wu); 
    8281 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java

    r1396 r1415  
    1919import schedframe.events.scheduling.StartTaskExecutionEvent; 
    2020import schedframe.events.scheduling.TaskFinishedEvent; 
     21import schedframe.events.scheduling.TaskPausedEvent; 
    2122import schedframe.events.scheduling.TaskRequestedTimeExpiredEvent; 
     23import schedframe.events.scheduling.TaskResumedEvent; 
    2224import schedframe.exceptions.ResourceException; 
    2325import schedframe.resources.StandardResourceType; 
    2426import schedframe.resources.computing.ComputingResource; 
    25 import schedframe.resources.computing.profiles.energy.EnergyEvent; 
    26 import schedframe.resources.computing.profiles.energy.EnergyEventType; 
     27import schedframe.resources.computing.profiles.energy.ResourceEvent; 
     28import schedframe.resources.computing.profiles.energy.ResourceEventType; 
    2729import schedframe.resources.units.PEUnit; 
    2830import schedframe.resources.units.ProcessingElements; 
     
    163165                        String[] ids = (String[]) ev.get_data(); 
    164166                        execTask = jobRegistry.getTask(ids[0], ids[1]); 
    165                         taskPause(execTask); 
     167                        pauseTask(execTask); 
    166168                        if (pluginSupportsEvent(tag)) { 
    167                                 SchedulingEvent event = new SchedulingEvent(SchedulingEventType.TASK_PAUSED); 
     169                                SchedulingEvent event = new TaskPausedEvent(ids[0], ids[1]); 
    168170                                SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 
    169171                                                queues, jobRegistry, getResourceManager(), moduleList); 
     
    176178                        String[] ids = (String[]) ev.get_data(); 
    177179                        execTask = jobRegistry.getTask(ids[0], ids[1]); 
    178                         taskResume(execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), true); 
     180                        resumeTask(execTask, execTask.getAllocatedResources().getLast().getResourceUnits(), true); 
    179181                        if (pluginSupportsEvent(tag)) { 
    180                                 SchedulingEvent event = new StartTaskExecutionEvent(ids[0], ids[1]); 
     182                                SchedulingEvent event = new TaskResumedEvent(ids[0], ids[1]); 
    181183                                SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event, 
    182184                                                queues, jobRegistry, getResourceManager(), moduleList); 
     
    189191                        Object[] data = (Object[]) ev.get_data(); 
    190192                        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]); 
    192195                        scheduler.sendInternal(migrationTime, DCWormsTags.TASK_MOVE, data); 
    193196                } 
     
    197200                        Object[] data = (Object[]) ev.get_data(); 
    198201                        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]); 
    200203                        if (pluginSupportsEvent(tag)) { 
    201204                                SchedulingEvent event = new StartTaskExecutionEvent((String)data[0], (String)data[1]); 
     
    209212                case DCWormsTags.TASK_EXECUTION_CHANGED: 
    210213                        execTask = (ExecTask) ev.get_data(); 
    211                         updateTaskExecutionPhase(execTask, SchedulingEventType.RESOURCE_STATE_CHANGED); 
     214                        updateTaskExecutionPhase(execTask); 
    212215                        break; 
    213216 
     
    231234                        } 
    232235                        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) { 
    238244                if (execTask == null) { 
    239245                        return; 
     
    246252                                getAllocationManager().freeResources(lastUsed, true); 
    247253                                 
    248                                 saveExecutionHistory(exec, exec.getCompletionPercentage(), exec.getEstimatedDuration()); 
     254                                saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), exec.getEstimatedDuration()); 
    249255                                 
    250256                                ExecTaskFilter filter = new ExecTaskFilter(exec.getUniqueId(), -1); 
     
    252258                                 
    253259                                PEUnit peUnit = (PEUnit)lastUsed.get(StandardResourceUnitName.PE); 
    254                                 updateComputingResources(peUnit, EnergyEventType.TASK_FINISHED, exec); 
     260                                updateComputingResources(peUnit, ResourceEventType.TASK_FINISHED, exec); 
    255261                        } catch (Exception e) { 
    256262                                // TODO Auto-generated catch block 
     
    260266        } 
    261267         
    262         public void taskResume(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> resources, boolean exclusive) { 
     268        protected void resumeTask(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> resources, boolean exclusive) { 
    263269                if (execTask == null) { 
    264270                        return; 
     
    278284                                         
    279285                                        PEUnit peUnit = (PEUnit)resources.get(StandardResourceUnitName.PE); 
    280                                         updateComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec); 
     286                                        updateComputingResources(peUnit, ResourceEventType.TASK_STARTED, exec); 
    281287                                } 
    282288 
     
    288294        } 
    289295         
    290         public 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); 
    293299        } 
    294300         
     
    351357                 
    352358                PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE); 
    353                 updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 
     359                updateComputingResources(peUnit, ResourceEventType.UTILIZATION_CHANGED, exec); 
    354360                 
    355361 
     
    377383 
    378384                int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.START_TASK_EXECUTION),  
    379                                 execTask, resources, exec.getCompletionPercentage())).intValue(); 
    380  
    381                 saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration); 
     385                                execTask, resources, exec.getExecutionProfile().getCompletionPercentage())).intValue(); 
     386 
     387                saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), phaseDuration); 
    382388                if(exec.getExecutionProfile().isLast()){ 
    383389                        scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_FINISHED, execTask);; 
     
    387393                 
    388394                PEUnit peUnit = (PEUnit)resources.get(StandardResourceUnitName.PE); 
    389                 updateComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec); 
     395                updateComputingResources(peUnit, ResourceEventType.TASK_STARTED, exec); 
    390396                 
    391397        } 
     
    429435                 
    430436                PEUnit peUnit = (PEUnit)lastUsed.get(StandardResourceUnitName.PE); 
    431                 updateComputingResources(peUnit, EnergyEventType.TASK_FINISHED, exec); 
     437                updateComputingResources(peUnit, ResourceEventType.TASK_FINISHED, exec); 
    432438                 
    433439                log.debug(execTask.getJobId() + "_" + execTask.getId() + " finished execution on " + new DateTime()); 
    434440                log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad()); 
    435441                 
    436                 updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec); 
     442                updateComputingResources(peUnit, ResourceEventType.UTILIZATION_CHANGED, exec); 
    437443        } 
    438444         
     
    452458                        //System.out.println("--- upadteProgressX: " + Sim_system.sim_clock() ); 
    453459                        //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()); 
    455462                        //System.out.println("newProgress: " + exec.getCompletionPercentage()  );        
    456463 
     
    458465        } 
    459466         
    460         private void updateComputingResources(PEUnit peUnit, EnergyEventType eventType, Object obj){ 
     467        private void updateComputingResources(PEUnit peUnit, ResourceEventType eventType, Object obj){ 
    461468                if(peUnit instanceof ProcessingElements){ 
    462469                        ProcessingElements pes = (ProcessingElements) peUnit; 
    463470                        for (ComputingResource resource : pes) { 
    464                                 resource.handleEvent(new EnergyEvent(eventType, obj, scheduler.getFullName())); 
     471                                resource.handleEvent(new ResourceEvent(eventType, obj, scheduler.getFullName())); 
    465472                                //DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(eventType, obj)); 
    466473                        } 
     
    480487                                return; 
    481488                        } 
    482                         resource.handleEvent(new EnergyEvent(eventType, obj, scheduler.getFullName())); 
     489                        resource.handleEvent(new ResourceEvent(eventType, obj, scheduler.getFullName())); 
    483490                } 
    484491        } 
     
    492499 
    493500                        int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.RESOURCE_STATE_CHANGED),  
    494                                         execTask, choosenResources, exec.getCompletionPercentage())).intValue(); 
     501                                        execTask, choosenResources, exec.getExecutionProfile().getCompletionPercentage())).intValue(); 
    495502 
    496503                        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){ 
    499506                                continue; 
    500507                        } 
     
    504511                        //System.out.println("completionPercantage: " + exec.getCompletionPercentage() + "; basic duration: " +exec.getResourceConsumptionProfile().getCurrentResourceConsumption().getDuration() +   "; phaseDuration: " +  phaseDuration); 
    505512 
    506                         saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration); 
     513                        saveExecutionHistory(exec, exec.getExecutionProfile().getCompletionPercentage(), phaseDuration); 
    507514                         
    508515                        if(exec.getExecutionProfile().isLast()){ 
     
    522529        }        
    523530 
    524         protected void updateTaskExecutionPhase(ExecTask execTask, SchedulingEventType schedEvType) { 
     531        protected void updateTaskExecutionPhase(ExecTask execTask) { 
    525532 
    526533                if (execTask.getStatus() == DCWormsTags.INEXEC) { 
     
    535542                        Map<ResourceUnitName, ResourceUnit> choosenResources = exec.getAllocatedResources().getLast().getResourceUnits(); 
    536543 
    537                         int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(schedEvType),  
    538                                         execTask, choosenResources, exec.getCompletionPercentage())).intValue(); 
    539                          
    540                         saveExecutionHistory(exec, exec.getCompletionPercentage(), 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); 
    541548                         
    542549                        if(exec.getExecutionProfile().isLast()){ 
     
    547554                         
    548555                        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); 
    550557                } 
    551558        }        
    552559 
    553         public double calculateTotalLoad() { 
     560        protected double calculateTotalLoad() { 
    554561 
    555562                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 
    565568                return loadAcc.getMean(); 
    566569        } 
     
    703706         
    704707        private void saveExecutionHistory(Executable exec, double completionPercentage, double estimatedDuration){ 
    705  
    706708                ExecutionHistoryItem execHistoryItem = new ExecutionHistoryItem(new DateTime()); 
    707709                execHistoryItem.setCompletionPercentage(completionPercentage); 
     
    710712                execHistoryItem.setStatus(exec.getStatus()); 
    711713                exec.addExecHistory(execHistoryItem); 
    712                  
    713714        } 
    714715         
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionPhase.java

    r1207 r1415  
    1313import org.qcg.broker.schemas.resreqs.ResourceConsumptionType; 
    1414 
    15 public class ResourceConsumption { 
     15public class ExecutionPhase { 
    1616 
    1717        protected String id; 
    1818    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; 
    2122     
    22     public ResourceConsumption(long duration, ComputingResourceBaseTypeItem item[]){ 
     23    public ExecutionPhase(long duration, ComputingResourceBaseTypeItem item[]){ 
    2324        this.id = null; 
    2425        this.referenceHardware = null; 
    25         this.duration = duration; 
    26         this.phaseBehaviourList = new ArrayList<PhaseBehaviour>(); 
     26        this.originDuration = duration; 
     27        this.systemLoad = new ArrayList<PhaseSystemLoad>(); 
    2728        for(ComputingResourceBaseTypeItem compResItem: item){ 
    2829                ComputingResourceParameterType hostParameter = compResItem.getHostParameter(); 
    29                 PhaseBehaviour pb = new PhaseBehaviour(hostParameter.getName().toString()); 
    30                 phaseBehaviourList.add(pb); 
     30                PhaseSystemLoad pb = new PhaseSystemLoad(hostParameter.getName().toString()); 
     31                systemLoad.add(pb); 
    3132        } 
     33        this.lenght = duration; 
    3234    } 
    3335     
    34     public ResourceConsumption(ResourceConsumptionType resConsumptionType){ 
     36    public ExecutionPhase(ResourceConsumptionType resConsumptionType){ 
    3537        this.id = resConsumptionType.getId(); 
    3638        this.referenceHardware = new HashMap<String, String>(); 
     39        this.originDuration = resConsumptionType.getDuration().toLong() / 1000; 
     40         
     41        double speed = 1; 
    3742        if(resConsumptionType.getReferenceHardware() != null){ 
    3843                for (int i = 0; i < resConsumptionType.getReferenceHardware().getReference().length; i++){ 
    3944                        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                } 
    4149                } 
    4250        } 
    43         this.duration = resConsumptionType.getDuration().toLong()/1000; 
    44         this.phaseBehaviourList = new ArrayList<PhaseBehaviour>(); 
     51        this.systemLoad = new ArrayList<PhaseSystemLoad>(); 
     52        int nrOfThreads = 1; 
    4553        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                } 
    4859        } 
     60        this.lenght = (long) (originDuration * nrOfThreads * speed); 
    4961    } 
    5062     
     
    6274 
    6375        public long getDuration() { 
    64                 return duration; 
     76                return originDuration; 
    6577        } 
    6678 
    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; 
    6985        } 
    7086 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java

    r1362 r1415  
    55public class ExecutionProfile { 
    66         
    7         protected LinkedList<ResourceConsumption> resourceConsumptionList; 
     7        protected LinkedList<ExecutionPhase> resourceConsumptionList; 
    88        protected long usefulWork; 
     9        protected double completionPercentage; 
    910        private int currentPhase; 
     11         
    1012 
    11         public ExecutionProfile(LinkedList<ResourceConsumption> resourceConsumptionList) { 
     13        public ExecutionProfile(LinkedList<ExecutionPhase> resourceConsumptionList) { 
    1214                this.resourceConsumptionList = resourceConsumptionList; 
     15                this.completionPercentage = 0; 
    1316                this.currentPhase = 0; 
    1417        } 
    1518         
    16         public LinkedList<ResourceConsumption> getResourceConsumptionList(){ 
     19        public LinkedList<ExecutionPhase> getResourceConsumptionList(){ 
    1720                return resourceConsumptionList; 
    1821        } 
    1922         
    20         public ResourceConsumption getCurrentResourceConsumption(){ 
     23        public ExecutionPhase getCurrentResourceConsumption(){ 
    2124                return resourceConsumptionList.get(currentPhase); 
    2225        } 
     
    4447                return false; 
    4548        } 
     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        } 
    4665} 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/PhaseSystemLoad.java

    r883 r1415  
    33import org.qcg.broker.schemas.resreqs.PhaseBehaviourType; 
    44 
    5 public class PhaseBehaviour { 
     5public class PhaseSystemLoad { 
    66         
    77        protected String resName; 
    88        protected double utilization; 
    99         
    10         PhaseBehaviour(String resName, double utilization) { 
     10        PhaseSystemLoad(String resName, double utilization) { 
    1111                this.resName = resName; 
    1212                this.utilization = utilization; 
    1313        } 
    1414         
    15         PhaseBehaviour(String resName) { 
     15        PhaseSystemLoad(String resName) { 
    1616                this.resName = resName; 
    1717                this.utilization = 100; 
    1818        } 
    1919         
    20         PhaseBehaviour(PhaseBehaviourType pbt) { 
     20        PhaseSystemLoad(PhaseBehaviourType pbt) { 
    2121                this.resName = pbt.getName(); 
    2222                this.utilization = pbt.getParameterTypeChoice().getParameterTypeChoiceItem(0).getParameterValue().getContent(); 
Note: See TracChangeset for help on using the changeset viewer.