Changeset 539 for DCWoRMS/trunk/build/classes/example/timeestimation/DefaultTimeEstimationPlugin.java
- Timestamp:
- 10/31/12 13:52:06 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/trunk/build/classes/example/timeestimation/DefaultTimeEstimationPlugin.java
r477 r539 1 1 package example.timeestimation; 2 2 3 import gssim.schedframe.scheduling.ExecTask;4 3 5 4 import java.util.Map; 6 5 7 import schedframe.Parameters;8 import schedframe.PluginConfiguration; 6 import dcworms.schedframe.scheduling.ExecTask; 7 9 8 import schedframe.events.scheduling.SchedulingEvent; 10 9 import schedframe.resources.units.PEUnit; … … 16 15 /** 17 16 * 18 * @author Marcin Krystek 17 * @author Marcin Krystek && Wojciech Piatek 19 18 * 20 19 */ 21 public class DefaultTimeEstimationPlugin implements schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin{ 20 21 public class DefaultTimeEstimationPlugin extends BaseTimeEstimationPlugin{ 22 22 23 23 /* 24 24 * This method should return an estimation of time required to execute the task. 25 25 * Requested calculation should be done based on the resources allocated for the task, 26 * task description and task remaining length (in instructions).26 * task description and task completion percentage. 27 27 * 28 28 * Example implementation calculate the estimation based on cpu processing power. … … 30 30 * of number of allocated cpus and their speed. 31 31 */ 32 public double execTimeEstimation(SchedulingEvent event, 32 public double execTimeEstimation(SchedulingEvent event, ExecTask task, 33 33 Map<ResourceUnitName, ResourceUnit> allocatedResources, 34 ExecTask task,double completionPercentage) {34 double completionPercentage) { 35 35 36 36 // collect all information necessary to do the calculation … … 43 43 int cnt = peUnit.getUsedAmount(); 44 44 45 double remainingLength = task.getLength() * (1- completionPercentage); 45 // estimate remainingTaskLength 46 double remainingLength = task.getLength() * (1 - completionPercentage/100); 47 46 48 // do the calculation 47 49 double execTime = (remainingLength / (cnt * speed)); … … 57 59 } 58 60 59 public PluginConfiguration getConfiguration() {60 return null;61 }62 63 public String getName() {64 return "ExampleTimeEstimationPlugin";65 }66 67 public void init(Parameters parameters) {68 }69 70 61 }
Note: See TracChangeset
for help on using the changeset viewer.