SimGrid  3.16
Versatile Simulation of Distributed Systems
simgrid::s4u::Host Class Reference

Detailed Description

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>

Inheritance diagram for simgrid::s4u::Host:
simgrid::xbt::Extendable< Host > simgrid::xbt::Extendable< Host > simgrid::s4u::VirtualMachine simgrid::s4u::VirtualMachine

Public Member Functions

 Host (const char *name)
 
void destroy ()
 Fire the required callbacks and destroy the object. More...
 
 Host (Host const &)=delete
 
Hostoperator= (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...
 
 Host (const char *name)
 
void destroy ()
 
 Host (Host const &)=delete
 
Hostoperator= (Host const &)=delete
 
simgrid::xbt::string const & name () const
 
const char * cname ()
 
void actorList (std::vector< ActorPtr > *whereto)
 
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 ()
 
int coreCount ()
 
xbt_dict_t properties ()
 
const char * property (const char *key)
 
void setProperty (const char *key, const char *value)
 
void processes (std::vector< ActorPtr > *list)
 
double getPstateSpeed (int pstate_index)
 
int pstatesCount () const
 
void setPstate (int pstate_index)
 
int pstate ()
 
void attachedStorages (std::vector< const char *> *storages)
 
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)
 
void routeTo (Host *dest, std::vector< surf::LinkImpl *> *links, double *latency)
 
- Public Member Functions inherited from simgrid::xbt::Extendable< Host >
 Extendable ()
 
 Extendable ()
 
 ~Extendable ()
 
 ~Extendable ()
 
voidextension (std::size_t rank)
 
U * extension (Extension< Host, U > rank)
 
U * extension ()
 
voidextension (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)
 
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 Hostby_name_or_null (const char *name)
 Retrieves an host from its name, or return nullptr. More...
 
static Hostby_name_or_null (std::string name)
 Retrieves an host from its name, or return nullptr. More...
 
static s4u::Hostby_name (std::string name)
 Retrieves an host from its name, or die. More...
 
static s4u::Hostcurrent ()
 Retrieves the host on which the current actor is running. More...
 
static Hostby_name_or_null (const char *name)
 Retrieves an host from its name, or return nullptr. More...
 
static Hostby_name_or_null (std::string name)
 Retrieves an host from its name, or return nullptr. More...
 
static s4u::Hostby_name (std::string name)
 Retrieves an host from its name, or die. More...
 
static s4u::Hostcurrent ()
 Retrieves the host on which the current actor is running. More...
 
- Static Public Member Functions inherited from simgrid::xbt::Extendable< Host >
static size_t extension_create (void(*deleter)(void *))
 
static Extension< Host, U > extension_create (void(*deleter)(void *))
 
static Extension< Host, U > extension_create ()
 
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::HostImplpimpl_ = nullptr
 
surf::Cpupimpl_cpu = nullptr
 DO NOT USE DIRECTLY (. More...
 
kernel::routing::NetPointpimpl_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...
 
virtual ~Host ()
 Host destruction logic. More...
 

Additional Inherited Members

- Protected Attributes inherited from simgrid::xbt::Extendable< Host >
std::vector< void *> extensions_
 

Constructor & Destructor Documentation

◆ Host() [1/4]

simgrid::s4u::Host::Host ( const char *  name)
explicit

◆ ~Host() [1/2]

simgrid::s4u::Host::~Host ( )
protectedvirtual

Host destruction logic.

◆ Host() [2/4]

simgrid::s4u::Host::Host ( Host const &  )
delete

◆ Host() [3/4]

simgrid::s4u::Host::Host ( const char *  name)
explicit

◆ ~Host() [2/2]

virtual simgrid::s4u::Host::~Host ( )
protectedvirtual

Host destruction logic.

◆ Host() [4/4]

simgrid::s4u::Host::Host ( Host const &  )
delete

Member Function Documentation

◆ destroy() [1/2]

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).

◆ operator=() [1/2]

Host& simgrid::s4u::Host::operator= ( Host const &  )
delete

◆ by_name_or_null() [1/4]

Host * simgrid::s4u::Host::by_name_or_null ( const char *  name)
static

Retrieves an host from its name, or return nullptr.

◆ by_name_or_null() [2/4]

Host * simgrid::s4u::Host::by_name_or_null ( std::string  name)
static

Retrieves an host from its name, or return nullptr.

◆ by_name() [1/2]

◆ current() [1/2]

Host * simgrid::s4u::Host::current ( )
static

Retrieves the host on which the current actor is running.

◆ name() [1/2]

simgrid::xbt::string const& simgrid::s4u::Host::name ( ) const
inline

◆ cname() [1/2]

const char* simgrid::s4u::Host::cname ( )
inline

◆ actorList() [1/2]

void simgrid::s4u::Host::actorList ( std::vector< ActorPtr > *  whereto)

Return the list of actors attached to an host.

Parameters
wheretoa vector in which we should push actors living on that host

◆ turnOn() [1/2]

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.

◆ turnOff() [1/2]

void simgrid::s4u::Host::turnOff ( )

Turns that host off.

All actors are forcefully stopped.

◆ isOn() [1/2]

bool simgrid::s4u::Host::isOn ( )

Returns if that host is currently up and running.

◆ isOff() [1/2]

bool simgrid::s4u::Host::isOff ( )
inline

Returns if that host is currently down and offline.

◆ speed() [1/2]

double simgrid::s4u::Host::speed ( )

Get the peak processor speed (in flops/s), at the current pstate.

◆ coreCount() [1/2]

int simgrid::s4u::Host::coreCount ( )

Returns the number of core of the processor.

◆ properties() [1/2]

xbt_dict_t simgrid::s4u::Host::properties ( )

