Index: DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/ExecTask.java
===================================================================
--- DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/ExecTask.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/ExecTask.java	(revision 1362)
@@ -1,9 +1,11 @@
 package dcworms.schedframe.scheduling;
 
-import java.util.List;
+import java.util.LinkedList;
 
+import schedframe.scheduling.ExecutionHistoryItem;
+import schedframe.scheduling.ResourceHistoryItem;
 import schedframe.scheduling.tasks.TaskInterface;
 import schedframe.scheduling.tasks.phases.ResourceConsumption;
-import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile;
+import schedframe.scheduling.tasks.phases.ExecutionProfile;
 import schedframe.scheduling.tasks.requirements.ResourceParameterName;
 
@@ -12,9 +14,11 @@
 	public boolean expectSpecificResource(ResourceParameterName resourceName);	
 	public Object getExpectedSpecificResource(ResourceParameterName resourceName);
-
-	public void trackResource(String resName);
-	public List<String> getVisitedResources();
 	
-	public ResourceConsumptionProfile getResourceConsumptionProfile();
+	public LinkedList<ExecutionHistoryItem> getExecHistory();
+	public LinkedList<ResourceHistoryItem> getAllocatedResources();
+	
+	public ExecutionProfile getResourceConsumptionProfile();
 	public ResourceConsumption getCurrentResourceConsumption();
+	
+    public String getSchedulerName();
 }
Index: DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/Executable.java
===================================================================
--- DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/Executable.java	(revision 1315)
+++ DCWoRMS/branches/coolemall/src/dcworms/schedframe/scheduling/Executable.java	(revision 1362)
@@ -5,5 +5,4 @@
 import gridsim.dcworms.DCWormsTags;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -11,5 +10,4 @@
 import java.util.Map;
 
-import org.apache.commons.lang.ArrayUtils;
 import org.joda.time.DateTime;
 import org.joda.time.DateTimeUtilsExt;
@@ -25,6 +23,6 @@
 import schedframe.resources.units.ProcessingElements;
 import schedframe.resources.units.StandardResourceUnitName;
+import schedframe.scheduling.ExecutionHistoryItem;
 import schedframe.scheduling.ResourceHistoryItem;
-import schedframe.scheduling.UsedResourcesList;
 import schedframe.scheduling.WorkloadUnitHandler;
 import schedframe.scheduling.manager.tasks.JobRegistryImpl;
@@ -33,5 +31,5 @@
 import schedframe.scheduling.tasks.Task;
 import schedframe.scheduling.tasks.phases.ResourceConsumption;
-import schedframe.scheduling.tasks.phases.ResourceConsumptionProfile;
+import schedframe.scheduling.tasks.phases.ExecutionProfile;
 import schedframe.scheduling.tasks.requirements.ResourceParameterName;
 
@@ -53,24 +51,26 @@
 	
 	protected int estimatedDuration;
-	//TO DO remove and benefit from visitedResources
 	protected String schedName;
-	protected UsedResourcesList usedResources;
-	//TO DO consider removing
-	protected List<String> visitedResources;
 
 	protected double submissionTime;
     protected double arrivalTime;
-	protected double execStartTime ;
+	protected double execStartTime;
     protected double totalCompletionTime; 
 	protected double finishTime; 
 	
-	private ResourceConsumptionProfile resourceConsumptionProfile;
+    private boolean firstTime = true;
+	protected double execStartTimeFirst;
+	
+	protected ExecutionProfile execProfile;
+	
+	protected LinkedList<ExecutionHistoryItem> execHistory;;
+	protected LinkedList<ResourceHistoryItem> allocatedResources;
 	
 	public Executable(Task t){
 		this.task = t;
 		this.status = DCWormsTags.CREATED;
-		
-		this.usedResources = new UsedResourcesList();
-		this.visitedResources = new ArrayList<String>();
+
+		this.allocatedResources = new LinkedList<ResourceHistoryItem>();
+		this.execHistory = new LinkedList<ExecutionHistoryItem>();
 		init();
 	}
@@ -81,6 +81,6 @@
 		this.processesSetId = procesesSet.getId(); 
 		
-		this.usedResources = new UsedResourcesList();
-		this.visitedResources = new ArrayList<String>();
+		this.allocatedResources = new LinkedList<ResourceHistoryItem>();
+		this.execHistory = new LinkedList<ExecutionHistoryItem>();
 		init();
 	}
@@ -88,4 +88,5 @@
 	protected void init() {
 		double currentTime = DateTimeUtilsExt.currentTimeMillis() / 1000;
+		this.arrivalTime = currentTime;
 		this.submissionTime =  currentTime;
         this.totalCompletionTime = 0.0;
@@ -168,7 +169,7 @@
         }
 
-        if (newStatus < DCWormsTags.CREATED || newStatus > DCWormsTags.NEW_EXEC_PHASE) {
+        if (newStatus < DCWormsTags.CREATED || newStatus > DCWormsTags.FAILED) {
             throw new Exception("Executable.setStatuts() : Error - " +
-                    "Invalid integer range for Execiutable status.");
+                    "Invalid integer range for Executable status.");
         }
 
@@ -189,69 +190,36 @@
         }
 		
-		if(newStatus == DCWormsTags.SUBMITTED){
+		/*if(newStatus == DCWormsTags.SUBMITTED){
 			 arrivalTime = GridSim.clock();
-		}
-
-        if (prevStatus == DCWormsTags.INEXEC) {
-            if (status == DCWormsTags.CANCELED || status == DCWormsTags.PAUSED ||
-                status == DCWormsTags.SUCCESS) {
+		}*/
+
+        if ((prevStatus == DCWormsTags.INEXEC) && (status == DCWormsTags.CANCELED || status == DCWormsTags.PAUSED ||
+                status == DCWormsTags.SUCCESS)){
                 totalCompletionTime += (currentTime -  execStartTime);
+                execStartTime = execStartTimeFirst;
+        }
+
+        /*if (prevStatus == DCWormsTags.RESUMED && status == DCWormsTags.SUCCESS) {
+            totalCompletionTime += (currentTime -  execStartTime);
+        }*/
+
+        if(prevStatus == DCWormsTags.PAUSED && status == DCWormsTags.RESUMED){
+        	
+        }
+        if (status == DCWormsTags.INEXEC) {
+        	
+        	execStartTime = currentTime;
+            if (firstTime){
+            	execStartTimeFirst = currentTime;
+            	firstTime = false;
             }
         }
-
-        if (prevStatus == DCWormsTags.RESUMED && status == DCWormsTags.SUCCESS) {
-            totalCompletionTime += (currentTime -  execStartTime);
-        }
-
-        if (status == DCWormsTags.INEXEC ||
-            (prevStatus == DCWormsTags.PAUSED && status == DCWormsTags.RESUMED) ) {
-        	execStartTime = currentTime;
-        	
-    		ProcessingElements pes = (ProcessingElements) getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE);
-    		for (ComputingResource resource : pes) {
-
-				LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>();
-				toExamine.push(resource);
-
-				while (!toExamine.isEmpty()) {
-					ComputingResource compResource = toExamine.pop();
-					List<ComputingResource> resources = compResource.getChildren();
-					int numberOfRes = resources.size();
-					for (int i = 0; i < numberOfRes; i++) {
-						ComputingResource resourceChild = resources.get(i);
-						trackResource(resourceChild.getFullName());
-						toExamine.addLast(resourceChild);
-					}
-				}
-
-    			
-    			trackResource(resource.getFullName());
-    			
-    			ComputingResource parent = resource.getParent();
-				List<String> visitedResource = getVisitedResources();
-				String [] visitedResourcesArray = visitedResource.toArray(new String[visitedResource.size()]);
-    			while (parent != null && !ArrayUtils.contains(visitedResourcesArray, parent.getFullName())) {
-    				trackResource(parent.getFullName());
-    				parent = parent.getParent();
-    			}
-    		}
-        }
         
