SimGrid  3.13
Versatile Simulation of Distributed Systems
simix.h File Reference
#include "xbt/misc.h"
#include "xbt/fifo.h"
#include "xbt/dict.h"
#include "xbt/function_types.h"
#include "xbt/parmap.h"
#include "xbt/swag.h"
#include "simgrid/datatypes.h"
#include "simgrid/host.h"

Typedefs

typedef struct s_smx_context * smx_context_t
 
typedef union u_smx_scalar u_smx_scalar_t
 
typedef struct s_smx_mutexsmx_mutex_t
 
typedef struct s_smx_condsmx_cond_t
 
typedef struct s_smx_semsmx_sem_t
 
typedef struct s_smx_filesmx_file_t
 
typedef xbt_dictelm_t smx_storage_t
 
typedef struct s_smx_storage_privsmx_storage_priv_t
 
typedef struct s_smx_synchrosmx_synchro_t
 
typedef smx_process_t(* smx_creation_func_t) (const char *, xbt_main_func_t, void *, const char *, double, int, char **, xbt_dict_t, int, smx_process_t)
 
typedef struct s_smx_mailboxsmx_mailbox_t
 
typedef void(* void_pfn_smxprocess_t) (smx_process_t)
 
typedef void(* void_pfn_sghost_t) (sg_host_t)
 
typedef struct s_smx_timersmx_timer_t
 

Enumerations

enum  e_smx_state_t {
  SIMIX_WAITING, SIMIX_READY, SIMIX_RUNNING, SIMIX_DONE,
  SIMIX_CANCELED, SIMIX_FAILED, SIMIX_SRC_HOST_FAILURE, SIMIX_DST_HOST_FAILURE,
  SIMIX_SRC_TIMEOUT, SIMIX_DST_TIMEOUT, SIMIX_LINK_FAILURE
}
 Host datatypeA location (or host) is any possible place where a process may run. More...
 

Functions

voidSIMIX_comm_get_src_data (smx_synchro_t synchro)
 Return the user data associated to the sender of the communication. More...
 
voidSIMIX_comm_get_dst_data (smx_synchro_t synchro)
 Return the user data associated to the receiver of the communication. More...
 
xbt_dynar_t SIMIX_process_get_runnable (void)
 Returns the list of processes to run. More...
 
smx_process_t SIMIX_process_from_PID (int PID)
 Returns the process from PID. More...
 
xbt_dynar_t SIMIX_processes_as_dynar (void)
 returns a dynar containg all currently existing processes More...
 
int SIMIX_context_is_parallel (void)
 Returns whether some parallel threads are used for the user contexts. More...
 
int SIMIX_context_get_nthreads (void)
 Returns the number of parallel threads used for the user contexts. More...
 
void SIMIX_context_set_nthreads (int nb_threads)
 Sets the number of parallel threads to use for the user contexts. More...
 
int SIMIX_context_get_parallel_threshold (void)
 Returns the threshold above which user processes are run in parallel. More...
 
void SIMIX_context_set_parallel_threshold (int threshold)
 Sets the threshold above which user processes are run in parallel. More...
 
e_xbt_parmap_mode_t SIMIX_context_get_parallel_mode (void)
 Returns the synchronization mode used when processes are run in parallel. More...
 
void SIMIX_context_set_parallel_mode (e_xbt_parmap_mode_t mode)
 Sets the synchronization mode to use when processes are run in parallel. More...
 
int SIMIX_is_maestro ()
 
void SIMIX_global_init (int *argc, char **argv)
 Initialize SIMIX internal data. More...
 
void SIMIX_set_maestro (void(*code)(void *), void *data)
 
void SIMIX_function_register_process_cleanup (void_pfn_smxprocess_t function)
 Registers a function to cleanup a process. More...
 
void SIMIX_function_register_process_create (smx_creation_func_t function)
 Registers a function to create a process. More...
 
void SIMIX_function_register_process_kill (void_pfn_smxprocess_t function)
 Registers a function to kill a process. More...
 
void SIMIX_run (void)
 Run the main simulation loop. More...
 
double SIMIX_get_clock (void)
 A clock (in second). More...
 
smx_timer_t SIMIX_timer_set (double date, void(*function)(void *), void *arg)
 Set the date to execute a function. More...
 
void SIMIX_timer_remove (smx_timer_t timer)
 cancels a timer that was added earlier More...
 
double SIMIX_timer_next (void)
 
double SIMIX_timer_get_date (smx_timer_t timer)
 Returns the date at which the timer will trigger (or 0 if NULL timer) More...
 