Get the properties assigned to a host.

◆ property() [1/2]

const char * simgrid::s4u::Host::property ( const char *  key)

Retrieve the property value (or nullptr if not set)

◆ setProperty() [1/2]

void simgrid::s4u::Host::setProperty ( const char *  key,
const char *  value 
)

◆ processes() [1/2]

void simgrid::s4u::Host::processes ( std::vector< ActorPtr > *  list)

Get the processes attached to the host.

◆ getPstateSpeed() [1/2]

double simgrid::s4u::Host::getPstateSpeed ( int  pstate_index)

Get the peak processor speed (in flops/s), at the specified pstate.

◆ pstatesCount() [1/2]

int simgrid::s4u::Host::pstatesCount ( ) const

◆ setPstate() [1/2]

void simgrid::s4u::Host::setPstate ( int  pstate_index)

Set the pstate at which the host should run.

◆ pstate() [1/2]

int simgrid::s4u::Host::pstate ( )

Retrieve the pstate at which the host is currently running.

◆ attachedStorages() [1/2]

void simgrid::s4u::Host::attachedStorages ( std::vector< const char *> *  storages)

Returns the list of storages attached to an host.

Returns
a vector containing all storages attached to the host

◆ mountedStorages() [1/2]

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).

◆ routeTo() [1/4]

void simgrid::s4u::Host::routeTo ( Host dest,
std::vector< Link *> *  links,
double *  latency 
)

Find a route toward another host.

Parameters
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)
Precondition
links!=nullptr

walk through the routing components tree and find a route between hosts by calling each "get_route" function in each routing component.

◆ routeTo() [2/4]

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.

◆ destroy() [2/2]

void simgrid::s4u::Host::destroy ( )

◆ operator=() [2/2]

Host& simgrid::s4u::Host::operator= ( Host const &  )
delete

◆ by_name_or_null() [3/4]

static Host* simgrid::s4u::Host::by_name_or_null ( const char *  name)
static

Retrieves an host from its name, or return nullptr.

◆ by_name_or_null() [4/4]

static Host* simgrid::s4u::Host::by_name_or_null ( std::string  name)
static

Retrieves an host from its name, or return nullptr.

◆ by_name() [2/2]

static s4u::Host* simgrid::s4u::Host::by_name ( std::string  name)
static

Retrieves an host from its name, or die.

◆ current() [2/2]

static s4u::Host* simgrid::s4u::Host::current ( )
static

Retrieves the host on which the current actor is running.

◆ name() [2/2]

simgrid::xbt::string const& simgrid::s4u::Host::name ( ) const
inline

◆ cname() [2/2]

const char* simgrid::s4u::Host::cname ( )
inline

◆ actorList() [2/2]

void simgrid::s4u::Host::actorList ( std::vector< ActorPtr > *  whereto)

◆ turnOn() [2/2]

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.

◆ turnOff() [2/2]

void simgrid::s4u::Host::turnOff ( )

Turns that host off.

All actors are forcefully stopped.

◆ isOn() [2/2]

bool simgrid::s4u::Host::isOn ( )

Returns if that host is currently up and running.

◆ isOff() [2/2]

bool simgrid::s4u::Host::isOff ( )
inline

Returns if that host is currently down and offline.

◆ speed() [2/2]

double simgrid::s4u::Host::speed ( )

◆ coreCount() [2/2]

int simgrid::s4u::Host::coreCount ( )

◆ properties() [2/2]

xbt_dict_t simgrid::s4u::Host::properties ( )

◆ property() [2/2]

const char* simgrid::s4u::Host::property ( const char *  key)

◆ setProperty() [2/2]

void simgrid::s4u::Host::setProperty ( const char *  key,
const char *  value 
)

◆ processes() [2/2]

void simgrid::s4u::Host::processes ( std::vector< ActorPtr > *  list)

◆ getPstateSpeed() [2/2]

double simgrid::s4u::Host::getPstateSpeed ( int  pstate_index)

◆ pstatesCount() [2/2]

int simgrid::s4u::Host::pstatesCount ( ) const

◆ setPstate() [2/2]

void simgrid::s4u::Host::setPstate ( int  pstate_index)

◆ pstate() [2/2]

int simgrid::s4u::Host::pstate ( )

◆ attachedStorages() [2/2]

void simgrid::s4u::Host::attachedStorages ( std::vector< const char *> *  storages)

◆ mountedStorages() [2/2]

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).

◆ routeTo() [3/4]

void simgrid::s4u::Host::routeTo ( Host dest,
std::vector< Link *> *  links,
double *  latency 
)

◆ routeTo() [4/4]

void simgrid::s4u::Host::routeTo ( Host dest,
std::vector< surf::LinkImpl *> *  links,
double *  latency 
)

Member Data Documentation

◆ pimpl_

surf::HostImpl * simgrid::s4u::Host::pimpl_ = nullptr

◆ pimpl_cpu

surf::Cpu * simgrid::s4u::Host::pimpl_cpu = nullptr

DO NOT USE DIRECTLY (.

◆ pimpl_netpoint

kernel::routing::NetPoint * simgrid::s4u::Host::pimpl_netpoint = nullptr

DO NOT USE DIRECTLY (.

◆ onCreation

simgrid::xbt::signal< void(Host &)> simgrid::s4u::Host::onCreation
static

◆ onDestruction

simgrid::xbt::signal< void(Host &)> simgrid::s4u::Host::onDestruction
static

◆ onStateChange

simgrid::xbt::signal< void(Host &)> simgrid::s4u::Host::onStateChange
static

◆ onSpeedChange

simgrid::xbt::signal< void(Host &)> simgrid::s4u::Host::onSpeedChange
static

The documentation for this class was generated from the following files: