Package org.simgrid.msg
Class Host
- java.lang.Object
-
- org.simgrid.msg.Host
-
- Direct Known Subclasses:
VM
public class Host extends java.lang.Object
A host object represents a location (any possible place) where a process may run. Thus it is represented as a physical resource with computing capabilities, some mailboxes to enable running process to communicate with remote ones, and some private data that can be only accessed by local process. An instance of this class is always bound with the corresponding native host. All the native hosts are automatically created during the call of the method Msg.createEnvironment(). This method take as parameter a platform file which describes all elements of the platform (host, link, root..). You cannot create a host yourself. The best way to get an host instance is to call the static method Host.getByName(). For example to get the instance of the host. If your platform file description contains an host named "Jacquelin" : \verbatim Host jacquelin; try { jacquelin = Host.getByName("Jacquelin"); } catch(HostNotFoundException e) { System.err.println(e.toString()); } ... \endverbatim
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
name
-
Constructor Summary
Constructors Modifier Constructor Description protected
Host()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Host[]
all()
Returns all hosts of the installed platform.static Host
currentHost()
Returns the host of the current process.java.lang.String[]
getAttachedStorage()
This methods returns the list of storages (names) attached to an hoststatic Host
getByName(java.lang.String name)
This static method gets an host instance associated with a native host of your platform.double
getConsumedEnergy()
Returns the amount of Joules consumed by that host so far Please note that since the consumption is lazily updated, it may require a simcall to update it.double
getCoreNumber()
static int
getCount()
Counts the installed hosts.double
getCurrentPowerPeak()
Returns the speed of the processor (in flop/s) at the current pstate.java.lang.Object
getData()
Storage[]
getMountedStorage()
Returns the list of mount point names on an hostjava.lang.String
getName()
double
getPowerPeakAt(int pstate)
Returns the speed of the processor (in flop/s) at a given pstate.java.lang.String
getProperty(java.lang.String name)
int
getPstate()
Returns the current pstateint
getPstatesCount()
double
getSpeed()
This method returns the speed of the processor of a host (in flops), regardless of the current load of the machine.boolean
hasData()
Returns true if the host has an associated data object.boolean
isOn()
Tests if an host is up and running.void
off()
Stops the host if it is onvoid
on()
Starts the host if it is offstatic void
setAsyncMailbox(java.lang.String mailboxName)
This static method sets a mailbox to receive in asynchronous mode.void
setData(java.lang.Object data)
void
setProperty(java.lang.String name, java.lang.String value)
void
setPstate(int pstate)
Changes the current pstatejava.lang.String
toString()
static void
updateAllEnergyConsumptions()
After this call, sg_host_get_consumed_energy() will not interrupt your process (until after the next clock update).
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getByName
public static Host getByName(java.lang.String name) throws HostNotFoundException
This static method gets an host instance associated with a native host of your platform. This is the best way to get a java host object.- Parameters:
name
- The name of the host to get.- Returns:
- The host object with the given name.
- Throws:
HostNotFoundException
- if the name of the host is not valid.
-
getCount
public static int getCount()
Counts the installed hosts.
-
currentHost
public static Host currentHost()
Returns the host of the current process.
-
all
public static Host[] all()
Returns all hosts of the installed platform.
-
setAsyncMailbox
public static void setAsyncMailbox(java.lang.String mailboxName)
This static method sets a mailbox to receive in asynchronous mode. All messages sent to this mailbox will be transferred to the receiver without waiting for the receive call. The receive call will still be necessary to use the received data. If there is a need to receive some messages asynchronously, and some not, two different mailboxes should be used.- Parameters:
mailboxName
- The name of the mailbox
-
getName
public java.lang.String getName()
-
setData
public void setData(java.lang.Object data)
-
getData
public java.lang.Object getData()
-
hasData
public boolean hasData()
Returns true if the host has an associated data object.
-
on
public void on()
Starts the host if it is off
-
off
public void off()
Stops the host if it is on
-
getSpeed
public double getSpeed()
This method returns the speed of the processor of a host (in flops), regardless of the current load of the machine.
-
getCoreNumber
public double getCoreNumber()
-
getProperty
public java.lang.String getProperty(java.lang.String name)
-
setProperty
public void setProperty(java.lang.String name, java.lang.String value)
-
isOn
public boolean isOn()
Tests if an host is up and running.
-
getMountedStorage
public Storage[] getMountedStorage()
Returns the list of mount point names on an host
-
getAttachedStorage
public java.lang.String[] getAttachedStorage()
This methods returns the list of storages (names) attached to an host
-
updateAllEnergyConsumptions
public static void updateAllEnergyConsumptions()
After this call, sg_host_get_consumed_energy() will not interrupt your process (until after the next clock update).
-
getConsumedEnergy
public double getConsumedEnergy()
Returns the amount of Joules consumed by that host so far Please note that since the consumption is lazily updated, it may require a simcall to update it. The result is that the actor requesting this value will be interrupted, the value will be updated in kernel mode before returning the control to the requesting actor.
-
getPstate
public int getPstate()
Returns the current pstate
-
setPstate
public void setPstate(int pstate)
Changes the current pstate
-
getPstatesCount
public int getPstatesCount()
-
getCurrentPowerPeak
public double getCurrentPowerPeak()
Returns the speed of the processor (in flop/s) at the current pstate. See also @ref plugin_energy.
-
getPowerPeakAt
public double getPowerPeakAt(int pstate)
Returns the speed of the processor (in flop/s) at a given pstate. See also @ref plugin_energy.
-
-