com.sun.slamd.loadvariance
Class SineLoadVarianceAlgorithm

java.lang.Object
  extended bycom.sun.slamd.loadvariance.LoadVarianceAlgorithm
      extended bycom.sun.slamd.loadvariance.SineLoadVarianceAlgorithm

public class SineLoadVarianceAlgorithm
extends LoadVarianceAlgorithm

This class defines a load variance algorithm that may be used to increase or decrease the number of active threads using curves based on various sections of the sine wave.

Each invocation of this load variance algorithm should consist of two tab-delimited components. The first should be one of the following strings:

The second argument should be one of the following strings:


Field Summary
static int METHOD_DECREASE_BY_NUMBER
          The variation method that indicates that the number of active threads should be decreased by a fixed amount.
static int METHOD_DECREASE_BY_PERCENT
          The variation method that indicates that the number of active threads should be decreased by a percentage of the total number of threads.
static int METHOD_INCREASE_BY_NUMBER
          The variation method that indicates that the number of active threads should be increased by a fixed amount.
static int METHOD_INCREASE_BY_PERCENT
          The variation method that indicates that the number of active threads should be increased by a percentage of the total number of threads.
static int METHOD_SET_TO_NUMBER
          The variation method that indicates that the number of active threads should be set to a fixed number.
static int METHOD_SET_TO_PERCENT
          The variation method that indicates that the number of active threads should be set to a percentage of the total number of threads.
static double PI
          A predefined constant that can make some of the formulas a little shorter.
static int SHAPE_CONCAVE
          The shape value that indicates that the resulting curve should open downward.
static int SHAPE_CONVEX
          The shape value that indicates that the resulting curve should open upward.
 
Constructor Summary
SineLoadVarianceAlgorithm()
          This constructor is used to create a new instance of this load variation algorithm through reflection.
 
Method Summary
 int[][] calculateVariance(int duration, int totalThreads, int activeThreads)
          Retrieves a two-dimensional array that provides information about the increase or decrease in active job threads that should be applied over time.
 void initializeVariationAlgorithm(java.lang.String[] arguments)
          Initializes this load variation algorithm based on the provided list of arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PI

public static final double PI
A predefined constant that can make some of the formulas a little shorter.

See Also:
Constant Field Values

SHAPE_CONCAVE

public static final int SHAPE_CONCAVE
The shape value that indicates that the resulting curve should open downward.

See Also:
Constant Field Values

SHAPE_CONVEX

public static final int SHAPE_CONVEX
The shape value that indicates that the resulting curve should open upward.

See Also:
Constant Field Values

METHOD_INCREASE_BY_NUMBER

public static final int METHOD_INCREASE_BY_NUMBER
The variation method that indicates that the number of active threads should be increased by a fixed amount.

See Also:
Constant Field Values

METHOD_DECREASE_BY_NUMBER

public static final int METHOD_DECREASE_BY_NUMBER
The variation method that indicates that the number of active threads should be decreased by a fixed amount.

See Also:
Constant Field Values

METHOD_INCREASE_BY_PERCENT

public static final int METHOD_INCREASE_BY_PERCENT
The variation method that indicates that the number of active threads should be increased by a percentage of the total number of threads.

See Also:
Constant Field Values

METHOD_DECREASE_BY_PERCENT

public static final int METHOD_DECREASE_BY_PERCENT
The variation method that indicates that the number of active threads should be decreased by a percentage of the total number of threads.

See Also:
Constant Field Values

METHOD_SET_TO_NUMBER

public static final int METHOD_SET_TO_NUMBER
The variation method that indicates that the number of active threads should be set to a fixed number.

See Also:
Constant Field Values

METHOD_SET_TO_PERCENT

public static final int METHOD_SET_TO_PERCENT
The variation method that indicates that the number of active threads should be set to a percentage of the total number of threads.

See Also:
Constant Field Values
Constructor Detail

SineLoadVarianceAlgorithm

public SineLoadVarianceAlgorithm()
This constructor is used to create a new instance of this load variation algorithm through reflection. A default constructor must be provided in all subclasses, but the only thing that it needs to do is call super().

Method Detail

initializeVariationAlgorithm

public void initializeVariationAlgorithm(java.lang.String[] arguments)
                                  throws SLAMDException
Initializes this load variation algorithm based on the provided list of arguments.

Specified by:
initializeVariationAlgorithm in class LoadVarianceAlgorithm
Parameters:
arguments - The arguments that may be used to customize the behavior of this load variation algorithm.
Throws:
SLAMDException - If a problem occurs while trying to initialize this load variation algorithm.

calculateVariance

public int[][] calculateVariance(int duration,
                                 int totalThreads,
                                 int activeThreads)
                          throws SLAMDException
Retrieves a two-dimensional array that provides information about the increase or decrease in active job threads that should be applied over time. Each element of the array returned should itself be a two-element array with the first element being the number of milliseconds since the start of this load variance instruction that the increase or decrease should occur, and the second is an integer value that indicates the number of threads that should be added at that time (may be negative if threads are to be removed).

Specified by:
calculateVariance in class LoadVarianceAlgorithm
Parameters:
duration - The length of time in seconds over which this load variance algorithm should operate.
totalThreads - The total number of threads that have been scheduled for the job with which this algorithm is to be used.
activeThreads - The number of threads that are already active at the time that this method is called.
Returns:
A two-dimensional array that provides information about the increase or decrease in active job threads that should be applied over time.
Throws:
SLAMDException