SimGrid  3.20
Versatile Simulation of Distributed Systems
simgrid::s4u::VirtualMachine Class Reference

Detailed Description

A VM represents a virtual machine (or a container) that hosts actors.

The total computing power that the contained actors can get is constrained to the virtual machine size.

#include <VirtualMachine.hpp>

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

Public Types

enum  state { state::CREATED, state::RUNNING, state::SUSPENDED, state::DESTROYED }
 

Public Member Functions

 VirtualMachine (const char *name, s4u::Host *physical_host, int core_amount)
 
 VirtualMachine (const char *name, s4u::Host *physical_host, int core_amount, size_t ramsize)
 
 VirtualMachine (VirtualMachine const &)=delete
 
VirtualMachineoperator= (VirtualMachine const &)=delete
 
simgrid::vm::VirtualMachineImplget_impl ()
 
void start ()
 
void suspend ()
 
void resume ()
 
void shutdown ()
 
void destroy ()
 Fire the required callbacks and destroy the object. More...
 
simgrid::s4u::Hostget_pm ()
 
void set_pm (simgrid::s4u::Host *pm)
 
size_t get_ramsize ()
 
void set_ramsize (size_t ramsize)
 
void set_bound (double bound)
 Set a CPU bound for a given VM. More...
 
VirtualMachine::state get_state ()
 
VirtualMachine::state getState ()
 
simgrid::vm::VirtualMachineImplgetImpl ()
 
simgrid::s4u::HostgetPm ()
 
void setPm (simgrid::s4u::Host *pm)
 
size_t getRamsize ()
 
void setRamsize (size_t ramsize)
 
void setBound (double bound)
 
- Public Member Functions inherited from simgrid::s4u::Host
 Host (const char *name)
 
 Host (Host const &)=delete
 
Hostoperator= (Host const &)=delete
 
simgrid::xbt::string const & get_name () const
 Retrieves the name of that host as a C++ string. More...
 
const char * get_cname () const
 Retrieves the name of that host as a C string. More...
 
int get_actor_count ()
 Returns how many actors (daemonized or not) have been launched on this host. More...
 
std::vector< ActorPtr > get_all_actors ()
 Return a copy of the list of actors that are executing on this host. More...
 
void turn_on ()
 Turns that host on if it was previously off. More...
 
void turn_off ()
 Turns that host off. More...
 
bool is_on ()
 Returns if that host is currently up and running. More...
 
bool is_off ()
 Returns if that host is currently down and offline. More...
 
const char * get_property (const char *key)
 Retrieve the property value (or nullptr if not set) More...
 
void set_property (std::string key, std::string value)
 
std::unordered_map< std::string, std::string > * get_properties ()
 Get the properties assigned to a host. More...
 
std::map< std::string, std::string > * getProperties ()
 
double get_speed ()
 Get the peak computing speed in flops/s at the current pstate, taking the external load into account. More...
 
double get_available_speed ()
 Get the available speed ratio, between 0 and 1. More...
 
int get_core_count ()
 Returns the number of core of the processor. More...
 
double get_load ()
 Returns the current computation load (in flops per second) The external load (coming from an availability trace) is not taken in account. More...
 
double get_pstate_speed (int pstate_index)
 Get the peak processor speed (in flops/s), at the specified pstate. More...
 
int get_pstate_count () const
 
void set_pstate (int pstate_index)
 Set the pstate at which the host should run. More...
 
int get_pstate ()
 Retrieve the pstate at which the host is currently running. More...
 
double getSpeed ()
 
double getPstateSpeed (int pstate_index)
 
std::vector< const char * > get_attached_storages ()
 Returns the list of storages attached to an host. More...
 
void getAttachedStorages (std::vector< const char *> *storages)
 
std::unordered_map< std::string, Storage * > const & get_mounted_storages ()
 Get an associative list [mount point]->[Storage] of all local mount points. More...
 
std::unordered_map< std::string, Storage * > const & getMountedStorages ()
 
void route_to (Host *dest, std::vector< Link *> &links, double *latency)
 Find a route toward another host. More...
 
void route_to (Host *dest, std::vector< kernel::resource::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...
 
void execute (double flops, double priority)
 Block the calling actor on an execution located on the called host (with explicit priority) More...
 
simgrid::xbt::string const & getName () const
 
const char * getCname () const
 
void actorList (std::vector< ActorPtr > *whereto)
 
void getProcesses (std::vector< ActorPtr > *list)
 
void turnOn ()
 
void turnOff ()
 
bool isOn ()
 
bool isOff ()
 
const char * getProperty (const char *key)
 
void setProperty (std::string key, std::string value)
 
void setPstate (int idx)
 
int getPstate ()
 
void routeTo (Host *dest, std::vector< Link *> &links, double *latency)
 
void routeTo (Host *dest, std::vector< kernel::resource::LinkImpl *> &links, double *latency)
 
int getCoreCount ()
 
int getPstatesCount () const
 
- Public Member Functions inherited from simgrid::xbt::Extendable< Host >
 Extendable ()
 
 ~Extendable ()
 
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)
 