void SIMIX_display_process_status (void)
 
void SIMIX_create_environment (const char *file)
 A platform constructor. More...
 
void SIMIX_function_register (const char *name, xbt_main_func_t code)
 Registers a #smx_process_code_t code in a global table. More...
 
void SIMIX_function_register_default (xbt_main_func_t code)
 Registers a #smx_process_code_t code as default value. More...
 
xbt_main_func_t SIMIX_get_registered_function (const char *name)
 Gets a smx_process_t code from the global table. More...
 
void SIMIX_init_application (void)
 
void SIMIX_launch_application (const char *file)
 An application deployer. More...
 
void SIMIX_process_set_function (const char *process_host, const char *process_function, xbt_dynar_t arguments, double process_start_time, double process_kill_time)
 Bypass the parser, get arguments, and set function to each process. More...
 
void SIMIX_maestro_create (void(*code)(void *), void *data)
 Creates and runs the maestro process. More...
 
smx_process_t SIMIX_process_attach (const char *name, void *data, const char *hostname, xbt_dict_t properties, smx_process_t parent_process)
 
void SIMIX_process_detach (void)
 
sg_host_t SIMIX_host_self (void)
 
const char * SIMIX_host_self_get_name (void)
 
void SIMIX_host_on (sg_host_t host)
 Start the host if it is off. More...
 
void SIMIX_host_off (sg_host_t host, smx_process_t issuer)
 Stop the host if it is on. More...
 
void SIMIX_host_self_set_data (void *data)
 
voidSIMIX_host_self_get_data (void)
 
int SIMIX_process_count (void)
 
smx_process_t SIMIX_process_self (void)
 Returns the current agent. More...
 
const char * SIMIX_process_self_get_name (void)
 
void SIMIX_process_self_set_data (void *data)
 
voidSIMIX_process_self_get_data (void)
 
smx_context_t SIMIX_process_get_context (smx_process_t)
 
void SIMIX_process_set_context (smx_process_t p, smx_context_t c)
 
int SIMIX_process_has_pending_comms (smx_process_t process)
 Returns whether a process has pending asynchronous communications. More...
 
void SIMIX_process_on_exit_runall (smx_process_t process)
 
void SIMIX_process_on_exit (smx_process_t process, int_f_pvoid_pvoid_t fun, void *data)
 
xbt_main_func_t SIMIX_process_get_code (void)
 
void SIMIX_comm_set_copy_data_callback (void(*callback)(smx_synchro_t, void *, size_t))
 
void SIMIX_comm_copy_pointer_callback (smx_synchro_t comm, void *buff, size_t buff_size)
 
void SIMIX_comm_copy_buffer_callback (smx_synchro_t comm, void *buff, size_t buff_size)
 
smx_synchro_t SIMIX_comm_get_send_match (smx_mailbox_t mbox, int(*match_fun)(void *, void *), void *data)
 
int SIMIX_comm_has_send_match (smx_mailbox_t mbox, int(*match_fun)(void *, void *), void *data)
 
int SIMIX_comm_has_recv_match (smx_mailbox_t mbox, int(*match_fun)(void *, void *), void *data)
 
void SIMIX_comm_finish (smx_synchro_t synchro)
 Answers the SIMIX simcalls associated to a communication synchro. More...
 
void simcall_call (smx_process_t process)
 
xbt_swag_t simcall_host_get_process_list (sg_host_t host)
 
void simcall_host_set_data (sg_host_t host, void *data)
 
double simcall_host_get_current_power_peak (sg_host_t host)
 
double simcall_host_get_power_peak_at (sg_host_t host, int pstate_index)
 
smx_synchro_t simcall_execution_start (const char *name, double flops_amount, double priority, double bound, unsigned long affinity_mask)
 Creates a synchro that executes some computation of an host. More...
 
smx_synchro_t simcall_execution_parallel_start (const char *name, int host_nb, sg_host_t *host_list, double *flops_amount, double *bytes_amount, double amount, double rate)
 Creates a synchro that may involve parallel computation on several hosts and communication between them. More...
 
void simcall_execution_destroy (smx_synchro_t execution)
 Destroys an execution synchro. More...
 
void simcall_execution_cancel (smx_synchro_t execution)
 Cancels an execution synchro. More...
 
double simcall_execution_get_remains (smx_synchro_t execution)
 Returns how much of an execution synchro remains to be done. More...
 
e_smx_state_t simcall_execution_get_state (smx_synchro_t execution)
 Returns the state of an execution synchro. More...
 
