Ignore:
Timestamp:
07/30/14 12:25:00 (11 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/branches/coolemall/src/schedframe/scheduling
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/ExecutionHistoryItem.java

    r1362 r1423  
    55public class ExecutionHistoryItem { 
    66 
    7         protected DateTime timeStamp; 
     7        protected long timeStamp; 
    88        protected double completionPercentage; 
    99        protected double estimatedDuration; 
     
    1111        protected int resUsageIndex; 
    1212 
    13         public ExecutionHistoryItem(DateTime time){ 
     13        public ExecutionHistoryItem(long time){ 
    1414                this.timeStamp = time; 
    1515        } 
    1616 
    17         public DateTime getTimeStamp(){ 
     17        public long getTimeStamp(){ 
    1818                return timeStamp; 
    1919        } 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceItem.java

    r1415 r1423  
    11package schedframe.scheduling; 
    22 
     3import java.util.HashSet; 
    34import java.util.LinkedList; 
    45import java.util.List; 
    56import java.util.Map; 
    67import java.util.Set; 
    7 import java.util.TreeSet; 
    88 
    99import schedframe.resources.computing.ComputingResource; 
     
    2020        public ResourceItem(Map<ResourceUnitName, ResourceUnit> usedResources){ 
    2121                this.usedResources = usedResources; 
    22                 this.resourceNames = new TreeSet<String>(); 
    23                 saveResourceNames(); 
     22                this.resourceNames = saveResourceNames(); 
    2423        } 
    2524         
     
    3231        } 
    3332         
    34         private void saveResourceNames(){ 
     33        private Set<String> saveResourceNames(){ 
     34                Set<String> resourceNames; 
    3535                ProcessingElements pes = (ProcessingElements) usedResources.get(StandardResourceUnitName.PE); 
    36                 for (ComputingResource resource : pes) { 
     36                resourceNames = new HashSet<String>(pes.size(), 1); 
     37                for (ComputingResource resource: pes) { 
    3738 
    3839                        LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>(); 
     
    5455                        } 
    5556                } 
     57                return resourceNames; 
    5658        } 
    5759} 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java

    r1415 r1423  
    44import java.util.HashMap; 
    55import java.util.Iterator; 
     6import java.util.LinkedHashSet; 
    67import java.util.List; 
    78import java.util.Map; 
     9import java.util.Set; 
    810 
    911import org.apache.commons.logging.Log; 
     
    9395 
    9496                int tag = ev.get_tag(); 
    95  
    9697                switch (tag) { 
    9798 
     
    139140                                getWorkloadUnitHandler().handleJob(job); 
    140141                        }  
    141                         //SUPPORTS PRECEDING CONSTRAINST COMING BOTH FROM SWF FILES 
     142                        //SUPPORTS PRECEDING CONSTRAINST COMING ALSO FROM SWF FILES 
    142143                        /*else { 
    143144                                try { 
     
    394395                PEUnit peUnit = (PEUnit)resources.get(StandardResourceUnitName.PE); 
    395396                updateComputingResources(peUnit, ResourceEventType.TASK_STARTED, exec); 
    396                  
    397         } 
     397        } 
     398 
    398399        protected void finalizeExecutable(ExecTask execTask){ 
    399400                 
     
    459460                        //System.out.println("taskId: " + exec.getId() + "; completion percentage: " + exec.getCompletionPercentage() + "; timespan: " + timeSpan + "; estimatedDuration: " +  execHistItem.getCompletionPercentage()); 
    460461                        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()); 
     462                        exec.setTotalCompletionPercentage(exec.getTotalCompletionPercentage() + 100 * (timeSpan / execHistItem.getEstimatedDuration()) * exec.getExecutionProfile().getCurrentExecutionPhase().getLenght() / exec.getExecutionProfile().getLength()); 
    462463                        //System.out.println("newProgress: " + exec.getCompletionPercentage()  );        
    463464 
     
    467468        private void updateComputingResources(PEUnit peUnit, ResourceEventType eventType, Object obj){ 
    468469                if(peUnit instanceof ProcessingElements){ 
    469                         ProcessingElements pes = (ProcessingElements) peUnit; 
     470                        /*ProcessingElements pes = (ProcessingElements) peUnit; 
    470471                        for (ComputingResource resource : pes) { 
    471472                                resource.handleEvent(new ResourceEvent(eventType, obj, scheduler.getFullName())); 
    472473                                //DataCenterWorkloadSimulator.getEventManager().sendToResources(resource.getType(), 0, new EnergyEvent(eventType, obj)); 
    473                         } 
     474                        }*/ 
    474475                        /*try { 
    475476                                for (ComputingResource resource : resourceManager.getResourcesOfType(pes.get(0).getType())) { 
     
    480481                                e.printStackTrace(); 
    481482                        }*/ 
     483                         
     484                        ProcessingElements pes = (ProcessingElements) peUnit; 
     485                        ResourceEvent resEvent = new ResourceEvent(eventType, obj, scheduler.getFullName());             
     486                        try{ 
     487                                Set<ComputingResource> resourcesToUpdate = new LinkedHashSet<ComputingResource>(); 
     488                         
     489                                for (ComputingResource compResource : pes) { 
     490                                        resourcesToUpdate.add(compResource); 
     491                                } 
     492                                while(resourcesToUpdate.size() > 0){ 
     493                                        Set<ComputingResource> newSet = new LinkedHashSet<ComputingResource>(); 
     494                                        for(ComputingResource compResource: resourcesToUpdate){ 
     495                                                compResource.updateState(resEvent); 
     496                                                if(compResource.getParent() != null){ 
     497                                                        newSet.add(compResource.getParent()); 
     498                                                } 
     499                                        } 
     500                                        resourcesToUpdate = new LinkedHashSet<ComputingResource>(newSet); 
     501                                } 
     502                        }catch(Exception e){ 
     503                        } 
    482504                } else { 
    483505                        ComputingResource resource = null; 
     
    492514 
    493515        protected void updateProcessingTimes() { 
    494                 for (ExecTask execTask : jobRegistry.getRunningTasks()) { 
     516                for (ExecTask execTask: jobRegistry.getRunningTasks()) { 
    495517                        Executable exec = (Executable)execTask; 
    496518 
     
    502524 
    503525                        ExecutionHistoryItem execHistItem = exec.getExecutionHistory().getLast(); 
    504                         double lastTimeStamp = execHistItem.getTimeStamp().getMillis() / 1000; 
     526                        double lastTimeStamp = execHistItem.getTimeStamp() / 1000; 
    505527                        if(DoubleMath.subtract((lastTimeStamp + execHistItem.getEstimatedDuration()), (new DateTime().getMillis() / 1000 + phaseDuration)) == 0.0){ 
    506528                                continue; 
     
    706728         
    707729        private void saveExecutionHistory(Executable exec, double completionPercentage, double estimatedDuration){ 
    708                 ExecutionHistoryItem execHistoryItem = new ExecutionHistoryItem(new DateTime()); 
     730                ExecutionHistoryItem execHistoryItem = new ExecutionHistoryItem(new DateTime().getMillis()); 
    709731                execHistoryItem.setCompletionPercentage(completionPercentage); 
    710732                execHistoryItem.setEstimatedDuration(estimatedDuration); 
  • DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java

    r1415 r1423  
    55public class ExecutionProfile { 
    66         
    7         protected LinkedList<ExecutionPhase> resourceConsumptionList; 
     7        protected LinkedList<ExecutionPhase> executionPhases; 
    88        protected long usefulWork; 
    99        protected double completionPercentage; 
     
    1111         
    1212 
    13         public ExecutionProfile(LinkedList<ExecutionPhase> resourceConsumptionList) { 
    14                 this.resourceConsumptionList = resourceConsumptionList; 
     13        public ExecutionProfile(LinkedList<ExecutionPhase> execPhases) { 
     14                this.executionPhases = execPhases; 
    1515                this.completionPercentage = 0; 
    1616                this.currentPhase = 0; 
    1717        } 
    1818         
    19         public LinkedList<ExecutionPhase> getResourceConsumptionList(){ 
    20                 return resourceConsumptionList; 
     19        public LinkedList<ExecutionPhase> getExecutionPhases(){ 
     20                return executionPhases; 
    2121        } 
    2222         
    23         public ExecutionPhase getCurrentResourceConsumption(){ 
    24                 return resourceConsumptionList.get(currentPhase); 
     23        public ExecutionPhase getCurrentExecutionPhase(){ 
     24                return executionPhases.get(currentPhase); 
    2525        } 
    2626 
     
    4242         
    4343        public boolean isLast(){ 
    44                 if(currentPhase == resourceConsumptionList.size() - 1){ 
     44                if(currentPhase == executionPhases.size() - 1){ 
    4545                        return true; 
    4646                } 
     
    5858        public long getLength() { 
    5959                long length = 0; 
    60                 for(ExecutionPhase execPhase: resourceConsumptionList){ 
     60                for(ExecutionPhase execPhase: executionPhases){ 
    6161                        length = length + execPhase.getLenght(); 
    6262                } 
Note: See TracChangeset for help on using the changeset viewer.