SimGrid
3.16
Versatile Simulation of Distributed Systems
|
An host represents some physical resource with computing and networking capabilities.
All hosts are automatically created during the call of the method simgrid::s4u::Engine::loadPlatform(). You cannot create a host yourself.
You can retrieve a particular host using simgrid::s4u::Host::byName() and actors can retrieve the host on which they run using simgrid::s4u::Host::current().
#include <Host.hpp>
Public Member Functions | |
Host (const char *name) | |
void | destroy () |
Fire the required callbacks and destroy the object. More... | |
Host (Host const &)=delete | |
Host & | operator= (Host const &)=delete |
simgrid::xbt::string const & | name () const |
const char * | cname () |
void | actorList (std::vector< ActorPtr > *whereto) |
Return the list of actors attached to an host. More... | |
void | turnOn () |
Turns that host on if it was previously off. More... | |
void | turnOff () |
Turns that host off. More... | |
bool | isOn () |
Returns if that host is currently up and running. More... | |
bool | isOff () |
Returns if that host is currently down and offline. More... | |
double | speed () |
Get the peak processor speed (in flops/s), at the current pstate. More... | |
int | coreCount () |
Returns the number of core of the processor. More... | |
xbt_dict_t | properties () |
Get the properties assigned to a host. More... | |
const char * | property (const char *key) |
Retrieve the property value (or nullptr if not set) More... | |
void | setProperty (const char *key, const char *value) |
void | processes (std::vector< ActorPtr > *list) |
Get the processes attached to the host. More... | |
double | getPstateSpeed (int pstate_index) |
Get the peak processor speed (in flops/s), at the specified pstate. More... | |
int | pstatesCount () const |
void | setPstate (int pstate_index) |
Set the pstate at which the host should run. More... | |
int | pstate () |
Retrieve the pstate at which the host is currently running. More... | |
void | attachedStorages (std::vector< const char *> *storages) |
Returns the list of storages attached to an host. More... | |
std::unordered_map< std::string, Storage * > const & | mountedStorages () |
Get an associative list [mount point]->[Storage] of all local mount points. More... | |
void | routeTo (Host *dest, std::vector< Link *> *links, double *latency) |
Find a route toward another host. More... | |
void | routeTo (Host *dest, std::vector< surf::LinkImpl *> *links, double *latency) |
Just like Host::routeTo, but filling an array of link implementations. More... | |
![]() | |
Extendable () | |
~Extendable () | |
void * | extension (std::size_t rank) |
U * | extension (Extension< Host, U > rank) |
U * | extension () |
void | extension_set (std::size_t rank, void *value, bool use_dtor=true) |
void | extension_set (Extension< Host, U > rank, U *value, bool use_dtor=true) |
void | extension_set (U *p) |
Static Public Member Functions | |
static Host * | by_name_or_null (const char *name) |
Retrieves an host from its name, or return nullptr. More... | |
static Host * | by_name_or_null (std::string name) |
Retrieves an host from its name, or return nullptr. More... | |
static s4u::Host * | by_name (std::string name) |
Retrieves an host from its name, or die. More... | |
static s4u::Host * | current () |
Retrieves the host on which the current actor is running. More... | |
![]() | |
static size_t | extension_create (void(*deleter)(void *)) |
static Extension< Host, U > | extension_create (void(*deleter)(void *)) |
static Extension< Host, U > | extension_create () |
Public Attributes | |
surf::HostImpl * | pimpl_ = nullptr |
surf::Cpu * | pimpl_cpu = nullptr |
DO NOT USE DIRECTLY (. More... | |
kernel::routing::NetPoint * | pimpl_netpoint = nullptr |
DO NOT USE DIRECTLY (. More... | |
Static Public Attributes | |
static simgrid::xbt::signal< void(Host &)> | onCreation |
static simgrid::xbt::signal< void(Host &)> | onDestruction |
static simgrid::xbt::signal< void(Host &)> | onStateChange |
static simgrid::xbt::signal< void(Host &)> | onSpeedChange |
Protected Member Functions | |
virtual | ~Host () |
Host destruction logic. More... | |
Additional Inherited Members | |
![]() | |
std::vector< void *> | extensions_ |
|
explicit |
|
protectedvirtual |
Host destruction logic.
|
delete |
void simgrid::s4u::Host::destroy | ( | ) |
Fire the required callbacks and destroy the object.
Don't delete directly an Host, call h->destroy() instead.
This is cumbersome but this is the simplest solution to ensure that the onDestruction() callback receives a valid object (because of the destructor order in a class hierarchy).
|
static |
Retrieves an host from its name, or return nullptr.
|
static |
Retrieves an host from its name, or return nullptr.
|
static |
Retrieves an host from its name, or die.
|
static |
Retrieves the host on which the current actor is running.
|
inline |
|
inline |
Return the list of actors attached to an host.
whereto | a vector in which we should push actors living on that host |
void simgrid::s4u::Host::turnOn | ( | ) |
Turns that host on if it was previously off.
All actors on that host which were marked autorestart will be restarted automatically. This call does nothing if the host is already on.
void simgrid::s4u::Host::turnOff | ( | ) |
Turns that host off.
All actors are forcefully stopped.
bool simgrid::s4u::Host::isOn | ( | ) |
Returns if that host is currently up and running.
|
inline |
Returns if that host is currently down and offline.
double simgrid::s4u::Host::speed | ( | ) |
Get the peak processor speed (in flops/s), at the current pstate.
int simgrid::s4u::Host::coreCount | ( | ) |
Returns the number of core of the processor.
xbt_dict_t simgrid::s4u::Host::properties | ( | ) |
Get the properties assigned to a host.
const char * simgrid::s4u::Host::property | ( | const char * | key | ) |
Retrieve the property value (or nullptr if not set)
void simgrid::s4u::Host::setProperty | ( | const char * | key, |
const char * | value | ||
) |
Get the processes attached to the host.
double simgrid::s4u::Host::getPstateSpeed | ( | int | pstate_index | ) |
Get the peak processor speed (in flops/s), at the specified pstate.
int simgrid::s4u::Host::pstatesCount | ( | ) | const |
void simgrid::s4u::Host::setPstate | ( | int | pstate_index | ) |
Set the pstate at which the host should run.
int simgrid::s4u::Host::pstate | ( | ) |
Retrieve the pstate at which the host is currently running.
void simgrid::s4u::Host::attachedStorages | ( | std::vector< const char *> * | storages | ) |
Returns the list of storages attached to an host.
std::unordered_map< std::string, Storage * > const & simgrid::s4u::Host::mountedStorages | ( | ) |
Get an associative list [mount point]->[Storage] of all local mount points.
This is defined in the platform file, and cannot be modified programatically (yet).
Find a route toward another host.
dest | [IN] where to |
links | [OUT] where to store the list of links (must exist, cannot be nullptr). |
latency | [OUT] where to store the latency experienced on the path (or nullptr if not interested) It is the caller responsibility to initialize latency to 0 (we add to provided route) |
walk through the routing components tree and find a route between hosts by calling each "get_route" function in each routing component.
void simgrid::s4u::Host::routeTo | ( | Host * | dest, |
std::vector< surf::LinkImpl *> * | links, | ||
double * | latency | ||
) |
Just like Host::routeTo, but filling an array of link implementations.
surf::HostImpl* simgrid::s4u::Host::pimpl_ = nullptr |
surf::Cpu* simgrid::s4u::Host::pimpl_cpu = nullptr |
DO NOT USE DIRECTLY (.
kernel::routing::NetPoint* simgrid::s4u::Host::pimpl_netpoint = nullptr |
DO NOT USE DIRECTLY (.
|
static |
|
static |
|
static |
|
static |