SimGrid  3.11
Versatile Simulation of Distributed Systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
Workstation Class Referenceabstract

SURF Workstation interface class. More...

#include <workstation_interface.hpp>

Inheritance diagram for Workstation:
Resource WorkstationVM

Public Member Functions

 Workstation ()
 Workstation consrtuctor.
 
 Workstation (ModelPtr model, const char *name, xbt_dict_t props, xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu)
 Workstation constructor. More...
 
 Workstation (ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu)
 Workstation constructor. More...
 
 ~Workstation ()
 Workstation 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 currenrt Workstation. More...
 
virtual ActionPtr execute (double size)=0
 Execute some quantity of computation. More...
 
virtual ActionPtr sleep (double duration)=0
 Make a process sleep for duration seconds. More...
 
virtual int getCore ()
 Get the number of cores of the associated Cpu. More...
 
virtual double getSpeed (double load)
 Get the speed of the associated Cpu. More...
 
virtual double getAvailableSpeed ()
 Get the available speed of the associated Cpu. More...
 
virtual double getCurrentPowerPeak ()
 Get the associated Cpu power peak. More...
 
virtual StoragePtr findStorageOnMountList (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 workstation. More...
 
virtual ActionPtr open (const char *fullpath)
 Open a file. More...
 
virtual ActionPtr close (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 ActionPtr read (surf_file_t fd, sg_size_t size)
 Read a file. More...
 
virtual ActionPtr write (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 Workstation. More...
 
void getParams (ws_params_t params)
 [brief description] More...
 
void setParams (ws_params_t params)
 [brief description] More...
 
- Public Member Functions inherited from Resource
 Resource ()
 Resource constructor.
 
 Resource (ModelPtr model, const char *name, xbt_dict_t props)
 Resource constructor. More...
 
 Resource (ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint)
 Resource constructor. More...
 
 Resource (ModelPtr model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit)
 Resource constructor. More...
 
virtual ~Resource ()
 Resource destructor.
 
ModelPtr getModel ()
 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 Workstation interface class.

A workstation VM represent an virtual machine with a aggregation of a Cpu, a NetworkLink and a Storage

Constructor & Destructor Documentation

Workstation::Workstation ( ModelPtr  model,
const char *  name,
xbt_dict_t  props,
xbt_dynar_t  storage,
RoutingEdgePtr  netElm,
CpuPtr  cpu 
)

Workstation constructor.

Parameters
modelWorkstationModel associated to this Workstation
nameThe name of the Workstation
propsDictionary of properties associated to this Workstation
storageThe Storage associated to this Workstation
netElmThe RoutingEdge associated to this Workstation
cpuThe Cpu associated to this Workstation
Workstation::Workstation ( ModelPtr  model,
const char *  name,
xbt_dict_t  props,
lmm_constraint_t  constraint,
xbt_dynar_t  storage,
RoutingEdgePtr  netElm,
CpuPtr  cpu 
)

Workstation constructor.

Parameters
modelWorkstationModel associated to this Workstation
nameThe name of the Workstation
propsDictionary of properties associated to this Workstation
constraintThe lmm constraint associated to this Workstation if it is part of a LMM component
storageThe Storage associated to this Workstation
netElmThe RoutingEdge associated to this Workstation
cpuThe Cpu associated to this Workstation

Member Function Documentation

void Workstation::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.

xbt_dict_t Workstation::getProperties ( )
virtual

Get the properties of the currenrt Workstation.

Returns
The properties of the current Workstation

Reimplemented from Resource.

virtual ActionPtr Workstation::execute ( double  size)
pure virtual

Execute some quantity of computation.

Parameters
sizeThe value of the processing amount (in flop) needed to process
Returns
The CpuAction corresponding to the processing
See also
Cpu
virtual ActionPtr Workstation::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
int Workstation::getCore ( )
virtual

Get the number of cores of the associated Cpu.

Returns
The number of cores of the associated Cpu
See also
Cpu
double Workstation::getSpeed ( double  load)
virtual

Get the speed of the associated Cpu.

Parameters
load[TODO]
Returns
The speed of the associated Cpu
See also
Cpu
double Workstation::getAvailableSpeed ( )
virtual

Get the available speed of the associated Cpu.

[TODO]

Returns
The available speed of the associated Cpu
See also
Cpu
double Workstation::getCurrentPowerPeak ( )
virtual

Get the associated Cpu power peak.

Returns
The associated Cpu power peak
See also
Cpu
StoragePtr Workstation::findStorageOnMountList ( const char *  storage)
virtual

Return the storage of corresponding mount point.

Parameters
storageThe mount point
Returns
The corresponding Storage
xbt_dict_t Workstation::getMountedStorageList ( )
virtual

Get the xbt_dict_t of mount_point: Storage.

Returns
The xbt_dict_t of mount_point: Storage
xbt_dynar_t Workstation::getAttachedStorageList ( )
virtual

Get the xbt_dynar_t of storages attached to the workstation.

Returns
The xbt_dynar_t of Storage names
ActionPtr Workstation::open ( const char *  fullpath)
virtual

Open a file.

Parameters
fullpathThe full path to the file
Returns
The StorageAction corresponding to the opening
ActionPtr Workstation::close ( surf_file_t  fd)
virtual

Close a file.

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

Unlink a file.

[long description]

Parameters
fd[description]
Returns
[description]
sg_size_t Workstation::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
ActionPtr Workstation::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
ActionPtr Workstation::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 Workstation::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 Workstation::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 Workstation::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 Workstation::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
xbt_dynar_t Workstation::getVms ( )

Get the list of virtual machines on the current Workstation.

Returns
The list of VMs
void Workstation::getParams ( ws_params_t  params)

[brief description]

[long description]

Parameters
params[description]
void Workstation::setParams ( ws_params_t  params)

[brief description]

[long description]

Parameters
params[description]

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