com.sun.slamd.job
Class SingleStatisticWithCPUUtilizationOptimizationAlgorithm

java.lang.Object
  extended by com.sun.slamd.job.OptimizationAlgorithm
      extended by com.sun.slamd.job.SingleStatisticWithCPUUtilizationOptimizationAlgorithm

public class SingleStatisticWithCPUUtilizationOptimizationAlgorithm
extends OptimizationAlgorithm

This class defines a SLAMD optimization algorithm that looks at a single statistic within the job and finds the iteration with the highest or lowest value for a given stat tracker that also has a CPU utilization less than or equal to a given value.

For this optimization algorithm to be used, an optimizing job must include the appropriate data from at least one VMStat resource monitor. The data to examine can come from either a stat tracker providing only the specific utilization component to examine, or from the stacked value tracker that reports all three (user, system, and idle times). If there are multiple reports of CPU utilization, then they will all be taken into consideration.

Author:
Neil A. Wilson

Field Summary
static int OPTIMIZE_TYPE_MAXIMIZE
          The optimization type value that indicates that we should try to find the highest value for the statistic to optimize.
static int OPTIMIZE_TYPE_MINIMIZE
          The optimization type value that indicates that we should try to find the lowest value for the statistic to optimize.
static java.lang.String PARAM_MAX_CPU_UTILIZATION
          The name of the parameter that is used to specify the maximum CPU utilization that will be acceptable.
static java.lang.String PARAM_MIN_PCT_IMPROVEMENT
          The name of the parameter that is used to specify the minimum required percent improvement needed for a new best iteration.
static java.lang.String PARAM_OPTIMIZE_STAT
          The name of the parameter that is used to specify the statistic to optimize.
static java.lang.String PARAM_OPTIMIZE_TYPE
          The name of the parameter that is used to specify the type of optimization to perform.
static java.lang.String PARAM_UTILIZATION_COMPONENT
          The name of the parameter that is used to specify the component of CPU utilization that should be examined.
static java.lang.String UTILIZATION_COMPONENT_BUSY_STRING
          The string that will be displayed for the busy time utilization component.
static int UTILIZATION_COMPONENT_BUSY_TIME
          The utilization component that indicates that both user and system time should be considered.
static java.lang.String UTILIZATION_COMPONENT_SYSTEM_STRING
          The string that will be displayed for the system time utilization component.
static int UTILIZATION_COMPONENT_SYSTEM_TIME
          The utilization component that indicates that only system time should be considered.
static java.lang.String UTILIZATION_COMPONENT_USER_STRING
          The string that will be displayed for the user time utilization component.
static int UTILIZATION_COMPONENT_USER_TIME
          The utilization component that indicates that only user time should be considered.
 
Constructor Summary
SingleStatisticWithCPUUtilizationOptimizationAlgorithm()
          Creates a new instance of this optimization algorithm.
 
Method Summary
 boolean availableWithJobClass(JobClass jobClass)
          Indicates whether this optimization algorithm may be used when running the specified type of job.
 double getIterationOptimizationValue(Job iteration)
          Retrieves the value associated with the provided iteration of the given optimizing job.
 java.lang.String getOptimizationAlgorithmName()
          Retrieves the human-readable name that will be used for this optimization algorithm.
 ParameterList getOptimizationAlgorithmParameters()
          Retrieves the set of parameters that have been defined for this optimization algorithm.
 ParameterList getOptimizationAlgorithmParameterStubs(JobClass jobClass)
          Retrieves a set of parameter stubs that should be used to prompt the end user for the settings to use when executing the optimizing job.
 void initializeOptimizationAlgorithm(OptimizingJob optimizingJob, ParameterList parameters)
          Initializes this optimization algorithm with the provided set of parameters for the given optimizing job.
 boolean isBestIterationSoFar(Job iteration)
          Indicates whether the provided iteration is the best one seen so far for the given optimizing job based on the constraints specified in the parameters used to initialize this optimization algorithm.
 OptimizationAlgorithm newInstance()
          Creates a new, uninitialized instance of this optimization algorithm.
 void reInitializeOptimizationAlgorithm()
          Clears any state information currently set for this optimization algorithm and restores it to the state it would have if a new instance had been created and only the initializeOptimizationAlgorithm() method had been called on that instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_MIN_PCT_IMPROVEMENT

public static final java.lang.String PARAM_MIN_PCT_IMPROVEMENT
The name of the parameter that is used to specify the minimum required percent improvement needed for a new best iteration.

See Also:
Constant Field Values

PARAM_OPTIMIZE_STAT

public static final java.lang.String PARAM_OPTIMIZE_STAT
The name of the parameter that is used to specify the statistic to optimize.

See Also:
Constant Field Values

PARAM_OPTIMIZE_TYPE

public static final java.lang.String PARAM_OPTIMIZE_TYPE
The name of the parameter that is used to specify the type of optimization to perform.

See Also:
Constant Field Values

PARAM_MAX_CPU_UTILIZATION

public static final java.lang.String PARAM_MAX_CPU_UTILIZATION
The name of the parameter that is used to specify the maximum CPU utilization that will be acceptable.

See Also:
Constant Field Values

PARAM_UTILIZATION_COMPONENT

public static final java.lang.String PARAM_UTILIZATION_COMPONENT
The name of the parameter that is used to specify the component of CPU utilization that should be examined.

See Also:
Constant Field Values

OPTIMIZE_TYPE_MAXIMIZE

public static final int OPTIMIZE_TYPE_MAXIMIZE
The optimization type value that indicates that we should try to find the highest value for the statistic to optimize.

See Also:
Constant Field Values

OPTIMIZE_TYPE_MINIMIZE

