SimGrid  3.13
Versatile Simulation of Distributed Systems
simgrid::surf::HostImpl Class Reference

SURF Host interface class. More...

#include <HostImpl.hpp>

Inheritance diagram for simgrid::surf::HostImpl:
simgrid::surf::Resource simgrid::surf::PropertyHolder simgrid::surf::VirtualMachine simgrid::surf::VMHL13

Public Member Functions

 HostImpl (HostModel *model, const char *name, xbt_dynar_t storage, Cpu *cpu)
 Host constructor. More...
 
 HostImpl (HostModel *model, const char *name, lmm_constraint_t constraint, xbt_dynar_t storage, Cpu *cpu)
 Host constructor. More...
 
 ~HostImpl ()
 use destroy() instead of this destructor More...
 
HostModelgetModel ()
 
void attach (simgrid::s4u::Host *host)
 
bool isOn () const override
 Check if the current Resource is active. More...
 
bool isOff () const override
 Check if the current Resource is shut down. More...
 
void turnOn () override
 Turn on the current Resource. More...
 
void turnOff () override
 Turn off the current Resource. More...
 
virtual simgrid::surf::StoragefindStorageOnMountList (const char *storage)
 Return the storage of corresponding mount point. More...
 
virtual xbt_dict_t getMountedStorageList ()
 Get the xbt_dict_t of mount_point: Storage. More...
 
virtual xbt_dynar_t getAttachedStorageList ()
 Get the xbt_dynar_t of storages attached to the Host. More...
 
virtual Actionopen (const char *fullpath)
 Open a file. More...
 
virtual Actionclose (surf_file_t fd)
 Close a file. More...
 
virtual int unlink (surf_file_t fd)
 Unlink a file. More...
 
virtual sg_size_t getSize (surf_file_t fd)
 Get the size in bytes of the file. More...
 
virtual Actionread (surf_file_t fd, sg_size_t size)
 Read a file. More...
 
virtual Actionwrite (surf_file_t fd, sg_size_t size)
 Write a file. More...
 
virtual xbt_dynar_t getInfo (surf_file_t fd)
 Get the informations of a file descriptor. More...
 
virtual sg_size_t fileTell (surf_file_t fd)
 Get the current position of the file descriptor. More...
 
virtual int fileSeek (surf_file_t fd, sg_offset_t offset, int origin)
 Set the position indicator associated with the file descriptor to a new position. More...
 
virtual int fileMove (surf_file_t fd, const char *fullpath)
 Move a file to another location on the same mount point. More...
 
bool isUsed () override
 Check if the current Resource is used (if it currently serves an action) More...
 
void apply_event (tmgr_trace_iterator_t event, double value) override
 Apply an event of external load event to that resource. More...
 
xbt_dynar_t getVms ()
 Get the list of virtual machines on the current Host. More...
 
void getParams (vm_params_t params)
 Retrieve a copy of the parameters of that VM/PM. More...
 
void setParams (vm_params_t params)
 Sets the params of that VM/PM. More...
 
simgrid::s4u::Host * getHost ()
 
- Public Member Functions inherited from simgrid::surf::Resource
 Resource (Model *model, const char *name)
 Constructor of non-LMM Resources. More...
 
 Resource (Model *model, const char *name, lmm_constraint_t constraint)
 Constructor of LMM Resources. More...
 
virtual ~Resource ()
 
ModelgetModel () const
 Get the Model of the current Resource. More...
 
const char * getName () const
 Get the name of the current Resource. More...
 
bool operator== (const Resource &other) const
 
lmm_constraint_t getConstraint () const
 Get the lmm constraint associated to this Resource if it is part of a LMM component (or null if none) More...
 
- Public Member Functions inherited from simgrid::surf::PropertyHolder
 PropertyHolder (xbt_dict_t props)
 
 ~PropertyHolder ()
 
const char * getProperty (const char *id)
 Return the property associated to the provided key (or NULL if not existing) More...
 
void setProperty (const char *id, const char *value)
 Change the value of a given key in the property set. More...
 
xbt_dict_t getProperties ()
 Return the whole set of properties. More...
 

Static Public Member Functions

static void classInit ()
 

Public Attributes

xbt_dynar_t p_storage
 
Cpup_cpu
 
simgrid::s4u::Host * p_host = nullptr
 

Static Public Attributes

static simgrid::xbt::Extension< simgrid::s4u::Host, HostImplEXTENSION_ID
 

Additional Inherited Members

- Protected Attributes inherited from simgrid::surf::Resource
lmm_constraint_t constraint_ = nullptr
 

Detailed Description

SURF Host interface class.

An host represents a machine with a aggregation of a Cpu, a RoutingEdge and a Storage

Constructor & Destructor Documentation

simgrid::surf::HostImpl::HostImpl ( HostModel model,
const char *  name,
xbt_dynar_t  storage,
Cpu cpu 
)

Host constructor.

Parameters
modelHostModel associated to this Host
nameThe name of the Host
propsDictionary of properties associated to this Host
storageThe Storage associated to this Host
cpuThe Cpu associated to this Host
simgrid::surf::HostImpl::HostImpl ( HostModel model,
const char *  name,
lmm_constraint_t  constraint,
xbt_dynar_t  storage,
Cpu cpu 
)

Host constructor.

Parameters
modelHostModel associated to this Host
nameThe name of the Host
propsDictionary of properties associated to this Host
constraintThe lmm constraint associated to this Host if it is part of a LMM component
storageThe Storage associated to this Host
cpuThe Cpu associated to this Host
simgrid::surf::HostImpl::~HostImpl ( )

