SimGrid  3.16
Versatile Simulation of Distributed Systems
SURF C bindings

Detailed Description

Describes the c bindings of SURF.

Typedefs

typedef surf_Modelsurf_model_t
 Model datatype. More...
 
typedef surf_Actionsurf_action_t
 Action structure. More...
 
surf_action_t surf_model_extract_done_action_set (surf_model_t model)
 Pop an action from the done actions set. More...
 
surf_action_t surf_model_extract_failed_action_set (surf_model_t model)
 Pop an action from the failed actions set. More...
 
int surf_model_running_action_set_size (surf_model_t model)
 Get the size of the running action set of a model. More...
 
surf_action_t surf_host_close (sg_host_t host, surf_file_t fd)
 Create a file closing action on the given host. More...
 
surf_action_t surf_host_read (sg_host_t host, surf_file_t fd, sg_size_t size)
 Create a file reading action on the given host. More...
 
surf_action_t surf_host_write (sg_host_t host, surf_file_t fd, sg_size_t size)
 Create a file writing action on the given host. More...
 
xbt_dynar_t surf_host_get_info (sg_host_t host, surf_file_t fd)
 Get the information of a file descriptor. More...
 
sg_size_t surf_host_get_free_size (sg_host_t resource, const char *name)
 Get the available space of the storage at the mount point. More...
 
sg_size_t surf_host_get_used_size (sg_host_t resource, const char *name)
 Get the used space of the storage at the mount point. More...
 
int surf_host_unlink (sg_host_t host, surf_file_t fd)
 Unlink a file descriptor. More...
 
size_t surf_host_get_size (sg_host_t host, surf_file_t fd)
 Get the size of a file on a host. More...
 
size_t surf_host_file_tell (sg_host_t host, surf_file_t fd)
 Get the current position of the file descriptor. More...
 
int surf_host_file_move (sg_host_t host, surf_file_t fd, const char *fullpath)
 Move a file to another location on the same mount point. More...
 
int surf_host_file_seek (sg_host_t host, surf_file_t fd, sg_offset_t offset, int origin)
 Set the position indictator assiociated with the file descriptor to a new position. More...
 
sg_size_t surf_storage_get_size (surf_storage_t resource)
 Get the size in bytes of a storage. More...
 
sg_size_t surf_storage_get_free_size (surf_storage_t resource)
 Get the available size in bytes of a storage. More...
 
sg_size_t surf_storage_get_used_size (surf_storage_t resource)
 Get the size in bytes of a storage. More...
 
xbt_dict_t surf_storage_get_properties (surf_storage_t resource)
 return the properties set associated to that storage More...
 
void surf_cpu_action_set_bound (surf_action_t action, double bound)
 [brief description] More...
 
double surf_network_action_get_latency_limited (surf_action_t action)
 [brief description] More...
 
surf_file_t surf_storage_action_get_file (surf_action_t action)
 Get the file associated to a storage action. More...
 
xbt_dict_t surf_storage_action_get_ls_dict (surf_action_t action)
 Get the result dictionary of an ls action. More...
 
const char * surf_storage_get_host (surf_storage_t resource)
 Get the host the storage is attached to. More...
 
const char * surf_storage_get_name (surf_storage_t resource)
 

Typedef Documentation

◆ surf_model_t

Model datatype.

Generic data structure for a model. The hosts, the CPUs and the network links are examples of models.

◆ surf_action_t

Action structure.

Never create s_surf_action_t by yourself ! The actions are created on the fly when you call execute or communicate on a model.

See also
e_surf_action_state_t

Function Documentation

◆ surf_model_extract_done_action_set()

surf_action_t surf_model_extract_done_action_set ( surf_model_t  model)

Pop an action from the done actions set.

Parameters
modelThe model from which the action is extracted
Returns
An action in done state

◆ surf_model_extract_failed_action_set()

surf_action_t surf_model_extract_failed_action_set ( surf_model_t  model)

Pop an action from the failed actions set.

Parameters
modelThe model from which the action is extracted
Returns
An action in failed state

◆ surf_model_running_action_set_size()

int surf_model_running_action_set_size ( surf_model_t  model)

Get the size of the running action set of a model.

Parameters
modelThe model
Returns
The size of the running action set

◆ surf_host_close()

surf_action_t surf_host_close ( sg_host_t  host,
surf_file_t  fd 
)

Create a file closing action on the given host.

◆ surf_host_read()