-        if(status == DCWormsTags.NEW_EXEC_PHASE){
-        	if(prevStatus == DCWormsTags.INEXEC){
-        		status = DCWormsTags.INEXEC;
-        		setCompletionPercentage(0);
-        		resourceConsumptionProfile.setCurrentPhase(resourceConsumptionProfile.getCurrentPhase() + 1);
-        		
-        		DateTime currentDateTime = new DateTime();
-        		
-        		if(getUsedResources().getLast().getTimeStamp().getMillis() == currentDateTime.getMillis()){
-        			return;
-        		}
-    			ResourceHistoryItem resHistItem = new ResourceHistoryItem(getUsedResources().getLast().getResourceUnits(), currentDateTime);
-    			resHistItem.setCompletionPercentage(0);
-    			addUsedResources(resHistItem);
-        	}
-        }
+        if(status == DCWormsTags.NEW_EXEC_PHASE && prevStatus == DCWormsTags.INEXEC){
+    		status = DCWormsTags.INEXEC;
+    		completionPercentage = 0;
+    		execProfile.setCurrentPhase(execProfile.getCurrentPhase() + 1);
+        }
+
 	}
 	
@@ -295,15 +263,11 @@
 	}
 
-	public void addUsedResources(ResourceHistoryItem usedResources){
-		this.usedResources.add(usedResources);
-	}
-	
-	public UsedResourcesList getUsedResources(){
-		return this.usedResources;
-	}
-	
     public void setSchedulerName(int resourceId){
         this.schedName = GridSim.getEntityName(resourceId);
     }
+    
+    public void setSchedulerName(String resourceId){
+        this.schedName = resourceId;
+    }
 
     public String getSchedulerName(){
@@ -326,13 +290,5 @@
 		task.register(jobRegistry);
 	}
-	
-	public void trackResource(String resName){
-		visitedResources.add(resName);
-	}
-	
-	public List<String> getVisitedResources(){
-		return visitedResources;
-	}
-	
+
 	public ReadableDuration getExpectedDuration() throws NoSuchFieldException {
 		return task.getExpectedDuration();
@@ -410,10 +366,10 @@
 	}*/
 	
-	public ResourceConsumptionProfile getResourceConsumptionProfile(){
-		return resourceConsumptionProfile;
+	public ExecutionProfile getResourceConsumptionProfile(){
+		return execProfile;
 	}
 
 	public ResourceConsumption getCurrentResourceConsumption(){
-		return resourceConsumptionProfile.getCurrentResourceConsumption();
+		return execProfile.getCurrentResourceConsumption();
 	}
 	
@@ -437,5 +393,5 @@
 			}
 			resourceConsumptionList.add(resConsumption);
-		}else{
+		} else {
 			boolean found = false;
 			if(resourceType != null){
@@ -473,6 +429,6 @@
 		
 		usefulWork = (usefulWork != -1) ? usefulWork : this.getLength();
-		this.resourceConsumptionProfile = new ResourceConsumptionProfile(resourceConsumptionList);
-		this.resourceConsumptionProfile.setUsefulWork(usefulWork);
+		this.execProfile = new ExecutionProfile(resourceConsumptionList);
+		this.execProfile.setUsefulWork(usefulWork);
 
 	}
@@ -480,5 +436,5 @@
 	private boolean loadResourceConsumptionProfile(){
 
-		PEUnit peUnit = (PEUnit)getUsedResources().getLast().getResourceUnits()
+		PEUnit peUnit = (PEUnit)getAllocatedResources().getLast().getResourceUnits()
 				.get(StandardResourceUnitName.PE);
 		if(peUnit instanceof ProcessingElements){
@@ -513,3 +469,19 @@
 		
 	}
+
+	public LinkedList<ExecutionHistoryItem> getExecHistory() {
+		return execHistory;
+	}
+
+	public void addExecHistory(ExecutionHistoryItem execHistoryItem) {
+		this.execHistory.add(execHistoryItem);
+	}
+
+	public LinkedList<ResourceHistoryItem> getAllocatedResources() {
+		return allocatedResources;
+	}
+
+	public void addAllocatedResources(ResourceHistoryItem allocatedResourcesItem) {
+		this.allocatedResources.add(allocatedResourcesItem);
+	}
 }
Index: DCWoRMS/branches/coolemall/src/gridsim/dcworms/DCWormsTags.java
===================================================================
--- DCWoRMS/branches/coolemall/src/gridsim/dcworms/DCWormsTags.java	(revision 1316)
+++ DCWoRMS/branches/coolemall/src/gridsim/dcworms/DCWormsTags.java	(revision 1362)
@@ -37,4 +37,10 @@
 	
 	public static final int POWER_LIMIT_EXCEEDED = DCWORMSBASE + 8;
+	
+	public static final int TASK_PAUSE = DCWORMSBASE + 9;
+	
+	public static final int TASK_RESUME = DCWORMSBASE + 10;
+	
+	public static final int TASK_MOVE = DCWORMSBASE + 11;
 
 	
@@ -48,16 +54,15 @@
 
     public static final int INEXEC = 4;
+    
+    public static final int NEW_EXEC_PHASE = 5;
+    
+    public static final int PAUSED = 6;
 
-    public static final int SUCCESS = 5;
+    public static final int RESUMED = 7;
+    
+    public static final int SUCCESS = 8;
 
-    public static final int FAILED = 6;
+    public static final int CANCELED = 9;
 
-    public static final int CANCELED = 7;
-
-    public static final int PAUSED = 8;
-
-    public static final int RESUMED = 9;
-
-    public static final int NEW_EXEC_PHASE = 10;
-
+    public static final int FAILED = 10;
 }
Index: DCWoRMS/branches/coolemall/src/simulator/stats/implementation/DCWormsStatistics.java
===================================================================
--- DCWoRMS/branches/coolemall/src/simulator/stats/implementation/DCWormsStatistics.java	(revision 1357)
+++ DCWoRMS/branches/coolemall/src/simulator/stats/implementation/DCWormsStatistics.java	(revision 1362)
@@ -16,4 +16,5 @@
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -78,4 +79,5 @@
 import schedframe.resources.units.ResourceUnitName;
 import schedframe.resources.units.StandardResourceUnitName;
+import schedframe.scheduling.ExecutionHistoryItem;
 import schedframe.scheduling.ResourceHistoryItem;
 import schedframe.scheduling.Scheduler;
@@ -104,4 +106,5 @@
 import eduni.simjava.Sim_stat;
 import example.energy.coolemall.CoolEmAllTestbedMeasurements;
