- Timestamp:
- 07/15/14 16:26:31 (11 years ago)
- 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 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 -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java
r1362 r1415 5 5 public class ExecutionProfile { 6 6 7 protected LinkedList< ResourceConsumption> resourceConsumptionList;7 protected LinkedList<ExecutionPhase> resourceConsumptionList; 8 8 protected long usefulWork; 9 protected double completionPercentage; 9 10 private int currentPhase; 11 10 12 11 public ExecutionProfile(LinkedList< ResourceConsumption> resourceConsumptionList) {13 public ExecutionProfile(LinkedList<ExecutionPhase> resourceConsumptionList) { 12 14 this.resourceConsumptionList = resourceConsumptionList; 15 this.completionPercentage = 0; 13 16 this.currentPhase = 0; 14 17 } 15 18 16 public LinkedList< ResourceConsumption> getResourceConsumptionList(){19 public LinkedList<ExecutionPhase> getResourceConsumptionList(){ 17 20 return resourceConsumptionList; 18 21 } 19 22 20 public ResourceConsumptiongetCurrentResourceConsumption(){23 public ExecutionPhase getCurrentResourceConsumption(){ 21 24 return resourceConsumptionList.get(currentPhase); 22 25 } … … 44 47 return false; 45 48 } 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 } 46 65 } -
DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/PhaseSystemLoad.java
r883 r1415 3 3 import org.qcg.broker.schemas.resreqs.PhaseBehaviourType; 4 4 5 public class Phase Behaviour{5 public class PhaseSystemLoad { 6 6 7 7 protected String resName; 8 8 protected double utilization; 9 9 10 Phase Behaviour(String resName, double utilization) {10 PhaseSystemLoad(String resName, double utilization) { 11 11 this.resName = resName; 12 12 this.utilization = utilization; 13 13 } 14 14 15 Phase Behaviour(String resName) {15 PhaseSystemLoad(String resName) { 16 16 this.resName = resName; 17 17 this.utilization = 100; 18 18 } 19 19 20 Phase Behaviour(PhaseBehaviourType pbt) {20 PhaseSystemLoad(PhaseBehaviourType pbt) { 21 21 this.resName = pbt.getName(); 22 22 this.utilization = pbt.getParameterTypeChoice().getParameterTypeChoiceItem(0).getParameterValue().getContent();
Note: See TracChangeset
for help on using the changeset viewer.