void simcall_execution_set_priority (smx_synchro_t execution, double priority)
 Changes the priority of an execution synchro. More...
 
void simcall_execution_set_bound (smx_synchro_t execution, double bound)
 Changes the capping (the maximum CPU utilization) of an execution synchro. More...
 
void simcall_execution_set_affinity (smx_synchro_t execution, sg_host_t host, unsigned long mask)
 Changes the CPU affinity of an execution synchro. More...
 
e_smx_state_t simcall_execution_wait (smx_synchro_t execution)
 Waits for the completion of an execution synchro and destroy it. More...
 
xbt_dict_t simcall_host_get_mounted_storage_list (sg_host_t host)
 
xbt_dynar_t simcall_host_get_attached_storage_list (sg_host_t host)
 
void simcall_host_get_params (sg_host_t vm, vm_params_t param)
 
void simcall_host_set_params (sg_host_t vm, vm_params_t param)
 
voidsimcall_vm_create (const char *name, sg_host_t host)
 Create a VM on the given physical host. More...
 
int simcall_vm_get_state (sg_host_t vm)
 Get the state of the given VM. More...
 
void simcall_vm_start (sg_host_t vm)
 Start the given VM to the given physical host. More...
 
void simcall_vm_migrate (sg_host_t vm, sg_host_t dst_pm)
 Migrate the given VM to the given physical host. More...
 
voidsimcall_vm_get_pm (sg_host_t vm)
 Get the name of the physical host on which the given VM runs. More...
 
void simcall_vm_set_bound (sg_host_t vm, double bound)
 
void simcall_vm_set_affinity (sg_host_t vm, sg_host_t pm, unsigned long mask)
 
void simcall_vm_resume (sg_host_t vm)
 Resume the given VM. More...
 
void simcall_vm_migratefrom_resumeto (sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm)
 Encompassing simcall to prevent the removal of the src or the dst node at the end of a VM migration The simcall actually invokes the following calls: simcall_vm_set_affinity(vm, src_pm, 0); simcall_vm_migrate(vm, dst_pm); simcall_vm_resume(vm);. More...
 
void simcall_vm_save (sg_host_t vm)
 Save the given VM. More...
 
void simcall_vm_restore (sg_host_t vm)
 Restore the given VM. More...
 
void simcall_vm_suspend (sg_host_t vm)
 Suspend the given VM. More...
 
void simcall_vm_destroy (sg_host_t vm)
 Destroy the given VM. More...
 
void simcall_vm_shutdown (sg_host_t vm)
 Shutdown the given VM. More...
 
smx_process_t simcall_process_create (const char *name, xbt_main_func_t code, void *data, const char *hostname, double kill_time, int argc, char **argv, xbt_dict_t properties, int auto_restart)
 Creates and runs a new SIMIX process. More...
 
void simcall_process_kill (smx_process_t process)
 Kills a SIMIX process. More...
 
void simcall_process_killall (int reset_pid)
 Kills all SIMIX processes. More...
 
void SIMIX_process_throw (smx_process_t process, xbt_errcat_t cat, int value, const char *msg)
 Ask another process to raise the given exception. More...
 
void simcall_process_cleanup (smx_process_t process)
 Cleans up a SIMIX process. More...
 
void simcall_process_suspend (smx_process_t process)
 Suspends a process. More...
 
void simcall_process_resume (smx_process_t process)
 Resumes a suspended process. More...
 
int simcall_process_count (void)
 Returns the amount of SIMIX processes in the system. More...
 
voidsimcall_process_get_data (smx_process_t process)
 Return the user data of a smx_process_t. More...
 
void simcall_process_set_data (smx_process_t process, void *data)
 Set the user data of a smx_process_t. More...
 
void simcall_process_set_host (smx_process_t process, sg_host_t dest)
 Migrates an agent to another location. More...
 
sg_host_t simcall_process_get_host (smx_process_t process)
 Return the location on which an agent is running. More...
 
const char * simcall_process_get_name (smx_process_t process)
 Return the name of an agent. More...
 
int simcall_process_get_PID (smx_process_t process)
 Return the PID of a smx_process_t. More...
 
int simcall_process_get_PPID (smx_process_t process)
 Return the parent PID of a smx_process_t. More...
 
int simcall_process_is_suspended (smx_process_t process)
 Returns true if the process is suspended . More...
 
xbt_dict_t simcall_process_get_properties (smx_process_t host)
 Return the properties. More...
 
