Ignore:
Timestamp:
07/15/14 16:26:31 (11 years ago)
Author:
wojtekp
Message:
 
File:
1 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 
Note: See TracChangeset for help on using the changeset viewer.