SimGrid  3.12
Versatile Simulation of Distributed Systems
Host Class Referenceabstract

SURF Host interface class. More...

#include <host_interface.hpp>

Inheritance diagram for Host:
Resource VM

Public Member Functions

 Host (Model *model, const char *name, xbt_dict_t props, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu)
 Host constructor. More...
 
 Host (Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu)
 Host constructor. More...
 
 ~Host ()
 Host destructor.
 
void setState (e_surf_resource_state_t state)
 Set the state of the current Resource. More...
 
xbt_dict_t getProperties ()
 Get the properties of the current Host. More...
 
virtual Actionexecute (double flops_amount)=0
 Execute some quantity of computation. More...
 
virtual Actionsleep (double duration)=0
 Make a process sleep for duration seconds. More...
 
virtual StoragefindStorageOnMountList (const char *storage)
 Return the storage of corresponding mount point.
 
virtual xbt_dict_t getMountedStorageList ()
 Get the xbt_dict_t of mount_point: Storage.
 
virtual xbt_dynar_t getAttachedStorageList ()
 Get the xbt_dynar_t of storages attached to the Host.
 
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...
 
xbt_dynar_t getVms ()
 Get the list of virtual machines on the current Host.
 
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.
 
- Public Member Functions inherited from Resource
 Resource ()
 Resource constructor.
 
 Resource (Model *model, const char *name, xbt_dict_t props)
 Resource constructor. More...
 
 Resource (Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint)
 Resource constructor. More...
 
 Resource (Model *model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit)
 Resource constructor. More...
 
virtual ~Resource ()
 Resource destructor.
 
ModelgetModel ()
 Get the Model of the current Resource. More...
 
const char * getName ()
 Get the name of the current Resource. More...
 
virtual void updateState (tmgr_trace_event_t event_type, double value, double date)=0
 Update the state of the current Resource. More...
 
virtual bool isUsed ()=0
 Check if the current Resource is used. More...
 
bool isOn ()
 Check if the current Resource is active. More...
 
void turnOn ()
 Turn on the current Resource.
 
void turnOff ()
 Turn off the current Resource.
 
virtual e_surf_resource_state_t getState ()
 Get the state of the current Resource. More...
 
lmm_constraint_t getConstraint ()
 Get the lmm constraint associated to this Resource if it is part of a LMM component. More...
 

Detailed Description

SURF Host interface class.

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

Constructor & Destructor Documentation

Host::Host ( Model model,
const char *  name,
xbt_dict_t  props,
xbt_dynar_t  storage,
RoutingEdge netElm,
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
netElmThe RoutingEdge associated to this Host
cpuThe Cpu associated to this Host
Host::Host ( Model model,
const char *  name,
xbt_dict_t  props,
lmm_constraint_t  constraint,
xbt_dynar_t  storage,
RoutingEdge netElm,
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
netElmThe RoutingEdge associated to this Host
cpuThe Cpu associated to this Host

Member Function Documentation

void Host::setState ( e_surf_resource_state_t  state)
virtual

Set the state of the current Resource.

Parameters
stateThe new state of the current Resource

Reimplemented from Resource.

Reimplemented in VM.

xbt_dict_t Host::getProperties ( )
virtual

Get the properties of the current Host.

Returns
The properties of the current Host

Reimplemented from Resource.

virtual Action* Host::execute ( double  flops_amount)
pure virtual

Execute some quantity of computation.

Parameters
flops_amountThe value of the processing amount (in flop) needed to process
Returns
The CpuAction corresponding to the processing
See also
Cpu
virtual Action* Host::sleep ( double  duration)
pure virtual

Make a process sleep for duration seconds.

Parameters
durationThe number of seconds to sleep
Returns
The CpuAction corresponding to the sleeping
See also
Cpu
Action * Host::open ( const char *  fullpath)
virtual

Open a file.

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

Close a file.

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

Unlink a file.

[long description]

Parameters
fd[description]
Returns
[description]
sg_size_t Host::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 * Host::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 * Host::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 Host::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 Host::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 Host::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 Host::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
void Host::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


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