+import gridsim.dcworms.DCWormsTags;
 
 public class DCWormsStatistics implements SimulationStatistics {
@@ -407,5 +410,5 @@
 		}
 		
-		pesStats = gatherPEStats(jr.getTasks());
+		pesStats = gatherPEStatsMulti(jr.getTasks());
 		peStatsPostProcessing(pesStats);
 		basicResLoad = calculatePELoad(pesStats);
@@ -763,8 +766,9 @@
 			Executable exec = (Executable) execTask;
 
-			List<ResourceHistoryItem> resHistItemList = exec.getUsedResources();
-			if(resHistItemList.size() == 0)
+
+			LinkedList<ResourceHistoryItem> resourceHistory = exec.getAllocatedResources();
+			if(resourceHistory.size() == 0)
 				continue;
-			Map<ResourceUnitName, ResourceUnit> res = resHistItemList.get(resHistItemList.size() - 1).getResourceUnits();
+			Map<ResourceUnitName, ResourceUnit> res = exec.getAllocatedResources().getLast().getResourceUnits();
 			ResourceUnit resUnit = res.get(StandardResourceUnitName.PE);
 			//ProcessingElements pes = (ProcessingElements) resUnit ;
@@ -820,4 +824,111 @@
 		}
 		return basicResStats;
+	}
+	
+	private Map<String, List<ResStat>> gatherPEStatsMulti(ExecutablesList executables) {
+		
+		Map<String, List<ResStat>> basicResStats = new TreeMap<String, List<ResStat>>(new MapPEIdComparator());
+		for (ExecTask execTask:executables) {
+			Executable exec = (Executable) execTask;
+
+			LinkedList<ResourceHistoryItem> resourceHistory = exec.getAllocatedResources();
+			if(resourceHistory.size() == 0)
+				continue;
+
+			for(int i = 0; i < resourceHistory .size(); i++){
+				ResourceHistoryItem resHistItem = resourceHistory.get(i);
+				Map<ResourceUnitName, ResourceUnit> res = resHistItem.getResourceUnits();
+				ResourceUnit resUnit = res.get(StandardResourceUnitName.PE);
+				//ProcessingElements pes = (ProcessingElements) resUnit ;
+				LinkedList<ExecutionHistoryItem> execHistory = exec.getExecHistory();
+				long st = -1, et;
+				for(int j = 0; j < execHistory .size(); j++){
+					ExecutionHistoryItem execHistItem = execHistory.get(j);
+					if(execHistItem.getStatus() == DCWormsTags.PAUSED || execHistItem.getResIndex() != i){
+						continue;
+					}
+					if(st == -1){
+						st = execHistItem.getTimeStamp().getMillis();
+					}
+						
+					if(j < execHistory.size() - 1 && (execHistory.get(j + 1).getResIndex() != execHistItem.getResIndex() || execHistory.get(j + 1).getStatus() == DCWormsTags.PAUSED) || j + 1 == execHistory.size()){
+						if(j < execHistory.size() -1 && (execHistory.get(j + 1).getResIndex() != execHistItem.getResIndex() || execHistory.get(j + 1).getStatus() == DCWormsTags.PAUSED))
+							et = execHistory.get(j + 1).getTimeStamp().getMillis(); 
+						else et = Double.valueOf(exec.getFinishTime()).longValue() * MILLI_SEC; 
+						if(resUnit instanceof ProcessingElements){
+							ProcessingElements pes = (ProcessingElements) resUnit;
+							for(ComputingResource pe: pes){
+								String peName = pe.getFullName();
+								long startDate = st;
+								long endDate;
+								if(i == resourceHistory.size() - 1){
+									endDate = Double.valueOf(exec.getFinishTime()).longValue() * MILLI_SEC;
+								}else {
+									endDate = et;
+								}
+
+								String appID = getAppId(execTask);
+								
+								ResStat resStat = new ResStat(peName, pe.getType(), startDate, endDate, appID);
+								
+								List<ResStat> resStats = basicResStats.get(peName);
+								if (resStats == null) {
+									resStats = new ArrayList<ResStat>();
+									resStats.add(resStat);
+									basicResStats.put(peName, resStats);
+								} else {
+									resStats.add(resStat);
+								}
+								
+								String uniqueTaskID = getUniqueTaskId(execTask);
+
+								Set<ComputingResource> peNames = task_processorsMap.get(uniqueTaskID);
+								if (peNames == null) {
+									peNames = new HashSet<ComputingResource>();
+									peNames.add(pe);
+									task_processorsMap.put(uniqueTaskID, peNames);
+								} else {
+									peNames.add(pe);
+								}
+
+								try{
+									double usefulWork = execTask.getResourceConsumptionProfile().getUsefulWork()/pes.size();
+									usefulWork = ((et - st) / (1000 * getExecutionTime(execTask))) * usefulWork;
+									GSSAccumulator uwAcc;
+									if(metCalc.getMetricsData().containsKey("UW_" + pe.getFullName())){
+										uwAcc = metCalc.getMetricsData().get("UW_" + pe.getFullName()).get(0);
+										uwAcc.add(usefulWork);
+									} else {
+										uwAcc = new GSSAccumulator();
+										uwAcc.add(usefulWork);
+										metCalc.addMetricsData("UW_" + pe.getFullName(), uwAcc);
+									}
+								}  catch (Exception e){
+									
+								}
+								
+							}
+						} 
+						st = -1;
+					}
+				}
+			}
+		}
+		return basicResStats;
+	}
+	
+	private double getExecutionTime(ExecTask execTask) {
+		double executionTime = 0;
+		long previousTimestamp = 0;
+		int previousStatus = DCWormsTags.CREATED;
+		for(ExecutionHistoryItem execHistItem: execTask.getExecHistory()){
+			if(previousStatus == DCWormsTags.INEXEC){
+				executionTime = executionTime  + (execHistItem.getTimeStamp().getMillis()/1000 - previousTimestamp);
+			} 
+			previousTimestamp  = execHistItem.getTimeStamp().getMillis()/1000;
+			previousStatus = execHistItem.getStatus();
+		}
+		return executionTime;
+		//return task.getFinishTime() - task.getExecStartTime();
 	}
 	
Index: DCWoRMS/branches/coolemall/src/simulator/stats/implementation/TaskStats.java
===================================================================
--- DCWoRMS/branches/coolemall/src/simulator/stats/implementation/TaskStats.java	(revision 1247)
+++ DCWoRMS/branches/coolemall/src/simulator/stats/implementation/TaskStats.java	(revision 1362)
@@ -1,4 +1,6 @@
 package simulator.stats.implementation;
 
+
+import gridsim.dcworms.DCWormsTags;
 
 import java.util.HashSet;
@@ -11,4 +13,5 @@
 import schedframe.resources.computing.Core;
 import schedframe.resources.computing.Processor;
+import schedframe.scheduling.ExecutionHistoryItem;
 import simulator.stats.implementation.out.StatsSerializer;
 import dcworms.schedframe.scheduling.Executable;