void simcall_process_set_kill_time (smx_process_t process, double kill_time)
 Set the kill time of a process. More...
 
double simcall_process_get_kill_time (smx_process_t process)
 Get the kill time of a process (or 0 if unset). More...
 
void simcall_process_on_exit (smx_process_t process, int_f_pvoid_pvoid_t fun, void *data)
 Add an on_exit function Add an on_exit function which will be executed when the process exits/is killed. More...
 
void simcall_process_auto_restart_set (smx_process_t process, int auto_restart)
 Sets the process to be auto-restarted or not by SIMIX when its host comes back up. More...
 
smx_process_t simcall_process_restart (smx_process_t process)
 Restarts the process, killing it and starting it again from scratch. More...
 
void simcall_process_join (smx_process_t process, double timeout)
 
e_smx_state_t simcall_process_sleep (double duration)
 Creates a new sleep SIMIX synchro. More...
 
smx_mailbox_t simcall_mbox_create (const char *name)
 Creates a new rendez-vous point. More...
 
smx_mailbox_t simcall_mbox_get_by_name (const char *name)
 Returns a rendez-vous point knowing its name. More...
 
smx_synchro_t simcall_mbox_get_head (smx_mailbox_t mbox)
 returns the communication at the head of the rendez-vous More...
 
smx_process_t simcall_mbox_get_receiver (smx_mailbox_t mbox)
 
void simcall_mbox_set_receiver (smx_mailbox_t mbox, smx_process_t process)
 
void simcall_comm_send (smx_process_t sender, smx_mailbox_t mbox, double task_size, double rate, void *src_buff, size_t src_buff_size, int(*match_fun)(void *, void *, smx_synchro_t), void(*copy_data_fun)(smx_synchro_t, void *, size_t), void *data, double timeout)
 
smx_synchro_t simcall_comm_isend (smx_process_t sender, smx_mailbox_t mbox, double task_size, double rate, void *src_buff, size_t src_buff_size, int(*match_fun)(void *, void *, smx_synchro_t), void(*clean_fun)(void *), void(*copy_data_fun)(smx_synchro_t, void *, size_t), void *data, int detached)
 
void simcall_comm_recv (smx_process_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size, int(*match_fun)(void *, void *, smx_synchro_t), void(*copy_data_fun)(smx_synchro_t, void *, size_t), void *data, double timeout, double rate)
 
smx_synchro_t simcall_comm_irecv (smx_process_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size, int(*match_fun)(void *, void *, smx_synchro_t), void(*copy_data_fun)(smx_synchro_t, void *, size_t), void *data, double rate)
 
smx_synchro_t simcall_comm_iprobe (smx_mailbox_t mbox, int type, int src, int tag, int(*match_fun)(void *, void *, smx_synchro_t), void *data)
 
void simcall_comm_cancel (smx_synchro_t comm)
 
unsigned int simcall_comm_waitany (xbt_dynar_t comms)
 
void simcall_comm_wait (smx_synchro_t comm, double timeout)
 
int simcall_comm_test (smx_synchro_t comm)
 
int simcall_comm_testany (xbt_dynar_t comms)
 
double simcall_comm_get_remains (smx_synchro_t comm)
 
e_smx_state_t simcall_comm_get_state (smx_synchro_t comm)
 
voidsimcall_comm_get_src_data (smx_synchro_t comm)
 
voidsimcall_comm_get_dst_data (smx_synchro_t comm)
 
smx_process_t simcall_comm_get_src_proc (smx_synchro_t comm)
 
smx_process_t simcall_comm_get_dst_proc (smx_synchro_t comm)
 
void simcall_set_category (smx_synchro_t synchro, const char *category)
 Set the category of an synchro. More...
 
smx_mutex_t simcall_mutex_init (void)
 
void SIMIX_mutex_destroy (smx_mutex_t mutex)
 Destroys a mutex. More...
 
void simcall_mutex_lock (smx_mutex_t mutex)
 
int simcall_mutex_trylock (smx_mutex_t mutex)
 
void simcall_mutex_unlock (smx_mutex_t mutex)
 
smx_cond_t simcall_cond_init (void)
 
void SIMIX_cond_destroy (smx_cond_t cond)
 Destroys a condition. More...
 
void simcall_cond_signal (smx_cond_t cond)
 
void simcall_cond_wait (smx_cond_t cond, smx_mutex_t mutex)
 
void simcall_cond_wait_timeout (smx_cond_t cond, smx_mutex_t mutex, double max_duration)
 