surf_action_t surf_host_read ( sg_host_t  host,
surf_file_t  fd,
sg_size_t  size 
)

Create a file reading action on the given host.

◆ surf_host_write()

surf_action_t surf_host_write ( sg_host_t  host,
surf_file_t  fd,
sg_size_t  size 
)

Create a file writing action on the given host.

◆ surf_host_get_info()

xbt_dynar_t surf_host_get_info ( sg_host_t  host,
surf_file_t  fd 
)

Get the information 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
hostThe surf host
fdThe file descriptor
Returns
An xbt_dynar_t with the file information

◆ surf_host_get_free_size()

sg_size_t surf_host_get_free_size ( sg_host_t  resource,
const char *  name 
)

Get the available space of the storage at the mount point.

Parameters
resourceThe surf host
nameThe mount point
Returns
The amount of available space in bytes

◆ surf_host_get_used_size()

sg_size_t surf_host_get_used_size ( sg_host_t  resource,
const char *  name 
)

Get the used space of the storage at the mount point.

Parameters
resourceThe surf host
nameThe mount point
Returns
The amount of used space in bytes

◆ surf_host_unlink()

int surf_host_unlink ( sg_host_t  host,
surf_file_t  fd 
)

Unlink a file descriptor.

Parameters
hostThe surf host
fdThe file descriptor
Returns
0 if failed to unlink, 1 otherwise

◆ surf_host_get_size()

size_t surf_host_get_size ( sg_host_t  host,
surf_file_t  fd 
)

Get the size of a file on a host.

Parameters
hostThe surf host
fdThe file descriptor
Returns
The size in bytes of the file

◆ surf_host_file_tell()

size_t surf_host_file_tell ( sg_host_t  host,
surf_file_t  fd 
)

Get the current position of the file descriptor.

Parameters
hostThe surf host
fdThe file descriptor
Returns
The current position of the file descriptor

◆ surf_host_file_move()

int surf_host_file_move ( sg_host_t  host,
surf_file_t  fd,
const char *  fullpath 
)

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

[long description]

Parameters
hostThe surf host
fdThe file descriptor
fullpathThe new full path
Returns
MSG_OK if successful, otherwise MSG_TASK_CANCELED

◆ surf_host_file_seek()

int surf_host_file_seek ( sg_host_t  host,
surf_file_t  fd,
sg_offset_t  offset,
int  origin 
)

Set the position indictator assiociated with the file descriptor to a new position.

[long description]

Parameters
hostThe surf host
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

◆ surf_storage_get_size()

sg_size_t surf_storage_get_size ( surf_storage_t  resource)

Get the size in bytes of a storage.

Parameters
resourceThe surf storage
Returns
The size in bytes of the storage

◆ surf_storage_get_free_size()

sg_size_t surf_storage_get_free_size ( surf_storage_t  resource)

Get the available size in bytes of a storage.

Parameters
resourceThe surf storage
Returns
The available size in bytes of the storage

◆ surf_storage_get_used_size()

sg_size_t surf_storage_get_used_size ( surf_storage_t  resource)

Get the size in bytes of a storage.

Parameters
resourceThe surf storage
Returns
The used size in bytes of the storage

◆ surf_storage_get_properties()

xbt_dict_t surf_storage_get_properties ( surf_storage_t  resource)

return the properties set associated to that storage

◆ surf_cpu_action_set_bound()

void surf_cpu_action_set_bound ( surf_action_t  action,
double  bound 
)

[brief description]

[long description]

Parameters
actionThe surf cpu action
bound[description]

◆ surf_network_action_get_latency_limited()

double surf_network_action_get_latency_limited ( surf_action_t  action)

[brief description]

[long description]

Parameters
actionThe surf network action

◆ surf_storage_action_get_file()

surf_file_t surf_storage_action_get_file ( surf_action_t  action)

Get the file associated to a storage action.

Parameters
actionThe surf storage action
Returns
The file associated to a storage action

◆ surf_storage_action_get_ls_dict()

xbt_dict_t surf_storage_action_get_ls_dict ( surf_action_t  action)

Get the result dictionary of an ls action.

Parameters
actionThe surf storage action
Returns
The dictionry listing a path

◆ surf_storage_get_host()

const char* surf_storage_get_host ( surf_storage_t  resource)

Get the host the storage is attached to.

Parameters
resourceThe surf storage
Returns
The host name may not exist.

◆ surf_storage_get_name()

const char* surf_storage_get_name ( surf_storage_t  resource)