@@ -102,5 +105,16 @@
 
 	public double getExecutionTime() {
-		return task.getFinishTime() - task.getExecStartTime();
+		double executionTime = 0;
+		long previousTimestamp = 0;		
+		int previousStatus = DCWormsTags.CREATED;
+		for(ExecutionHistoryItem execHistItem: task.getExecHistory()){
+			if(previousStatus == DCWormsTags.INEXEC){
+				executionTime = executionTime  + (execHistItem.getTimeStamp().getMillis()/1000 - previousTimestamp);
+			} 
+			previousTimestamp  = execHistItem.getTimeStamp().getMillis()/1000;
+			previousStatus = execHistItem.getStatus();
+		}
+		return executionTime;
+		//return task.getFinishTime() - task.getExecStartTime();
 	}
 
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/ExecutionHistoryItem.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/ExecutionHistoryItem.java	(revision 1362)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/ExecutionHistoryItem.java	(revision 1362)
@@ -0,0 +1,54 @@
+package schedframe.scheduling;
+
+import org.joda.time.DateTime;
+
+public class ExecutionHistoryItem {
+
+	protected DateTime timeStamp;
+	protected double completionPercentage;
+	protected double estimatedDuration;
+	protected int status;
+	protected int resUsageIndex;
+
+	public ExecutionHistoryItem(DateTime time){
+		this.timeStamp = time;
+	}
+
+	public DateTime getTimeStamp(){
+		return timeStamp;
+	}
+
+	public double getCompletionPercentage() {
+		return completionPercentage;
+	}
+
+	public void setCompletionPercentage(double completionPercentage) {
+		this.completionPercentage = completionPercentage;
+	}
+
+	public double getEstimatedDuration() {
+		return estimatedDuration;
+	}
+
+	public void setEstimatedDuration(double estimatedDuration) {
+		this.estimatedDuration = estimatedDuration;
+	}
+
+	public int getResIndex() {
+		return resUsageIndex;
+	}
+
+	public void setResIndex(int resUsageIndex) {
+		this.resUsageIndex = resUsageIndex;
+	}
+
+	public int getStatus() {
+		return status;
+	}
+
+	public void setStatus(int status) {
+		this.status = status;
+	}
+
+	
+}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Task.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Task.java	(revision 1207)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/Task.java	(revision 1362)
@@ -1,3 +1,5 @@
 package schedframe.scheduling.tasks;
+
+import gridsim.dcworms.DCWormsTags;
 
 import java.io.StringReader;
@@ -439,5 +441,5 @@
 	public boolean isFinished(){
 		if(processes == null)
-			return (status > 3 && status <= 6);
+			return (status >= DCWormsTags.SUCCESS && status <= DCWormsTags.FAILED);
 		
 		for(int i = 0; i < processes.size(); i++){
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java	(revision 1362)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ExecutionProfile.java	(revision 1362)
@@ -0,0 +1,46 @@
+package schedframe.scheduling.tasks.phases;
+
+import java.util.LinkedList;
+
+public class ExecutionProfile {
+	
+	protected LinkedList<ResourceConsumption> resourceConsumptionList;
+	protected long usefulWork;
+	private int currentPhase;
+
+	public ExecutionProfile(LinkedList<ResourceConsumption> resourceConsumptionList) {
+		this.resourceConsumptionList = resourceConsumptionList;
+		this.currentPhase = 0;
+	}
+	
+	public LinkedList<ResourceConsumption> getResourceConsumptionList(){
+		return resourceConsumptionList;
+	}
+	
+	public ResourceConsumption getCurrentResourceConsumption(){
+		return resourceConsumptionList.get(currentPhase);
+	}
+
+	public int getCurrentPhase() {
+		return currentPhase;
+	}
+
+	public void setCurrentPhase(int currentPhase) {
+		this.currentPhase = currentPhase;
+	}
+
+	public long getUsefulWork() {
+		return usefulWork;
+	}
+
+	public void setUsefulWork(long usefulWork) {
+		this.usefulWork = usefulWork;
+	}
+	
+	public boolean isLast(){
+		if(currentPhase == resourceConsumptionList.size() - 1){
+			return true;
+		}
+		return false;
+	}
+}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumptionProfile.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/tasks/phases/ResourceConsumptionProfile.java	(revision 1207)
+++ 	(revision )
@@ -1,47 +1,0 @@
-package schedframe.scheduling.tasks.phases;
-
-import java.util.LinkedList;
-
-public class ResourceConsumptionProfile {
-	
-	protected LinkedList<ResourceConsumption> resourceConsumptionList;
-	protected long usefulWork;
-	private int currentPhase;
-	
-	public ResourceConsumptionProfile() {
-		this.resourceConsumptionList = new LinkedList<ResourceConsumption>();
-		this.currentPhase = -1;
-	}
-	
-	public ResourceConsumptionProfile(LinkedList<ResourceConsumption> resourceConsumptionList) {
-		this.resourceConsumptionList = resourceConsumptionList;
-		this.currentPhase = -1;
-	}
-	
-	public LinkedList<ResourceConsumption> getResourceConsumptionList(){
-		return resourceConsumptionList;
-	}
-	
-	public ResourceConsumption getCurrentResourceConsumption(){
-		if(currentPhase < resourceConsumptionList.size())
-			return resourceConsumptionList.get(currentPhase);
-		else 
-			return null;
-	}
-
-	public int getCurrentPhase() {
-		return currentPhase;
-	}
-
-	public void setCurrentPhase(int currentPhase) {
-		this.currentPhase = currentPhase;
-	}
-
-	public long getUsefulWork() {
-		return usefulWork;
-	}
-
-	public void setUsefulWork(long usefulWork) {
-		this.usefulWork = usefulWork;
-	}
-}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/Scheduler.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/Scheduler.java	(revision 970)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/Scheduler.java	(revision 1362)
@@ -136,5 +136,4 @@
 				break;
 			}
-			
 			// process the received event
 			processRequest(ev);
@@ -147,10 +146,7 @@
 
 		case GridSimTags.GRIDLET_SUBMIT:
-			processWorkloadUnitSubmit(ev, false);
-			break;
-
-		case GridSimTags.GRIDLET_SUBMIT_ACK:
-			processWorkloadUnitSubmit(ev, true);
-			break;
+			processWorkloadUnitSubmit(ev);
+			break;
+
 
 		case GridSimTags.GRIDLET_RETURN:
@@ -187,7 +183,7 @@
 	}
 
-	protected void processWorkloadUnitSubmit(Sim_event ev, boolean ack) {
+	protected void processWorkloadUnitSubmit(Sim_event ev) {
 		WorkloadUnit job = (WorkloadUnit) ev.get_data();
-		managementSystem.notifySubmittedWorkloadUnit(job, ack);
+		managementSystem.notifySubmittedWorkloadUnit(job);
 	}
 	
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/global/GlobalManagementSystem.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/global/GlobalManagementSystem.java	(revision 1357)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/global/GlobalManagementSystem.java	(revision 1362)
@@ -71,5 +71,5 @@
 	}
 	