Static Public Attributes

static simgrid::xbt::signal< void(VirtualMachine &)> on_start
 
static simgrid::xbt::signal< void(VirtualMachine &)> on_started
 
static simgrid::xbt::signal< void(VirtualMachine &)> on_shutdown
 
static simgrid::xbt::signal< void(VirtualMachine &)> on_suspend
 
static simgrid::xbt::signal< void(VirtualMachine &)> on_resume
 
- Static Public Attributes inherited from simgrid::s4u::Host
static simgrid::xbt::signal< void(Host &)> on_creation
 
static simgrid::xbt::signal< void(Host &)> on_destruction
 
static simgrid::xbt::signal< void(Host &)> on_state_change
 
static simgrid::xbt::signal< void(Host &)> on_speed_change
 

Additional Inherited Members

- Static Public Member Functions inherited from simgrid::s4u::Host
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 (const char *name)
 Retrieves an host from its name, or die. 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 ()
 
- Public Attributes inherited from simgrid::s4u::Host
surf::Cpupimpl_cpu = nullptr
 DO NOT USE DIRECTLY (. More...
 
surf::HostImplpimpl_ = nullptr
 
kernel::routing::NetPointpimpl_netpoint = nullptr
 DO NOT USE DIRECTLY (. More...
 
- Protected Member Functions inherited from simgrid::s4u::Host
virtual ~Host ()
 Host destruction logic. More...
 

Member Enumeration Documentation

◆ state

Enumerator
CREATED 

created, but not yet started

RUNNING 
SUSPENDED 

Suspend/resume does not involve disk I/O, so we assume there is no transition states.

DESTROYED 

Constructor & Destructor Documentation

◆ VirtualMachine() [1/3]

simgrid::s4u::VirtualMachine::VirtualMachine ( const char *  name,
s4u::Host physical_host,
int  core_amount 
)
explicit

◆ VirtualMachine() [2/3]

simgrid::s4u::VirtualMachine::VirtualMachine ( const char *  name,
s4u::Host physical_host,
int  core_amount,
size_t  ramsize 
)
explicit

◆ VirtualMachine() [3/3]

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

Member Function Documentation

◆ operator=()

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

◆ get_impl()

simgrid::vm::VirtualMachineImpl* simgrid::s4u::VirtualMachine::get_impl ( )
inline

◆ start()

void simgrid::s4u::VirtualMachine::start ( )

◆ suspend()

void simgrid::s4u::VirtualMachine::suspend ( )

◆ resume()

void simgrid::s4u::VirtualMachine::resume ( )

◆ shutdown()

void simgrid::s4u::VirtualMachine::shutdown ( )

◆ destroy()

void simgrid::s4u::VirtualMachine::destroy ( )
virtual

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

Reimplemented from simgrid::s4u::Host.

◆ get_pm()

simgrid::s4u::Host * simgrid::s4u::VirtualMachine::get_pm ( )

◆ set_pm()

void simgrid::s4u::VirtualMachine::set_pm ( simgrid::s4u::Host pm)

◆ get_ramsize()

size_t simgrid::s4u::VirtualMachine::get_ramsize ( )

◆ set_ramsize()

void simgrid::s4u::VirtualMachine::set_ramsize ( size_t  ramsize)

◆ get_state()

VirtualMachine::state simgrid::s4u::VirtualMachine::get_state ( )

◆ getState()

VirtualMachine::state simgrid::s4u::VirtualMachine::getState ( )
inline

◆ getImpl()

simgrid::vm::VirtualMachineImpl* simgrid::s4u::VirtualMachine::getImpl ( )
inline

◆ getPm()

simgrid::s4u::Host* simgrid::s4u::VirtualMachine::getPm ( )
inline

◆ setPm()

void simgrid::s4u::VirtualMachine::setPm ( simgrid::s4u::Host pm)
inline

◆ getRamsize()

size_t simgrid::s4u::VirtualMachine::getRamsize ( )
inline

◆ setRamsize()

void simgrid::s4u::VirtualMachine::setRamsize ( size_t  ramsize)
inline

◆ setBound()

void simgrid::s4u::VirtualMachine::setBound ( double  bound)
inline

Member Data Documentation

◆ on_start

simgrid::xbt::signal< void(VirtualMachine &)> simgrid::s4u::VirtualMachine::on_start
static

◆ on_started

simgrid::xbt::signal< void(VirtualMachine &)> simgrid::s4u::VirtualMachine::on_started
static

◆ on_shutdown

simgrid::xbt::signal< void(VirtualMachine &)> simgrid::s4u::VirtualMachine::on_shutdown
static

◆ on_suspend

simgrid::xbt::signal< void(VirtualMachine &)> simgrid::s4u::VirtualMachine::on_suspend
static

◆ on_resume

simgrid::xbt::signal< void(VirtualMachine &)> simgrid::s4u::VirtualMachine::on_resume
static

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