Ignore:
Timestamp:
10/31/12 13:52:06 (12 years ago)
Author:
wojtekp
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • DCWoRMS/trunk/build/classes/example/timeestimation/DefaultTimeEstimationPlugin.java

    r477 r539  
    11package example.timeestimation; 
    22 
    3 import gssim.schedframe.scheduling.ExecTask; 
    43 
    54import java.util.Map; 
    65 
    7 import schedframe.Parameters; 
    8 import schedframe.PluginConfiguration; 
     6import dcworms.schedframe.scheduling.ExecTask; 
     7 
    98import schedframe.events.scheduling.SchedulingEvent; 
    109import schedframe.resources.units.PEUnit; 
     
    1615/** 
    1716 *  
    18  * @author Marcin Krystek 
     17 * @author Marcin Krystek && Wojciech Piatek 
    1918 * 
    2019 */ 
    21 public class DefaultTimeEstimationPlugin implements schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin{ 
     20 
     21public class DefaultTimeEstimationPlugin extends BaseTimeEstimationPlugin{ 
    2222 
    2323        /* 
    2424         * This method should return an estimation of time required to execute the task. 
    2525         * 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. 
    2727         *  
    2828         * Example implementation calculate the estimation based on cpu processing power. 
     
    3030         * of number of allocated cpus and their speed. 
    3131         */ 
    32         public double execTimeEstimation(SchedulingEvent event, 
     32        public double execTimeEstimation(SchedulingEvent event, ExecTask task, 
    3333                        Map<ResourceUnitName, ResourceUnit> allocatedResources, 
    34                         ExecTask task, double completionPercentage) { 
     34                        double completionPercentage) { 
    3535                 
    3636                // collect all information necessary to do the calculation 
     
    4343                int cnt = peUnit.getUsedAmount(); 
    4444 
    45                 double remainingLength =  task.getLength() * (1- completionPercentage); 
     45                // estimate remainingTaskLength 
     46                double remainingLength =  task.getLength() * (1 - completionPercentage/100); 
     47                 
    4648                // do the calculation 
    4749                double execTime = (remainingLength / (cnt * speed)); 
     
    5759        } 
    5860 
    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  
    7061} 
Note: See TracChangeset for help on using the changeset viewer.