-	public void notifySubmittedWorkloadUnit(WorkloadUnit wu, boolean ack) {
+	public void notifySubmittedWorkloadUnit(WorkloadUnit wu) {
 		if (!pluginSupportsEvent(GridSimTags.GRIDLET_SUBMIT)) {
 			log.error("Plugin " + schedulingPlugin.getClass()
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/AbstractManagementSystem.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/AbstractManagementSystem.java	(revision 579)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/AbstractManagementSystem.java	(revision 1362)
@@ -212,5 +212,5 @@
 	public abstract WorkloadUnitHandler getWorkloadUnitHandler();
 	
-	public abstract void notifySubmittedWorkloadUnit(WorkloadUnit wu, boolean ack);
+	public abstract void notifySubmittedWorkloadUnit(WorkloadUnit wu);
 
 	public abstract void notifyReturnedWorkloadUnit(WorkloadUnit wu);
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java	(revision 1357)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/policy/local/LocalManagementSystem.java	(revision 1362)
@@ -1,18 +1,12 @@
 package schedframe.scheduling.policy.local;
-
-import dcworms.schedframe.scheduling.ExecTask;
-import dcworms.schedframe.scheduling.Executable;
-import eduni.simjava.Sim_event;
-import eduni.simjava.Sim_system;
-import gridsim.dcworms.DCWormsTags;
-import gridsim.dcworms.filter.ExecTaskFilter;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-
-import org.apache.commons.lang.ArrayUtils;
+import java.util.Set;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -38,9 +32,9 @@
 import schedframe.resources.units.ResourceUnitName;
 import schedframe.resources.units.StandardResourceUnitName;
+import schedframe.scheduling.ExecutionHistoryItem;
 import schedframe.scheduling.ResourceHistoryItem;
 import schedframe.scheduling.Scheduler;
 import schedframe.scheduling.TaskList;
 import schedframe.scheduling.TaskListImpl;
-import schedframe.scheduling.UsedResourcesList;
 import schedframe.scheduling.WorkloadUnitHandler;
 import schedframe.scheduling.manager.resources.LocalResourceManager;
@@ -64,4 +58,10 @@
 import simulator.stats.GSSAccumulator;
 import simulator.utils.DoubleMath;
+import dcworms.schedframe.scheduling.ExecTask;
+import dcworms.schedframe.scheduling.Executable;
+import eduni.simjava.Sim_event;
+import eduni.simjava.Sim_system;
+import gridsim.dcworms.DCWormsTags;
+import gridsim.dcworms.filter.ExecTaskFilter;
 
 public class LocalManagementSystem extends AbstractManagementSystem {
@@ -127,6 +127,4 @@
 				finalizeExecutable(execTask);
 				sendFinishedWorkloadUnit(execTask);
-				log.debug(execTask.getJobId() + "_" + execTask.getId() + " finished execution on " + new DateTime());
-				log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad());
 				if (pluginSupportsEvent(tag)) {
 					SchedulingEvent event = new TaskFinishedEvent(execTask.getJobId(), execTask.getId());
@@ -164,12 +162,50 @@
 			break;
 			
+		case DCWormsTags.TASK_PAUSE:{
+			String[] ids = (String[]) ev.get_data();
+			execTask = jobRegistry.getTask(ids[0], ids[1]);
+			taskPause(execTask);
+			if (pluginSupportsEvent(tag)) {
+				SchedulingEvent event = new SchedulingEvent(SchedulingEventType.TASK_PAUSED);
+				SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event,
+						queues, getJobRegistry(), getResourceManager(), moduleList);
+				executeSchedulingPlan(decision);
+			}
+		}
+		break;
+		
+		case DCWormsTags.TASK_RESUME:{
+			String[] ids = (String[]) ev.get_data();
+			execTask = jobRegistry.getTask(ids[0], ids[1]);
+			taskResume(execTask, execTask.getAllocatedResources().getLast().getResourceUnits());
+			if (pluginSupportsEvent(tag)) {
+				SchedulingEvent event = new StartTaskExecutionEvent(ids[0], ids[1]);
+				SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event,
+						queues, getJobRegistry(), getResourceManager(), moduleList);
+				executeSchedulingPlan(decision);
+			}
+		}
+		break;
+			
+		case DCWormsTags.TASK_MOVE:{
+			Object[] data = (Object[]) ev.get_data();
+			execTask = jobRegistry.getTask((String)data[0], (String)data[1]);
+			taskMove(execTask, (Map<ResourceUnitName, ResourceUnit>)data[2]);
+			if (pluginSupportsEvent(tag)) {
+				SchedulingEvent event = new StartTaskExecutionEvent((String)data[0], (String)data[1]);
+				SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event,
+						queues, getJobRegistry(), getResourceManager(), moduleList);
+				executeSchedulingPlan(decision);
+			}
+		}
+		break;
 			
 		case DCWormsTags.TASK_EXECUTION_CHANGED:
 			execTask = (ExecTask) ev.get_data();
-			updateTaskExecution(execTask, SchedulingEventType.RESOURCE_STATE_CHANGED);
+			updateTaskExecutionPhase(execTask, SchedulingEventType.RESOURCE_STATE_CHANGED);
 			break;
-			
+
 		case DCWormsTags.UPDATE_PROCESSING:
-			updateProcessingTimes(ev);
+			updateProcessingTimes();
 			break;
 			
@@ -177,6 +213,7 @@
 			if (pluginSupportsEvent(tag)) {
 				SchedulingEvent event = new SchedulingEvent(SchedulingEventType.POWER_LIMIT_EXCEEDED);
-				schedulingPlugin.schedule(event,
+				SchedulingPlanInterface<?> decision = schedulingPlugin.schedule(event,
 						queues,  getJobRegistry(), getResourceManager(), moduleList);
+				executeSchedulingPlan(decision);
 			}
 			break;
@@ -184,4 +221,63 @@
 	}
 
+
+	public void taskPause(ExecTask execTask) {
+		if (execTask == null) {
+			return;
+		} else {
+			try {
+				execTask.setStatus(DCWormsTags.PAUSED);
+				
+				Executable exec = (Executable) execTask;
+				Map<ResourceUnitName, ResourceUnit> lastUsed = exec.getAllocatedResources().getLast().getResourceUnits();
+				getAllocationManager().freeResources(lastUsed);
+				
+				saveExecutionHistory(exec, exec.getCompletionPercentage(), exec.getEstimatedDuration());
+				
+				ExecTaskFilter filter = new ExecTaskFilter(exec.getUniqueId(), -1);
+				scheduler.sim_cancel(filter, null);
+				
+				PEUnit peUnit = (PEUnit)lastUsed.get(StandardResourceUnitName.PE);
+				updateComputingResources(peUnit, EnergyEventType.TASK_FINISHED, exec);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}		
+	}
+	
+	public void taskResume(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> resources) {
+		if (execTask == null) {
+			return;
+		} else if (execTask.getStatus() == DCWormsTags.PAUSED) {
+			try {
+				execTask.setStatus(DCWormsTags.RESUMED);
+				Executable exec = (Executable) execTask;
+
+				boolean status = allocateResources(exec, resources);
+				if(status == false){
+					TaskList newTasks = new TaskListImpl();
+					newTasks.add(exec);
+					schedulingPlugin.placeTasksInQueues(newTasks, queues, getResourceManager(), moduleList);
+					exec.setStatus(DCWormsTags.READY);
+				} else {
+					runTask(execTask);
+					
+					PEUnit peUnit = (PEUnit)resources.get(StandardResourceUnitName.PE);
+					updateComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec);
+				}
+
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}			
+	}
+	
+	public void taskMove(ExecTask execTask, Map<ResourceUnitName, ResourceUnit> map) {
+		taskPause(execTask);
+		taskResume(execTask, map);
+	}
+	
 	public void notifyReturnedWorkloadUnit(WorkloadUnit wu) {
 		if (pluginSupportsEvent(DCWormsTags.TASK_EXECUTION_FINISHED)) {
@@ -229,5 +325,5 @@
 
 		Executable exec = (Executable)task;
-		boolean allocationStatus = getAllocationManager().allocateResources(choosenResources);
+		boolean allocationStatus = allocateResources(exec, choosenResources);
 		if(allocationStatus == false){
 			log.info("Task " + task.getJobId() + "_" + task.getId() + " requires more resources than is available at this moment.");
@@ -239,25 +335,9 @@
 		log.debug(task.getJobId() + "_" + task.getId() + " starts executing on " + new DateTime());
 
-		//if (phaseDuration < 0.0)
-		//	return;
-
-		//exec.setEstimatedDuration(exec.getEstimatedDuration() + phaseDuration);
-		DateTime currentTime = new DateTime();
-		ResourceHistoryItem resHistItem = new ResourceHistoryItem(choosenResources, currentTime);
-		resHistItem.setCompletionPercentage(0);
-		exec.addUsedResources(resHistItem);
-		
-		try {
-			exec.setStatus(DCWormsTags.INEXEC);
-		} catch (Exception e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
+		runTask(exec);
 		
 		PEUnit peUnit = (PEUnit)choosenResources.get(StandardResourceUnitName.PE);
 		updateComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec);
 		
-		updateTaskExecution(exec, SchedulingEventType.START_TASK_EXECUTION);
-		//scheduler.sendInternal(time, DCWormsTags.TASK_EXECUTION_FINISHED, exec);
 
 		try {
@@ -269,8 +349,32 @@
 		}
 
-		log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad());
-		
-	}
-	
+		log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad());		
+	}
+	
+	private void runTask(ExecTask execTask){
+		Executable exec = (Executable) execTask;
+		Map<ResourceUnitName, ResourceUnit> resources = exec.getAllocatedResources().getLast().getResourceUnits();
+		
+		try {
+			exec.setStatus(DCWormsTags.INEXEC);
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.START_TASK_EXECUTION), 
+				execTask, resources, exec.getCompletionPercentage())).intValue();
+
+		saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration);
+		if(exec.getResourceConsumptionProfile().isLast()){
+			scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_FINISHED, execTask);;
+		} else {
+			scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_CHANGED, execTask);
+		}
+		
+		PEUnit peUnit = (PEUnit)resources.get(StandardResourceUnitName.PE);
+		updateComputingResources(peUnit, EnergyEventType.TASK_STARTED, exec);
+		
+	}
 	protected void finalizeExecutable(ExecTask execTask){
 		
@@ -304,12 +408,15 @@
 			}
 		}
