Changeset 1415 for DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionPhase.java
- Timestamp:
- 07/15/14 16:26:31 (11 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.