void simcall_cond_broadcast (smx_cond_t cond)
 
smx_sem_t simcall_sem_init (int capacity)
 
void SIMIX_sem_destroy (smx_sem_t sem)
 Destroys a semaphore. More...
 
void simcall_sem_release (smx_sem_t sem)
 
int simcall_sem_would_block (smx_sem_t sem)
 
void simcall_sem_acquire (smx_sem_t sem)
 
void simcall_sem_acquire_timeout (smx_sem_t sem, double max_duration)
 
int simcall_sem_get_capacity (smx_sem_t sem)
 
voidsimcall_file_get_data (smx_file_t fd)
 
void simcall_file_set_data (smx_file_t fd, void *data)
 
sg_size_t simcall_file_read (smx_file_t fd, sg_size_t size, sg_host_t host)
 
sg_size_t simcall_file_write (smx_file_t fd, sg_size_t size, sg_host_t host)
 
smx_file_t simcall_file_open (const char *fullpath, sg_host_t host)
 
int simcall_file_close (smx_file_t fd, sg_host_t host)
 
int simcall_file_unlink (smx_file_t fd, sg_host_t host)
 
sg_size_t simcall_file_get_size (smx_file_t fd)
 
xbt_dynar_t simcall_file_get_info (smx_file_t fd)
 
sg_size_t simcall_file_tell (smx_file_t fd)
 
int simcall_file_seek (smx_file_t fd, sg_offset_t offset, int origin)
 
int simcall_file_move (smx_file_t fd, const char *fullpath)
 Move a file to another location on the same mount point. More...
 
sg_size_t simcall_storage_get_free_size (smx_storage_t storage)
 Returns the free space size on a given storage element. More...
 
sg_size_t simcall_storage_get_used_size (smx_storage_t storage)
 Returns the used space size on a given storage element. More...
 
xbt_dict_t simcall_storage_get_properties (smx_storage_t storage)
 Returns a dict of the properties assigned to a storage element. More...
 
voidSIMIX_storage_get_data (smx_storage_t storage)
 
void SIMIX_storage_set_data (smx_storage_t storage, void *data)
 
xbt_dict_t SIMIX_storage_get_content (smx_storage_t storage)
 
xbt_dict_t simcall_storage_get_content (smx_storage_t storage)
 Returns a dict containing the content of a storage element. More...
 
const char * SIMIX_storage_get_name (smx_storage_t storage)
 
sg_size_t SIMIX_storage_get_size (smx_storage_t storage)
 
const char * SIMIX_storage_get_host (smx_storage_t storage)
 
xbt_dict_t SIMIX_asr_get_properties (const char *name)
 
xbt_dict_t simcall_asr_get_properties (const char *name)
 Returns a dict of the properties assigned to a router or AS. More...
 
int simcall_mc_random (int min, int max)
 

Variables

char * smx_context_factory_name
 
int smx_context_stack_size
 
int smx_context_stack_size_was_set
 
int smx_context_guard_size
 
int smx_context_guard_size_was_set
 
enum  smx_process_exit_status_t { SMX_EXIT_SUCCESS = 0, SMX_EXIT_FAILURE = 1 }
 
typedef struct s_smx_processsmx_process_t
 Process datatypeA process may be defined as a code, with some private data, executing in a location. More...
 

Typedef Documentation

typedef struct s_smx_context* smx_context_t
typedef struct s_smx_file* smx_file_t
typedef struct s_smx_synchro* smx_synchro_t
typedef smx_process_t(* smx_creation_func_t) (const char *,xbt_main_func_t,void *,const char *,double,int,char **,xbt_dict_t,int,smx_process_t)
typedef struct s_smx_mailbox* smx_mailbox_t
typedef void(* void_pfn_smxprocess_t) (smx_process_t)
typedef void(* void_pfn_sghost_t) (sg_host_t)
typedef struct s_smx_timer* smx_timer_t

Enumeration Type Documentation

Enumerator
SMX_EXIT_SUCCESS 
SMX_EXIT_FAILURE 

Function Documentation

void* SIMIX_comm_get_src_data ( smx_synchro_t  synchro)

Return the user data associated to the sender of the communication.

Parameters
synchroThe communication
Returns
the user data
void* SIMIX_comm_get_dst_data ( smx_synchro_t  synchro)

Return the user data associated to the receiver of the communication.

Parameters
synchroThe communication
Returns
the user data
xbt_dynar_t SIMIX_process_get_runnable ( void  )

Returns the list of processes to run.