-		
-		UsedResourcesList lastUsedList = exec.getUsedResources();
-		Map<ResourceUnitName, ResourceUnit> lastUsed = lastUsedList.getLast()
-				.getResourceUnits();
+
+		Map<ResourceUnitName, ResourceUnit> lastUsed = exec.getAllocatedResources().getLast().getResourceUnits();
 		getAllocationManager().freeResources(lastUsed);
+		
+		saveExecutionHistory(exec, 100,0);
 		
 		PEUnit peUnit = (PEUnit)lastUsed.get(StandardResourceUnitName.PE);
 		updateComputingResources(peUnit, EnergyEventType.TASK_FINISHED, exec);
+		
+		log.debug(execTask.getJobId() + "_" + execTask.getId() + " finished execution on " + new DateTime());
+		log.info(DCWormsConstants.USAGE_MEASURE_NAME + ": " + calculateTotalLoad());
 	}
 	
@@ -326,17 +433,10 @@
 			ExecTask task = iter.next();
 			Executable exec = (Executable)task;
-
-			if(exec.getUsedResources().size() > 1){
-				//System.out.println("--- upadteProgressX: " + Sim_system.sim_clock() );
-				//System.out.println("taskId: " + exec.getId() + "; completion percentage: " + exec.getCompletionPercentage() + "; timespan: " + timeSpan + "; estimatedDuration: " +  exec.getEstimatedDuration());
-				exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / (exec.getEstimatedDuration()) * (1.0 - exec.getUsedResources().get(exec.getUsedResources().size()-1).getCompletionPercentage()/100.0)));
-				//System.out.println("newProgress: " + exec.getCompletionPercentage()  );	
-			} 
-			else {
-				//System.out.println("--- upadteProgress2: " + Sim_system.sim_clock() );
-				//System.out.println("taskId: " + exec.getId() + "; completion percentage: " + exec.getCompletionPercentage() + "; timespan: " + timeSpan + "; estimatedDuration: " +  exec.getEstimatedDuration());
-				exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / exec.getEstimatedDuration()));
-				//System.out.println("newProgress: " + exec.getCompletionPercentage()  );	
-			}
+			ExecutionHistoryItem execHistItem = exec.getExecHistory().getLast();
+			//System.out.println("--- upadteProgressX: " + Sim_system.sim_clock() );
+			//System.out.println("taskId: " + exec.getId() + "; completion percentage: " + exec.getCompletionPercentage() + "; timespan: " + timeSpan + "; estimatedDuration: " +  execHistItem.getCompletionPercentage());
+			exec.setCompletionPercentage(exec.getCompletionPercentage() + 100 * (timeSpan / (execHistItem.getEstimatedDuration()) * (1.0 - execHistItem.getCompletionPercentage()/100.0)));
+			//System.out.println("newProgress: " + exec.getCompletionPercentage()  );	
+
 		}
 	}
@@ -368,28 +468,27 @@
 	}
 