use destroy() instead of this destructor

Member Function Documentation

void simgrid::surf::HostImpl::classInit ( )
static
HostModel* simgrid::surf::HostImpl::getModel ( )
inline
void simgrid::surf::HostImpl::attach ( simgrid::s4u::Host *  host)
bool simgrid::surf::HostImpl::isOn ( ) const
overridevirtual

Check if the current Resource is active.

Reimplemented from simgrid::surf::Resource.

bool simgrid::surf::HostImpl::isOff ( ) const
overridevirtual

Check if the current Resource is shut down.

Reimplemented from simgrid::surf::Resource.

void simgrid::surf::HostImpl::turnOn ( )
overridevirtual

Turn on the current Resource.

Reimplemented from simgrid::surf::Resource.

Reimplemented in simgrid::surf::VirtualMachine.

void simgrid::surf::HostImpl::turnOff ( )
overridevirtual

Turn off the current Resource.

Reimplemented from simgrid::surf::Resource.

Reimplemented in simgrid::surf::VirtualMachine.

simgrid::surf::Storage * simgrid::surf::HostImpl::findStorageOnMountList ( const char *  storage)
virtual

Return the storage of corresponding mount point.

xbt_dict_t simgrid::surf::HostImpl::getMountedStorageList ( )
virtual

Get the xbt_dict_t of mount_point: Storage.

xbt_dynar_t simgrid::surf::HostImpl::getAttachedStorageList ( )
virtual

Get the xbt_dynar_t of storages attached to the Host.

Action * simgrid::surf::HostImpl::open ( const char *  fullpath)
virtual

Open a file.

Parameters
fullpathThe full path to the file
Returns
The StorageAction corresponding to the opening
Action * simgrid::surf::HostImpl::close ( surf_file_t  fd)
virtual

Close a file.

Parameters
fdThe file descriptor to close
Returns
The StorageAction corresponding to the closing
int simgrid::surf::HostImpl::unlink ( surf_file_t  fd)
virtual

Unlink a file.

[long description]

Parameters
fd[description]
Returns
[description]
sg_size_t simgrid::surf::HostImpl::getSize ( surf_file_t  fd)
virtual

Get the size in bytes of the file.

Parameters
fdThe file descriptor to read
Returns
The size in bytes of the file
Action * simgrid::surf::HostImpl::read ( surf_file_t  fd,
sg_size_t  size 
)
virtual

Read a file.

Parameters
fdThe file descriptor to read
sizeThe size in bytes to read
Returns
The StorageAction corresponding to the reading
Action * simgrid::surf::HostImpl::write ( surf_file_t  fd,
sg_size_t  size 
)
virtual

Write a file.

Parameters
fdThe file descriptor to write
sizeThe size in bytes to write
Returns
The StorageAction corresponding to the writing
xbt_dynar_t simgrid::surf::HostImpl::getInfo ( surf_file_t  fd)
virtual

Get the informations of a file descriptor.

The returned xbt_dynar_t contains:

  • the size of the file,
  • the mount point,
  • the storage name,
  • the storage typeId,
  • the storage content type
Parameters
fdThe file descriptor
Returns
An xbt_dynar_t with the file informations
sg_size_t simgrid::surf::HostImpl::fileTell ( surf_file_t  fd)
virtual

Get the current position of the file descriptor.

Parameters
fdThe file descriptor
Returns
The current position of the file descriptor
int simgrid::surf::HostImpl::fileSeek ( surf_file_t  fd,
sg_offset_t  offset,
int  origin 
)
virtual

Set the position indicator associated with the file descriptor to a new position.

[long description]

Parameters
fdThe file descriptor
offsetThe offset from the origin
originPosition used as a reference for the offset
  • SEEK_SET: beginning of the file
  • SEEK_CUR: current position indicator
  • SEEK_END: end of the file
Returns
MSG_OK if successful, otherwise MSG_TASK_CANCELED
int simgrid::surf::HostImpl::fileMove ( surf_file_t  fd,
const char *  fullpath 
)
virtual

Move a file to another location on the same mount point.

[long description]

Parameters
fdThe file descriptor
fullpathThe new full path
Returns
MSG_OK if successful, MSG_TASK_CANCELED and a warning if the new full path is not on the same mount point
bool simgrid::surf::HostImpl::isUsed ( )
inlineoverridevirtual

Check if the current Resource is used (if it currently serves an action)

Implements simgrid::surf::Resource.

void simgrid::surf::HostImpl::apply_event ( tmgr_trace_iterator_t  event,
double  value 
)
inlineoverridevirtual

Apply an event of external load event to that resource.

Parameters
eventWhat happened
value[TODO]

Implements simgrid::surf::Resource.

xbt_dynar_t simgrid::surf::HostImpl::getVms ( )

Get the list of virtual machines on the current Host.

void simgrid::surf::HostImpl::getParams ( vm_params_t  params)

Retrieve a copy of the parameters of that VM/PM.

The ramsize and overcommit fields are used on the PM too

void simgrid::surf::HostImpl::setParams ( vm_params_t  params)

Sets the params of that VM/PM.

simgrid::s4u::Host* simgrid::surf::HostImpl::getHost ( )
inline

Member Data Documentation

simgrid::xbt::Extension< simgrid::s4u::Host, HostImpl > simgrid::surf::HostImpl::EXTENSION_ID
static
xbt_dynar_t simgrid::surf::HostImpl::p_storage
Cpu* simgrid::surf::HostImpl::p_cpu
simgrid::s4u::Host* simgrid::surf::HostImpl::p_host = nullptr

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