smx_process_t SIMIX_process_from_PID ( int  PID)

Returns the process from PID.

xbt_dynar_t SIMIX_processes_as_dynar ( void  )

returns a dynar containg all currently existing processes

int SIMIX_context_is_parallel ( void  )

Returns whether some parallel threads are used for the user contexts.

int SIMIX_context_get_nthreads ( void  )

Returns the number of parallel threads used for the user contexts.

Returns
the number of threads (1 means no parallelism)
void SIMIX_context_set_nthreads ( int  nb_threads)

Sets the number of parallel threads to use for the user contexts.

This function should be called before initializing SIMIX. A value of 1 means no parallelism (1 thread only). If the value is greater than 1, the thread support must be enabled.

Parameters
nb_threadsthe number of threads to use
int SIMIX_context_get_parallel_threshold ( void  )

Returns the threshold above which user processes are run in parallel.

If the number of threads is set to 1, there is no parallelism and this threshold has no effect.

Returns
when the number of user processes ready to run is above this threshold, they are run in parallel
void SIMIX_context_set_parallel_threshold ( int  threshold)

Sets the threshold above which user processes are run in parallel.

If the number of threads is set to 1, there is no parallelism and this threshold has no effect.

Parameters
thresholdwhen the number of user processes ready to run is above this threshold, they are run in parallel
e_xbt_parmap_mode_t SIMIX_context_get_parallel_mode ( void  )

Returns the synchronization mode used when processes are run in parallel.

Returns
how threads are synchronized if processes are run in parallel
void SIMIX_context_set_parallel_mode ( e_xbt_parmap_mode_t  mode)

Sets the synchronization mode to use when processes are run in parallel.

Parameters
modehow to synchronize threads if processes are run in parallel
int SIMIX_is_maestro ( )
void SIMIX_set_maestro ( void(*)(void *)  code,
void data 
)
void SIMIX_function_register_process_cleanup ( void_pfn_smxprocess_t  function)

Registers a function to cleanup a process.

This function registers a user function to be called when a process ends properly.

Parameters
functioncleanup process function
void SIMIX_function_register_process_create ( smx_creation_func_t  function)

Registers a function to create a process.

This function registers a function to be called when a new process is created. The function has to call SIMIX_process_create().

Parameters
functioncreate process function
void SIMIX_function_register_process_kill ( void_pfn_smxprocess_t  function)

Registers a function to kill a process.

This function registers a function to be called when a process is killed. The function has to call the SIMIX_process_kill().

Parameters
functionKill process function
smx_timer_t SIMIX_timer_set ( double  date,
void(*)(void *)  function,
void arg 
)

Set the date to execute a function.

Set the date to execute the function on the surf.

Parameters
dateDate to execute function
functionFunction to be executed
argParameters of the function
void SIMIX_timer_remove ( smx_timer_t  timer)

cancels a timer that was added earlier

double SIMIX_timer_next ( void  )
double SIMIX_timer_get_date ( smx_timer_t  timer)

Returns the date at which the timer will trigger (or 0 if NULL timer)

void SIMIX_display_process_status ( void  )
void SIMIX_create_environment ( const char *  file)

A platform constructor.

Creates a new platform, including hosts, links and the routing_table.

Parameters
filea filename of a xml description of a platform. This file follows this DTD :
\include surfxml.dtd

Here is a small example of such a platform

\include small_platform.xml
void SIMIX_function_register ( const char *  name,
xbt_main_func_t  code 
)

Registers a #smx_process_code_t code in a global table.

Registers a code function in a global table. This table is then used by SIMIX_launch_application.

Parameters
namethe reference name of the function.
codethe function
void SIMIX_function_register_default ( xbt_main_func_t  code)

Registers a #smx_process_code_t code as default value.

Registers a code function as being the default value. This function will get used by SIMIX_launch_application() when there is no registered function of the requested name in.

Parameters
codethe function
xbt_main_func_t SIMIX_get_registered_function ( const char *  name)

Gets a smx_process_t code from the global table.

Gets a code function from the global table. Returns NULL if there are no function registered with the name. This table is then used by SIMIX_launch_application.

Parameters
namethe reference name of the function.
Returns
The smx_process_t or NULL.
void SIMIX_init_application ( void  )
void SIMIX_launch_application ( const char *  file)

An application deployer.

Creates the process described in file.

Parameters
filea filename of a xml description of the application. This file follows this DTD :
\include surfxml.dtd

Here is a small example of such a platform

