Package org.simgrid.msg
Class Host
- java.lang.Object
-
- org.simgrid.msg.Host
-
- Direct Known Subclasses:
VM
public class Host extends java.lang.ObjectA 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.Stringname
-
Constructor Summary
Constructors Modifier Constructor Description protectedHost()
-
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 HostcurrentHost()Returns the host of the current process.java.lang.String[]getAttachedStorage()This methods returns the list of storages (names) attached to an hoststatic HostgetByName(java.lang.String name)This static method gets an host instance associated with a native host of your platform.doublegetConsumedEnergy()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.doublegetCoreNumber()static intgetCount()Counts the installed hosts.doublegetCurrentPowerPeak()Returns the speed of the processor (in flop/s) at the current pstate.java.lang.ObjectgetData()Storage[]getMountedStorage()Returns the list of mount point names on an hostjava.lang.StringgetName()doublegetPowerPeakAt(int pstate)Returns the speed of the processor (in flop/s) at a given pstate.java.lang.StringgetProperty(java.lang.String name)intgetPstate()Returns the current pstateintgetPstatesCount()doublegetSpeed()This method returns the speed of the processor of a host (in flops), regardless of the current load of the machine.booleanhasData()Returns true if the host has an associated data object.booleanisOn()Tests if an host is up and running.voidoff()Stops the host if it is onvoidon()Starts the host if it is offstatic voidsetAsyncMailbox(java.lang.String mailboxName)This static method sets a mailbox to receive in asynchronous mode.voidsetData(java.lang.Object data)voidsetProperty(java.lang.String name, java.lang.String value)voidsetPstate(int pstate)Changes the current pstatejava.lang.StringtoString()static voidupdateAllEnergyConsumptions()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:
toStringin 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.
-
-