SimGrid
3.18
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 & | getName () const |
Retrieves the name of that host as a C++ string. More... | |
const char * | getCname () const |
Retrieves the name of that host as a C string. More... | |
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 | getSpeed () |
Get the peak processor speed (in flops/s), at the current pstate. More... | |
int | getCoreCount () |
Returns the number of core of the processor. More... | |
std::map< std::string, std::string > * | getProperties () |
Get the properties assigned to a host. More... | |
const char * | getProperty (const char *key) |
Retrieve the property value (or nullptr if not set) More... | |
void | setProperty (std::string key, std::string value) |
void | getProcesses (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 | getPstatesCount () const |
void | setPstate (int pstate_index) |
Set the pstate at which the host should run. More... | |
int | getPstate () |
Retrieve the pstate at which the host is currently running. More... | |
void | getAttachedStorages (std::vector< const char *> *storages) |
Returns the list of storages attached to an host. More... | |
std::unordered_map< std::string, Storage * > const & | getMountedStorages () |
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... | |
void | execute (double flops) |
Block the calling actor on an execution located on the called host. More... | |
double | getLoad () |
Returns the current computation load (in flops per second) 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 (const char *name) |
Retrieves an host from its name, or die. 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... | |
|
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 an host from its name, or die.
|
static |
Retrieves the host on which the current actor is running.
|
inline |
Retrieves the name of that host as a C++ string.
|
inline |
Retrieves the name of that host as a C string.
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::getSpeed | ( | ) |
Get the peak processor speed (in flops/s), at the current pstate.
int simgrid::s4u::Host::getCoreCount | ( | ) |
Returns the number of core of the processor.
std::map< std::string, std::string > * simgrid::s4u::Host::getProperties | ( | ) |
Get the properties assigned to a host.
const char * simgrid::s4u::Host::getProperty | ( | const char * | key | ) |
Retrieve the property value (or nullptr if not set)
void simgrid::s4u::Host::setProperty | ( | std::string | key, |
std::string | 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::getPstatesCount | ( | ) | const |
void simgrid::s4u::Host::setPstate | ( | int | pstate_index | ) |
Set the pstate at which the host should run.
int simgrid::s4u::Host::getPstate | ( | ) |
Retrieve the pstate at which the host is currently running.
void simgrid::s4u::Host::getAttachedStorages | ( | std::vector< const char *> * | storages | ) |
Returns the list of storages attached to an host.
std::unordered_map< std::string, Storage * > const & simgrid::s4u::Host::getMountedStorages | ( | ) |
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.
void simgrid::s4u::Host::execute | ( | double | flops | ) |
Block the calling actor on an execution located on the called host.
It is not a problem if the actor is not located on the called host. The actor will not be migrated in this case. Such remote execution are easy in simulation.
double simgrid::s4u::Host::getLoad | ( | ) |
Returns the current computation load (in flops per second)
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 |