Package org.cloudbus.cloudsim.resources
Class PeSimple
java.lang.Object
org.cloudbus.cloudsim.resources.ResourceAbstract
org.cloudbus.cloudsim.resources.ResourceManageableAbstract
org.cloudbus.cloudsim.resources.PeSimple
- All Implemented Interfaces:
ChangeableId
,Identifiable
,Pe
,Resource
,ResourceCapacity
,ResourceManageable
Pe (Processing Element) class represents a CPU core of a physical machine (PM),
defined in terms of Millions Instructions Per Second (MIPS) rating.
Such a class allows managing the Pe capacity and allocation.
ASSUMPTION: All PEs under the same Machine have the same MIPS rating.
- Since:
- CloudSim Toolkit 1.0
- Author:
- Manzur Murshed, Rajkumar Buyya
- To do something:
- This assumption is not being assured on different classes (where other TODOs were included)
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.cloudbus.cloudsim.resources.ResourceAbstract
capacity
Fields inherited from interface org.cloudbus.cloudsim.resources.ResourceManageable
NULL
-
Constructor Summary
ConstructorDescriptionPeSimple()
Instantiates a PE object with thedefault MIPS capacity
and using aPeProvisionerSimple
.PeSimple
(double mipsCapacity) Instantiates a PE object using aPeProvisionerSimple
.PeSimple
(double mipsCapacity, PeProvisioner peProvisioner) Instantiates a PE object.PeSimple
(int id, double mipsCapacity, PeProvisioner peProvisioner) Instantiates a PE object defining a given id. -
Method Summary
Modifier and TypeMethodDescriptionstatic double
Gets the default MIPS capacity to be used to create PEs when the no-args constructor is used.long
getId()
Gets the PE provisioner that manages the allocation of this physical PE to virtual machines.Gets the status of the PE.boolean
isBusy()
Checks if the PE is busy to be used (it's being used).boolean
isFailed()
Checks if the PE is failed.boolean
isFree()
Checks if the PE is free to be used (it's idle).boolean
Checks if the PE is working (not failed).boolean
setCapacity
(double mipsCapacity) Sets the capacity of this Pe in MIPS (Million Instructions Per Second).static void
setDefaultMips
(double defaultMips) Sets the default MIPS capacity to be used to create PEs when the no-args constructor is used.final void
setId
(long id) Sets the id of the object.final Pe
setPeProvisioner
(PeProvisioner peProvisioner) Sets thePe.getPeProvisioner()
that manages the allocation of this physical PE to virtual machines.final boolean
Sets thestatus
of the PE.toString()
Methods inherited from class org.cloudbus.cloudsim.resources.ResourceManageableAbstract
addCapacity, allocateResource, deallocateAllResources, deallocateAndRemoveResource, deallocateResource, getAvailableResource, removeCapacity, setAllocatedResource, setAvailableResource, setCapacity, sumAvailableResource, sumCapacity
Methods inherited from class org.cloudbus.cloudsim.resources.ResourceAbstract
getAllocatedResource, getCapacity, getUnit, isAmountAvailable, isAmountAvailable, isResourceAmountBeingUsed, isSuitable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.cloudbus.cloudsim.resources.Pe
getCapacity, setCapacity
Methods inherited from interface org.cloudbus.cloudsim.resources.Resource
getAllocatedResource, getAvailableResource, getPercentUtilization, getUnit, isAmountAvailable, isAmountAvailable, isAmountAvailable, isFull, isSubClassOf
Methods inherited from interface org.cloudbus.cloudsim.resources.ResourceManageable
addCapacity, allocateResource, allocateResource, deallocateAllResources, deallocateAndRemoveResource, deallocateResource, deallocateResource, isResourceAmountBeingUsed, isSuitable, removeCapacity, setAllocatedResource, setAllocatedResource, sumCapacity
-
Constructor Details
-
PeSimple
public PeSimple()Instantiates a PE object with thedefault MIPS capacity
and using aPeProvisionerSimple
. The id of the PE is just set when a List of PEs is assigned to a Host. -
PeSimple
public PeSimple(double mipsCapacity) Instantiates a PE object using aPeProvisionerSimple
. The id of the PE is just set when a List of PEs is assigned to a Host.- Parameters:
mipsCapacity
- the capacity of the PE in MIPS (Million Instructions per Second)- See Also:
-
PeSimple
Instantiates a PE object. The id of the PE is just set when a List of PEs is assigned to a Host.- Parameters:
mipsCapacity
- the capacity of the PE in MIPS (Million Instructions per Second)peProvisioner
- the provisioner that will manage the allocation of this physical Pe for VMs- See Also:
-
PeSimple
Instantiates a PE object defining a given id. The id of the PE is just set when a List of PEs is assigned to a Host.- Parameters:
id
- the PE idmipsCapacity
- the capacity of the PE in MIPS (Million Instructions per Second)peProvisioner
- the provisioner that will manage the allocation of this physical Pe for VMs- See Also:
-
-
Method Details
-
getDefaultMips
public static double getDefaultMips()Gets the default MIPS capacity to be used to create PEs when the no-args constructor is used.- Returns:
-
setDefaultMips
public static void setDefaultMips(double defaultMips) Sets the default MIPS capacity to be used to create PEs when the no-args constructor is used.- Parameters:
defaultMips
- the new default MIPS capacity to set
-
setId
public final void setId(long id) Description copied from interface:ChangeableId
Sets the id of the object. -1 indicates the object has no id.- Specified by:
setId
in interfaceChangeableId
- Parameters:
id
- the id to set
-
getId
public long getId()- Specified by:
getId
in interfaceIdentifiable
-
getStatus
Description copied from interface:Pe
Gets the status of the PE. -
setStatus
Description copied from interface:Pe
Sets thestatus
of the PE. -
setCapacity
public boolean setCapacity(double mipsCapacity) Description copied from interface:Pe
Sets the capacity of this Pe in MIPS (Million Instructions Per Second).It receives the amount of MIPS as a double value but converts it internally to a long. The method is just provided as a handy-way to define the PE capacity using a double value that usually is generated from some computations.
If you want to have an idea of the MIPS capacity for different processors, check the link above.- Specified by:
setCapacity
in interfacePe
- Parameters:
mipsCapacity
- the MIPS capacity to set- Returns:
- true if mipsCapacity is greater than 0, false otherwise
-
setPeProvisioner
Description copied from interface:Pe
Sets thePe.getPeProvisioner()
that manages the allocation of this physical PE to virtual machines. This method is automatically called when aPeProvisioner
is created passing a Pe instance. Thus, the PeProvisioner for a Pe doesn't have to be set manually.- Specified by:
setPeProvisioner
in interfacePe
- Parameters:
peProvisioner
- the new PE provisioner- Returns:
-
getPeProvisioner
Gets the PE provisioner that manages the allocation of this physical PE to virtual machines.- Specified by:
getPeProvisioner
in interfacePe
- Returns:
- the PE provisioner
-
toString
- Overrides:
toString
in classResourceManageableAbstract
-
isWorking
public boolean isWorking()Description copied from interface:Pe
Checks if the PE is working (not failed). -
isFailed
public boolean isFailed()Description copied from interface:Pe
Checks if the PE is failed. -
isFree
public boolean isFree()Description copied from interface:Pe
Checks if the PE is free to be used (it's idle). -
isBusy
public boolean isBusy()Description copied from interface:Pe
Checks if the PE is busy to be used (it's being used).
-