UtilizationModelPlanetLab

public class UtilizationModelPlanetLab extends UtilizationModelAbstract

Defines a resource utilization model based on a PlanetLab Datacenter workload (trace) file.

Each PlanetLab trace file available contains CPU utilization measured at every 5 minutes (300 seconds) inside PlanetLab VMs. This value in seconds is commonly used for the scheduling interval attribute when instantiating an object of this class.

Constructors

UtilizationModelPlanetLab

public UtilizationModelPlanetLab(String workloadFilePath, double schedulingInterval)

Instantiates a new PlanetLab resource utilization model from a trace file.

Parameters:
  • workloadFilePath – the path of a PlanetLab Datacenter workload file.
  • schedulingInterval – the time interval in which precise utilization can be got from the file
Throws:
  • NumberFormatException – the number format exception

See also: .getSchedulingInterval()

UtilizationModelPlanetLab

public UtilizationModelPlanetLab(String workloadFilePath, double schedulingInterval, int dataSamples)

Instantiates a new PlanetLab resource utilization model with variable utilization samples from a workload file.

Parameters:
  • workloadFilePath – the path of a PlanetLab Datacenter workload file.
  • schedulingInterval – the time interval in which precise utilization can be got from the file
  • dataSamples – number of samples to read from the workload file
Throws:
  • NumberFormatException – the number format exception

See also: .getSchedulingInterval()

Methods

getInstance

public static UtilizationModelPlanetLab getInstance(String traceFilePath, double schedulingInterval)

Instantiates a new PlanetLab resource utilization model from a trace file inside the application’s resource directory.

Parameters:
  • traceFilePath – the relative path of a PlanetLab Datacenter trace file.
  • schedulingInterval – the time interval in which precise utilization can be got from the file
Throws:

See also: .getSchedulingInterval()

getIntervalSize

protected final int getIntervalSize(int startIndex, int endIndex)

Gets the number of utilization samples between two indexes.

Since the utilization array is implemented as a circular list, when the last index is read, it restarts from the first index again. Accordingly, we can have situations where the end index is the last array element and the start index is the first or some subsequent index. This way, computing the difference between the two indexes would return a negative value. The method ensures that a positive value is returned, correctly computing the size of the interval between the two indexes.

Consider that the trace file has 288 lines, indexed from line 0 to 287. Think of the trace as a circular list with indexes 0, 1, 2, 3 …… 286, 287, 0, 1, 2, 3 … If the start index is 286 and the end index 2, then the interval size is 4 (the number of indexes between 286 and 2).

Parameters:
  • startIndex – the start index in the interval
  • endIndex – the end index in the interval
Returns:

the number of samples inside such indexes interval

getSchedulingInterval

public double getSchedulingInterval()

Gets the time interval (in seconds) in which precise utilization can be got from the workload file.

That means if the getUtilization(double) is called passing any time that is multiple of this scheduling interval, the utilization returned will be the value stored for that specific time. Otherwise, the value will be an arithmetic mean of the beginning and the ending of the interval in which the given time is.

Returns:the scheduling interval in seconds

getSecondsInsideInterval

protected final double getSecondsInsideInterval(int prevIndex, int nextIndex)

getUtilization

public double getUtilization(double time)

setSchedulingInterval

public final void setSchedulingInterval(double schedulingInterval)

Sets the scheduling interval.

Parameters:
  • schedulingInterval – the scheduling interval to set

See also: .getSchedulingInterval()