\include small_deployment.xml
void SIMIX_process_set_function ( const char *  process_host,
const char *  process_function,
xbt_dynar_t  arguments,
double  process_start_time,
double  process_kill_time 
)

Bypass the parser, get arguments, and set function to each process.

void SIMIX_maestro_create ( void(*)(void *)  code,
void data 
)

Creates and runs the maestro process.

smx_process_t SIMIX_process_attach ( const char *  name,
void data,
const char *  hostname,
xbt_dict_t  properties,
smx_process_t  parent_process 
)
void SIMIX_process_detach ( void  )
sg_host_t SIMIX_host_self ( void  )
const char* SIMIX_host_self_get_name ( void  )
void SIMIX_host_on ( sg_host_t  h)

Start the host if it is off.

void SIMIX_host_off ( sg_host_t  h,
smx_process_t  issuer 
)

Stop the host if it is on.

void SIMIX_host_self_set_data ( void data)
void* SIMIX_host_self_get_data ( void  )
int SIMIX_process_count ( void  )
smx_process_t SIMIX_process_self ( void  )

Returns the current agent.

This functions returns the currently running SIMIX process.

Returns
The SIMIX process
const char* SIMIX_process_self_get_name ( void  )
void SIMIX_process_self_set_data ( void data)
void* SIMIX_process_self_get_data ( void  )
smx_context_t SIMIX_process_get_context ( smx_process_t  )
void SIMIX_process_set_context ( smx_process_t  p,
smx_context_t  c 
)
int SIMIX_process_has_pending_comms ( smx_process_t  process)

Returns whether a process has pending asynchronous communications.

Returns
true if there are asynchronous communications in this process
void SIMIX_process_on_exit_runall ( smx_process_t  process)
void SIMIX_process_on_exit ( smx_process_t  process,
int_f_pvoid_pvoid_t  fun,
void data 
)
xbt_main_func_t SIMIX_process_get_code ( void  )
void SIMIX_comm_set_copy_data_callback ( void(*)(smx_synchro_t, void *, size_t)  callback)
void SIMIX_comm_copy_pointer_callback ( smx_synchro_t  comm,
void buff,
size_t  buff_size 
)
void SIMIX_comm_copy_buffer_callback ( smx_synchro_t  comm,
void buff,
size_t  buff_size 
)
smx_synchro_t SIMIX_comm_get_send_match ( smx_mailbox_t  mbox,
int(*)(void *, void *)  match_fun,
void data 
)
int SIMIX_comm_has_send_match ( smx_mailbox_t  mbox,
int(*)(void *, void *)  match_fun,
void data 
)
int SIMIX_comm_has_recv_match ( smx_mailbox_t  mbox,
int(*)(void *, void *)  match_fun,
void data 
)
void SIMIX_comm_finish ( smx_synchro_t  synchro)

Answers the SIMIX simcalls associated to a communication synchro.

Parameters
synchroa finished communication synchro
void simcall_call ( smx_process_t  process)
void simcall_host_set_data ( sg_host_t  host,
void data 
)
xbt_dict_t simcall_host_get_mounted_storage_list ( sg_host_t  host)
xbt_dynar_t simcall_host_get_attached_storage_list ( sg_host_t  host)
void simcall_host_get_params ( sg_host_t  vm,
vm_params_t  params 
)
void simcall_host_set_params ( sg_host_t  vm,
vm_params_t  params 
)
void* simcall_vm_create ( const char *  name,
sg_host_t  phys_host 
)

Create a VM on the given physical host.

Parameters
nameVM name
hostPhysical host
Returns
The host object of the VM
int simcall_vm_get_state ( sg_host_t  vm)

Get the state of the given VM.

Parameters
vmVM
Returns
The state of the VM
void simcall_vm_start ( sg_host_t  vm)

Start the given VM to the given physical host.

Parameters
vmVM
void simcall_vm_migrate ( sg_host_t  vm,
sg_host_t  host 
)

Migrate the given VM to the given physical host.

Parameters
vmVM
hostDestination physical host
void* simcall_vm_get_pm ( sg_host_t  vm)

Get the name of the physical host on which the given VM runs.

Parameters
vmVM
Returns
The name of the physical host
void simcall_vm_set_bound ( sg_host_t  vm,
double  bound 
)
void simcall_vm_set_affinity ( sg_host_t  vm,
sg_host_t  pm,
unsigned long  mask 
)
void simcall_vm_resume ( sg_host_t  vm)

Resume the given VM.

Parameters
vmVM
void simcall_vm_migratefrom_resumeto ( sg_host_t  vm,
sg_host_t  src_pm,
sg_host_t  dst_pm 
)

