Class TaskEvent
public final class TaskEvent extends Object
Cloudlet
,
according to the data read from a line inside a "task events" trace file.
Instance of this class are created by the GoogleTaskEventsTraceReader
and provided to the user's simulation.
In order to create such Cloudlets, the GoogleTaskEventsTraceReader
requires
the developer to provide a Function
that creates Cloudlets according to the developer needs.
The GoogleTaskEventsTraceReader
cannot create the Cloudlets itself
by hardcoding some simulation specific parameters such as the UtilizationModel
or cloudlet length. This way, it request a Function
implemented
by the developer using the GoogleTaskEventsTraceReader
class
that has the custom logic to create Cloudlets.
However, this developer's Function
needs to receive
the task parameters read from the trace file such as
CPU, RAM and disk requirements and priority.
To avoid passing so many parameters to the developer's
Function, an instance of this class that wraps all these
parameters is used instead.
- Since:
- CloudSim Plus 4.0.0
- Author:
- Manoel Campos da Silva Filho
-
Constructor Summary
Constructors Constructor Description TaskEvent()
-
Method Summary
Modifier and Type Method Description long
actualCpuCores(long maxCpuCores)
Computes the actual number of CPU cores (PEs) to be assigned to a Cloudlet, according to thepercentage of CPUs to be used
and a given maximum number of existing CPUs.long
getJobId()
Gets the id of the job this task belongs to.long
getMachineId()
Gets the machineID that indicates the machine onto which the task was scheduled.int
getPriority()
double
getResourceRequestForCpuCores()
Gets the maximum number of CPU cores the task is permitted to use (in percentage from 0 to 1).double
getResourceRequestForLocalDiskSpace()
Gets the maximum amount of local disk space the task is permitted to use (in percentage from 0 to 1).double
getResourceRequestForRam()
Gets the maximum amount of RAM the task is permitted to use (in percentage from 0 to 1).int
getSchedulingClass()
Gets the scheduling class that roughly represents how latency-sensitive the task is.long
getTaskIndex()
Gets the task index within the job.double
getTimestamp()
Gets the time the event happened (converted to seconds).TaskEventType
getType()
Gets the event type.long
getUniqueTaskId()
An unique ID to be used to identify Cloudlets.String
getUserName()
Gets the hashed username provided as an opaque base64-encoded string that can be tested for equality.protected TaskEvent
setPriority(int priority)
protected TaskEvent
setTimestamp(double timestamp)
TaskEvent
setType(int type)
Sets theTaskEventType
according to the enum ordinal.
-
Constructor Details
-
TaskEvent
public TaskEvent()
-
-
Method Details
-
getPriority
public int getPriority() -
setPriority
-
getResourceRequestForCpuCores
public double getResourceRequestForCpuCores()Gets the maximum number of CPU cores the task is permitted to use (in percentage from 0 to 1). This percentage value can be used to compute the number ofPe
s the Cloudlet will require, based on the number of PEs of the Vm where the Cloudlet will be executed.The actual value to be assigned to a Cloudlet created from this trace field must be defined by the researcher, inside the
cloudlet creation function
given to the trace reader.Since there are "task usage" trace files, they can used used to define the CPU utilization along the time. The value of this attribute is not the same as the max resource usage of the CPU
UtilizationModel
. It just represents the maximum number of CPUs the Cloudlet will use. The percentage that such CPUs will be used for a given time is defined by the CPUUtilizationModel.getUtilization()
. Such a value is defined by a "task usage" trace. -
actualCpuCores
public long actualCpuCores(long maxCpuCores)Computes the actual number of CPU cores (PEs) to be assigned to a Cloudlet, according to thepercentage of CPUs to be used
and a given maximum number of existing CPUs.- Parameters:
maxCpuCores
- the maximum number of existing CPUs the Cloudlet can use (that can be defined as the number of VM's CPUs)- Returns:
- the actual number of CPU cores the Cloudlet will require
-
getResourceRequestForRam
public double getResourceRequestForRam()Gets the maximum amount of RAM the task is permitted to use (in percentage from 0 to 1).The actual value to be assigned to a Cloudlet created from this trace field must be defined by the researcher, inside the
cloudlet creation function
given to the trace reader.This field can be used to define the max resource utilization percentage for a UtilizationModel when creating the Cloudlet. Since there are "task usage" trace files, they can be used to define the RAM utilization along the time. In this case, a
UtilizationModelDynamic
is required for the Cloudlet's RAM UtilizationModel. Using a different class will raise a runtime exception when trying to create the Cloudlets. -
getResourceRequestForLocalDiskSpace
public double getResourceRequestForLocalDiskSpace()Gets the maximum amount of local disk space the task is permitted to use (in percentage from 0 to 1).The actual value to be assigned to a Cloudlet created from this trace field must be defined by the researcher, inside the
cloudlet creation function
given to the trace reader.This field can be used to define the initial Cloudlet file size and/or output size when creating the Cloudlet, according to the researcher needs.
- Returns:
- See Also:
GoogleTaskEventsTraceReader.FieldIndex.RESOURCE_REQUEST_FOR_LOCAL_DISK_SPACE
-
getUserName
Gets the hashed username provided as an opaque base64-encoded string that can be tested for equality.- Returns:
- See Also:
GoogleTaskEventsTraceReader.FieldIndex.USERNAME
-
getTimestamp
public double getTimestamp()Gets the time the event happened (converted to seconds).- Returns:
- See Also:
GoogleTaskEventsTraceReader.FieldIndex.TIMESTAMP
-
setTimestamp
-
getSchedulingClass
public int getSchedulingClass()Gets the scheduling class that roughly represents how latency-sensitive the task is. The scheduling class is represented by a single number, with 3 representing a more latency-sensitive task (e.g., serving revenue-generating user requests) and 0 representing a non-production task (e.g., development, non-business-critical analyses, etc.).- Returns:
- See Also:
GoogleTaskEventsTraceReader.FieldIndex.SCHEDULING_CLASS
-
getType
Gets the event type.- Returns:
-
setType
Sets theTaskEventType
according to the enum ordinal.- Parameters:
type
- the int value of the task event type- Returns:
-
getJobId
public long getJobId()Gets the id of the job this task belongs to.- Returns:
-
getTaskIndex
public long getTaskIndex()Gets the task index within the job.- Returns:
-
getUniqueTaskId
public long getUniqueTaskId()An unique ID to be used to identify Cloudlets. The ID is composed of theJob ID
, concatenated with theTask Index
.- Returns:
-
getMachineId
public long getMachineId()Gets the machineID that indicates the machine onto which the task was scheduled. If the field is empty, -1 is returned instead.- Returns:
-