public static final int OPTIMIZE_TYPE_MINIMIZE
The optimization type value that indicates that we should try to find the lowest value for the statistic to optimize.

See Also:
Constant Field Values

UTILIZATION_COMPONENT_USER_TIME

public static final int UTILIZATION_COMPONENT_USER_TIME
The utilization component that indicates that only user time should be considered.

See Also:
Constant Field Values

UTILIZATION_COMPONENT_SYSTEM_TIME

public static final int UTILIZATION_COMPONENT_SYSTEM_TIME
The utilization component that indicates that only system time should be considered.

See Also:
Constant Field Values

UTILIZATION_COMPONENT_BUSY_TIME

public static final int UTILIZATION_COMPONENT_BUSY_TIME
The utilization component that indicates that both user and system time should be considered.

See Also:
Constant Field Values

UTILIZATION_COMPONENT_USER_STRING

public static final java.lang.String UTILIZATION_COMPONENT_USER_STRING
The string that will be displayed for the user time utilization component.

See Also:
Constant Field Values

UTILIZATION_COMPONENT_SYSTEM_STRING

public static final java.lang.String UTILIZATION_COMPONENT_SYSTEM_STRING
The string that will be displayed for the system time utilization component.

See Also:
Constant Field Values

UTILIZATION_COMPONENT_BUSY_STRING

public static final java.lang.String UTILIZATION_COMPONENT_BUSY_STRING
The string that will be displayed for the busy time utilization component.

See Also:
Constant Field Values
Constructor Detail

SingleStatisticWithCPUUtilizationOptimizationAlgorithm

public SingleStatisticWithCPUUtilizationOptimizationAlgorithm()
Creates a new instance of this optimization algorithm. All subclasses must define a constructor that does not take any arguments, and they must invoke the constructor of this superclass as their first action.

Method Detail

getOptimizationAlgorithmName

public java.lang.String getOptimizationAlgorithmName()
Retrieves the human-readable name that will be used for this optimization algorithm.

Specified by:
getOptimizationAlgorithmName in class OptimizationAlgorithm
Returns:
The human-readable name that will be used for this optimization algorithm.

newInstance

public OptimizationAlgorithm newInstance()
Creates a new, uninitialized instance of this optimization algorithm. In most cases, this should simply return the object created from invoking the default constructor.

Specified by:
newInstance in class OptimizationAlgorithm
Returns:
The new instance of this optimization algorithm.

availableWithJobClass

public boolean availableWithJobClass(JobClass jobClass)
Indicates whether this optimization algorithm may be used when running the specified type of job. This algorithm is only available for jobs that report at least one "searchable" stat tracker.

Specified by:
availableWithJobClass in class OptimizationAlgorithm
Parameters:
jobClass - The job class for which to make the determination.
Returns:
true if this optimization algorithm may be used with the provided job class, or false if not.

reInitializeOptimizationAlgorithm

public void reInitializeOptimizationAlgorithm()
Clears any state information currently set for this optimization algorithm and restores it to the state it would have if a new instance had been created and only the initializeOptimizationAlgorithm() method had been called on that instance. In this case, all that is necessary is to forget about the best value seen so far.

Specified by:
reInitializeOptimizationAlgorithm in class OptimizationAlgorithm

getOptimizationAlgorithmParameterStubs

public ParameterList getOptimizationAlgorithmParameterStubs(JobClass jobClass)
Retrieves a set of parameter stubs that should be used to prompt the end user for the settings to use when executing the optimizing job.

Specified by:
getOptimizationAlgorithmParameterStubs in class OptimizationAlgorithm
Parameters:
jobClass - The job class that will be used for the optimizing job.
Returns:
A set of parameter stubs that should be used to prompt the end user for the settings to use when executing the optimizing job.

getOptimizationAlgorithmParameters

public ParameterList getOptimizationAlgorithmParameters()
Retrieves the set of parameters that have been defined for this optimization algorithm.

Specified by:
getOptimizationAlgorithmParameters in class OptimizationAlgorithm
Returns:
The set of parameters that have been defined for this optimization algorithm.

initializeOptimizationAlgorithm

public void initializeOptimizationAlgorithm(OptimizingJob optimizingJob,
                                            ParameterList parameters)
                                     throws InvalidValueException
Initializes this optimization algorithm with the provided set of parameters for the given optimizing job.

Specified by:
initializeOptimizationAlgorithm in class OptimizationAlgorithm
Parameters:
optimizingJob - The optimizing job with which this optimization algorithm will be used.
parameters - The parameter list containing the parameter values provided by the end user when scheduling the optimizing job.
Throws:
InvalidValueException - If the contents of the provided parameter list are not valid for use with this optimization algorithm.

isBestIterationSoFar

public boolean isBestIterationSoFar(Job iteration)
                             throws SLAMDException
Indicates whether the provided iteration is the best one seen so far for the given optimizing job based on the constraints specified in the parameters used to initialize this optimization algorithm.

Specified by:
isBestIterationSoFar in class OptimizationAlgorithm
Parameters:
iteration - The job iteration for which to make the determination.
Returns:
true if the provided iteration is the best one seen so far for the optimizing job, or false if not.
Throws:
SLAMDException - If a problem occurs that prevents a valid determination from being made. If this exception is thrown, then the optimizing job will stop immediately with no further iterations.

getIterationOptimizationValue

public double getIterationOptimizationValue(Job iteration)
                                     throws SLAMDException
Retrieves the value associated with the provided iteration of the given optimizing job.

Specified by:
getIterationOptimizationValue in class OptimizationAlgorithm
Parameters:
iteration - The job iteration for which to retrieve the value.
Returns:
The value associated with the provided iteration of the given optimizing job.
Throws:
SLAMDException - If a problem occurs while trying to determine the value for the given optimizing job iteration.