Ignore:
Timestamp:
07/15/14 16:26:31 (11 years ago)
Author:
wojtekp
Message:
 
Location:
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases
Files:
1 edited
2 moved

Legend:

Unmodified
Added
Removed
  • 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.