-	protected void updateProcessingTimes(Sim_event ev) {
+	protected void updateProcessingTimes() {
 		for (ExecTask execTask : jobRegistry.getRunningTasks()) {
 			Executable exec = (Executable)execTask;
 
-			Map<ResourceUnitName, ResourceUnit> choosenResources = exec.getUsedResources().getLast().getResourceUnits();
-			double lastTimeStamp = exec.getUsedResources().getLast().getTimeStamp().getMillis()/1000;
+
+			Map<ResourceUnitName, ResourceUnit> choosenResources = exec.getAllocatedResources().getLast().getResourceUnits();
+
 			int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(SchedulingEventType.RESOURCE_STATE_CHANGED), 
 					execTask, choosenResources, exec.getCompletionPercentage())).intValue();
 
-			if(DoubleMath.subtract((lastTimeStamp + exec.getEstimatedDuration()), (new DateTime().getMillis()/1000 + phaseDuration)) == 0.0){
+			ExecutionHistoryItem execHistItem = exec.getExecHistory().getLast();
+			double lastTimeStamp = execHistItem.getTimeStamp().getMillis()/1000;
+			if(DoubleMath.subtract((lastTimeStamp + execHistItem.getEstimatedDuration()), (new DateTime().getMillis()/1000 + phaseDuration)) == 0.0){
 				continue;
 			}
 			//System.out.println("=== upadteTIme: " + Sim_system.sim_clock() );
-			//System.out.println("execId: " + exec.getId() +  "; estimatedDuration " + exec.getEstimatedDuration());
-			//System.out.println("execId: " + exec.getId() + "; difference " + DoubleMath.subtract((lastTimeStamp + exec.getEstimatedDuration()), (new DateTime().getMillis()/1000 + phaseDuration)));
+			//System.out.println("execId: " + exec.getId() +  "; estimatedDuration " + execHistItem.getEstimatedDuration());
+			//System.out.println("execId: " + exec.getId() + "; difference " + DoubleMath.subtract((lastTimeStamp + execHistItem.getEstimatedDuration()), (new DateTime().getMillis()/1000 + phaseDuration)));
 			//System.out.println("completionPercantage: " + exec.getCompletionPercentage() + "; basic duration: " +exec.getResourceConsumptionProfile().getCurrentResourceConsumption().getDuration() +   "; phaseDuration: " +  phaseDuration);
 
-			exec.setEstimatedDuration(phaseDuration);
-			DateTime currentTime = new DateTime();
-			ResourceHistoryItem resHistItem = new ResourceHistoryItem(choosenResources, currentTime);
-			resHistItem.setCompletionPercentage(exec.getCompletionPercentage());
-			exec.addUsedResources(resHistItem);
-			
-			if(exec.getResourceConsumptionProfile().getCurrentResourceConsumption() == exec.getResourceConsumptionProfile().getResourceConsumptionList().getLast()){
+			saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration);
+			
+			if(exec.getResourceConsumptionProfile().isLast()){
 				ExecTaskFilter filter = new ExecTaskFilter(exec.getUniqueId(), DCWormsTags.TASK_EXECUTION_FINISHED);
 				scheduler.sim_cancel(filter, null);
@@ -407,5 +506,5 @@
 	}	
 
-	protected void updateTaskExecution(ExecTask execTask, SchedulingEventType schedEvType) {
+	protected void updateTaskExecutionPhase(ExecTask execTask, SchedulingEventType schedEvType) {
 
 		if (execTask.getStatus() == DCWormsTags.INEXEC) {
@@ -415,22 +514,22 @@
 				exec.setStatus(DCWormsTags.NEW_EXEC_PHASE);
 			} catch (Exception e) {
-			}
-			
-			Map<ResourceUnitName, ResourceUnit> choosenResources = exec.getUsedResources().getLast().getResourceUnits();
+				
+			}
+
+			Map<ResourceUnitName, ResourceUnit> choosenResources = exec.getAllocatedResources().getLast().getResourceUnits();
 
 			int phaseDuration = Double.valueOf(execTimeEstimationPlugin.execTimeEstimation(new SchedulingEvent(schedEvType), 
 					execTask, choosenResources, exec.getCompletionPercentage())).intValue();
-
-			exec.setEstimatedDuration(phaseDuration);
-			
-			if(exec.getResourceConsumptionProfile().getCurrentResourceConsumption() == exec.getResourceConsumptionProfile().getResourceConsumptionList().getLast()){
+			
+			saveExecutionHistory(exec, exec.getCompletionPercentage(), phaseDuration);
+			
+			if(exec.getResourceConsumptionProfile().isLast()){
 				scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_FINISHED, execTask);
-				PEUnit peUnit = (PEUnit)exec.getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE);
-				updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);
 			} else {
 				scheduler.sendInternal(phaseDuration, DCWormsTags.TASK_EXECUTION_CHANGED, execTask);
-				PEUnit peUnit = (PEUnit)exec.getUsedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE);
-				updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);
-			}
+			}
+			
+			PEUnit peUnit = (PEUnit)exec.getAllocatedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE);
+			updateComputingResources(peUnit, EnergyEventType.RESOURCE_UTILIZATION_CHANGED, exec);
 		}
 	}	
@@ -501,5 +600,5 @@
 	}
 	
-	public void notifySubmittedWorkloadUnit(WorkloadUnit wu, boolean ack) {
+	public void notifySubmittedWorkloadUnit(WorkloadUnit wu) {
 		//250314
 		//updateProcessingProgress();
@@ -562,14 +661,6 @@
 			Executable exec = (Executable) task;
 			jobRegistry.addExecTask(exec);
-			
-			exec.trackResource(scheduler.get_name());
-			Scheduler parentScheduler = scheduler.getParent();
-			List<String> visitedResource = exec.getVisitedResources();
-			String [] visitedResourcesArray = visitedResource.toArray(new String[visitedResource.size()]);
-			while (parentScheduler != null && !ArrayUtils.contains(visitedResourcesArray, parentScheduler.get_name())) {
-				exec.trackResource(parentScheduler.get_name());
-				parentScheduler = parentScheduler.getParent();
-			}
-			exec.setSchedulerName(scheduler.get_id());
+
+			exec.setSchedulerName(scheduler.getFullName());
 			
 			TaskList newTasks = new TaskListImpl();
@@ -596,3 +687,46 @@
 	}
 	
+	
+	public void saveExecutionHistory(Executable exec, double completionPercentage, double estimatedDuration){
+
+		ExecutionHistoryItem execHistoryItem = new ExecutionHistoryItem(new DateTime());
+		execHistoryItem.setCompletionPercentage(completionPercentage);
+		execHistoryItem.setEstimatedDuration(estimatedDuration);
+		execHistoryItem.setResIndex(exec.getAllocatedResources().size() -1);
+		execHistoryItem.setStatus(exec.getStatus());
+		exec.addExecHistory(execHistoryItem);
+		
+		ProcessingElements pes = (ProcessingElements) exec.getAllocatedResources().getLast().getResourceUnits().get(StandardResourceUnitName.PE);
+		for (ComputingResource resource : pes) {
+
+			LinkedList<ComputingResource> toExamine = new LinkedList<ComputingResource>();
+			toExamine.push(resource);
+
+			while (!toExamine.isEmpty()) {
+				ComputingResource compResource = toExamine.pop();
+				List<ComputingResource> resources = compResource.getChildren();
+				if(resources.isEmpty()){
+					Set<String> visitedResources = exec.getAllocatedResources().getLast().getVisitedResources();
+					if(!visitedResources.contains(compResource.getFullName())){
+						exec.getAllocatedResources().getLast().trackResource(compResource.getFullName());
+					}
+				} else {
+					for (int i = 0; i < resources.size(); i++) {
+						ComputingResource resourceChild = resources.get(i);
+						toExamine.addLast(resourceChild);
+					}
+				}
+			}
+		}
+	}
+	
+	public boolean allocateResources(Executable exec, Map<ResourceUnitName, ResourceUnit> choosenResources){
+		boolean allocationStatus = getAllocationManager().allocateResources(choosenResources);
+		if(allocationStatus){
+			ResourceHistoryItem resourceHistoryItem = new ResourceHistoryItem(choosenResources);
+			exec.addAllocatedResources(resourceHistoryItem);
+			return true;
+		}
+		return false;
+	}
 }
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceHistoryItem.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceHistoryItem.java	(revision 1317)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/ResourceHistoryItem.java	(revision 1362)
@@ -1,26 +1,19 @@
 package schedframe.scheduling;
 
+import java.util.HashSet;
 import java.util.Map;