Encompassing simcall to prevent the removal of the src or the dst node at the end of a VM migration The simcall actually invokes the following calls: simcall_vm_set_affinity(vm, src_pm, 0); simcall_vm_migrate(vm, dst_pm); simcall_vm_resume(vm);.

It is called at the end of the migration_rx_fun function from msg/msg_vm.c

Parameters
vmVM to migrate
src_pmSource physical host
dst_pmtDestination physical host
void simcall_vm_save ( sg_host_t  vm)

Save the given VM.

Parameters
vmVM
void simcall_vm_restore ( sg_host_t  vm)

Restore the given VM.

Parameters
vmVM
void simcall_vm_suspend ( sg_host_t  vm)

Suspend the given VM.

Parameters
vmVM
void simcall_vm_destroy ( sg_host_t  vm)

Destroy the given VM.

Parameters
vmVM
void simcall_vm_shutdown ( sg_host_t  vm)

Shutdown the given VM.

Parameters
vmVM
void SIMIX_process_throw ( smx_process_t  process,
xbt_errcat_t  cat,
int  value,
const char *  msg 
)

Ask another process to raise the given exception.

Parameters
catcategory of exception
valuevalue associated to the exception
msgstring information associated to the exception
void simcall_process_join ( smx_process_t  process,
double  timeout 
)
smx_mailbox_t simcall_mbox_create ( const char *  name)

Creates a new rendez-vous point.

Parameters
nameThe name of the rendez-vous point
Returns
The created rendez-vous point
smx_mailbox_t simcall_mbox_get_by_name ( const char *  name)

Returns a rendez-vous point knowing its name.

smx_synchro_t simcall_mbox_get_head ( smx_mailbox_t  mbox)

returns the communication at the head of the rendez-vous

Parameters
mboxThe rendez-vous point
Returns
The communication or NULL if empty
smx_process_t simcall_mbox_get_receiver ( smx_mailbox_t  mbox)
void simcall_mbox_set_receiver ( smx_mailbox_t  mbox,
smx_process_t  process 
)
void simcall_set_category ( smx_synchro_t  synchro,
const char *  category 
)

Set the category of an synchro.

This functions changes the category only. It calls a surf function.

Parameters
executionThe execution synchro
categoryThe tracing category
void SIMIX_mutex_destroy ( smx_mutex_t  mutex)

Destroys a mutex.

Destroys and frees the mutex's memory.

Parameters
mutexA mutex
void SIMIX_cond_destroy ( smx_cond_t  cond)

Destroys a condition.

Destroys and frees the condition's memory.

Parameters
condA condition
void SIMIX_sem_destroy ( smx_sem_t  sem)

Destroys a semaphore.

void* simcall_file_get_data ( smx_file_t  fd)
void simcall_file_set_data ( smx_file_t  fd,
void data 
)
sg_size_t simcall_storage_get_free_size ( smx_storage_t  storage)

Returns the free space size on a given storage element.

Parameters
storagea storage
Returns
Return the free space size on a given storage element (as sg_size_t)
sg_size_t simcall_storage_get_used_size ( smx_storage_t  storage)

Returns the used space size on a given storage element.

Parameters
storagea storage
Returns
Return the used space size on a given storage element (as sg_size_t)
xbt_dict_t simcall_storage_get_properties ( smx_storage_t  storage)

Returns a dict of the properties assigned to a storage element.

Parameters
storageA storage element
Returns
The properties of this storage element
void* SIMIX_storage_get_data ( smx_storage_t  storage)
void SIMIX_storage_set_data ( smx_storage_t  storage,
void data 
)
xbt_dict_t SIMIX_storage_get_content ( smx_storage_t  storage)
xbt_dict_t simcall_storage_get_content ( smx_storage_t  storage)

Returns a dict containing the content of a storage element.

Parameters
storageA storage element
Returns
The content of this storage element as a dict (full path file => size)
const char* SIMIX_storage_get_name ( smx_storage_t  storage)
sg_size_t SIMIX_storage_get_size ( smx_storage_t  storage)
const char* SIMIX_storage_get_host ( smx_storage_t  storage)
xbt_dict_t SIMIX_asr_get_properties ( const char *  name)
int simcall_mc_random ( int  min,
int  max 
)

Variable Documentation

char* smx_context_factory_name
int smx_context_stack_size
int smx_context_stack_size_was_set
int smx_context_guard_size
int smx_context_guard_size_was_set