-
-import org.joda.time.DateTime;
+import java.util.Set;
 
 import schedframe.resources.units.ResourceUnit;
 import schedframe.resources.units.ResourceUnitName;
 
-//TODO - change name
 public class ResourceHistoryItem {
 
 	protected Map<ResourceUnitName, ResourceUnit> usedResources;
-	protected DateTime timeStamp;
-	protected double completionPercentage;
-	
-	/**
-	 * 
-	 * @param map hash map of resource units, which should be remembered
-	 * @param time the moment in time when this resource configuration was created  
-	 */
-	public ResourceHistoryItem(Map<ResourceUnitName, ResourceUnit> map, DateTime time){
-		this.usedResources = map;
-		this.timeStamp = time;
+	protected Set<String> visitedResources;
+
+	public ResourceHistoryItem(Map<ResourceUnitName, ResourceUnit> usedResources){
+		this.usedResources = usedResources;
+		this.visitedResources = new HashSet<String>();
 	}
 	
@@ -29,14 +22,10 @@
 	}
 	
-	public DateTime getTimeStamp(){
-		return timeStamp;
+	public void trackResource(String resName){
+		visitedResources.add(resName);
 	}
-
-	public double getCompletionPercentage() {
-		return completionPercentage;
-	}
-
-	public void setCompletionPercentage(double completionPercentage) {
-		this.completionPercentage = completionPercentage;
+	
+	public Set<String> getVisitedResources(){
+		return visitedResources;
 	}
 	
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistry.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistry.java	(revision 1151)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistry.java	(revision 1362)
@@ -3,8 +3,11 @@
 
 import java.util.List;
+import java.util.Map;
 
 import dcworms.schedframe.scheduling.ExecTask;
 
 import schedframe.ExecutablesList;
+import schedframe.resources.units.ResourceUnit;
+import schedframe.resources.units.ResourceUnitName;
 import schedframe.scheduling.tasks.JobInterface;
 import schedframe.scheduling.tasks.TaskInterface;
@@ -27,11 +30,11 @@
 
 	
-	public List<ExecTask> getTasks(int status) ;
+	public List<ExecTask> getTasks(int status);
 
-	public List<ExecTask> getQueuedTasks() ;
+	public List<ExecTask> getQueuedTasks();
 	
-	public List<ExecTask> getRunningTasks() ;
+	public List<ExecTask> getRunningTasks();
 	
-	public List<ExecTask> getReadyTasks() ;
+	public List<ExecTask> getReadyTasks();
 	
 	public List<ExecTask> getFinishedTasks();
@@ -39,4 +42,14 @@
 	
 	public List<? extends TaskInterface<?>> getAvailableTasks(List<JobInterface<?>> jobsList);
+	
+	
+	public boolean pauseTask(String jobId, String taskId);
+	
+	public boolean resumeTask(String jobId, String taskId);
+	
+	public boolean migrateTask(String jobId, String taskId, Map<ResourceUnitName, ResourceUnit> choosenResources);
+	
+	public boolean migrateTask(String jobId, String taskId, String nodeName);
+	
 
 }
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java	(revision 1151)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/JobRegistryImpl.java	(revision 1362)
@@ -5,6 +5,6 @@
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang.ArrayUtils;
+import java.util.Set;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -21,6 +21,4 @@
 
 public class JobRegistryImpl extends AbstractJobRegistry {
-	
-	private static final long serialVersionUID = 8030555906990767342L;
 
 	private static Log log = LogFactory.getLog(JobRegistryImpl.class);
@@ -55,6 +53,12 @@
 			for (ExecTask task: executables) {
 				if (task.getStatus() == status) {
-					List<String> visitedResource = task.getVisitedResources();
-					if(ArrayUtils.contains(visitedResource.toArray(new String[visitedResource.size()]), context)) {
+					Set<String> visitedResource = task.getAllocatedResources().getLast().getVisitedResources();
+					for(String res: visitedResource){
+						if(res.contains(context)){
+							taskList.add(task);
+							break;
+						}
+					}
+					if(task.getSchedulerName().contains(context)) {
 						taskList.add(task);
 					}
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/AbstractJobRegistry.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/AbstractJobRegistry.java	(revision 1151)
+++ DCWoRMS/branches/coolemall/src/schedframe/scheduling/manager/tasks/AbstractJobRegistry.java	(revision 1362)
@@ -2,18 +2,23 @@
 
 
+import gridsim.dcworms.DCWormsTags;
+
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import schedframe.resources.units.ResourceUnit;
+import schedframe.resources.units.ResourceUnitName;
 import schedframe.scheduling.tasks.Job;
 import schedframe.scheduling.tasks.JobInterface;
 import schedframe.scheduling.tasks.Task;
 import schedframe.scheduling.tasks.TaskInterface;
+import simulator.DataCenterWorkloadSimulator;
+import dcworms.schedframe.scheduling.ExecTask;
 
 
 public abstract class AbstractJobRegistry /*extends ConcurrentHashMap<String, Job>*/ implements JobRegistry, Cloneable{
 	
-	private static final long serialVersionUID = 8409060063583755824L;
-
 	
 	protected static final ConcurrentHashMap<String, JobInterface<?>> jobs = new ConcurrentHashMap<String, JobInterface<?>>();
@@ -79,3 +84,49 @@
 	}
 
+	@Override
+	public boolean pauseTask(String jobId, String taskId) {
+		ExecTask execTask = getTask(jobId, taskId);
+		if (execTask == null) {
+			return false;
+		}else{
+			String[] ids = new String[2];
+			ids[0] = new String(jobId);
+			ids[1] = new String(taskId);
+			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.TASK_PAUSE, ids);
+			return true;
+		}
+	}
+
+	public boolean resumeTask(String jobId, String taskId) {
+		ExecTask execTask = getTask(jobId, taskId);
+		if (execTask == null) {
+			return false;
+		}else{
+			String[] ids = new String[2];
+			ids[0] = new String(jobId);
+			ids[1] = new String(taskId);
+			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.TASK_RESUME, ids);
+			return true;	
+		}
+	}
+
+	public boolean migrateTask(String jobId, String taskId, Map<ResourceUnitName, ResourceUnit> choosenResources) {
+		ExecTask execTask = getTask(jobId, taskId);
+		if (execTask == null) {
+			return false;
+		}else{
+			Object[] data = new Object[3];
+			data[0] = new String(jobId);
+			data[1] = new String(taskId);
+			data[2] = choosenResources;
+			DataCenterWorkloadSimulator.getEventManager().sendToAllSchedulers(0, DCWormsTags.TASK_MOVE, data);
+			return true;	
+		}
+	}
+
+	public boolean migrateTask(String jobId, String taskId, String nodeName) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
 }
Index: DCWoRMS/branches/coolemall/src/schedframe/scheduling/UsedResourcesList.java
===================================================================
--- DCWoRMS/branches/coolemall/src/schedframe/scheduling/UsedResourcesList.java	(revision 490)
+++ 	(revision )
@@ -1,12 +1,0 @@
-package schedframe.scheduling;
-
-import java.util.LinkedList;
-
-public class UsedResourcesList extends LinkedList<ResourceHistoryItem>{
-
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = 1L;
-	
-}
