X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a2dfa0431968bb948e2472de7aaeb26a28ad448a..2703e1ee2a79e9fc7c86ebb122caa515ecf24d14:/src/simix/smx_user.c diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index bfc9a3ec86..06c52c9cb8 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -277,55 +277,154 @@ e_smx_state_t simcall_host_execution_wait(smx_action_t execution) /** * \ingroup simix_vm_management - * \brief Returns a dict of the properties assigned to a host. + * \brief Create a VM on the given physical host. * - * \param host A host - * \return The properties of this host + * \param name VM name + * \param host Physical host + * + * \return The host object of the VM + */ +void* simcall_vm_create(const char *name, smx_host_t phys_host){ + /* will jump to SIMIX_pre_vm_create() in src/simix/smx_smurf_private.h */ + return simcall_BODY_vm_create(name, phys_host); +} + +/** + * \ingroup simix_vm_management + * \brief Start the given VM to the given physical host + * + * \param vm VM + */ +void simcall_vm_start(smx_host_t vm) +{ + /* will jump to SIMIX_pre_vm_start in src/simix/smx_smurf_private.h */ + simcall_BODY_vm_start(vm); +} + +/** + * \ingroup simix_vm_management + * \brief Get the state of the given VM + * + * \param vm VM + * \return The state of the VM */ -void* simcall_vm_ws_create(const char *name, smx_host_t phys_host){ - return simcall_BODY_vm_ws_create(name, phys_host); +int simcall_vm_get_state(smx_host_t vm) +{ + /* will jump to SIMIX_pre_vm_get_state in src/simix/smx_smurf_private.h */ + return simcall_BODY_vm_get_state(vm); } -void simcall_vm_start(smx_host_t vm) { - simcall_BODY_set_vm_state(vm, msg_vm_state_running); +/** + * \ingroup simix_vm_management + * \brief Get the name of the physical host on which the given VM runs. + * + * \param vm VM + * \return The name of the physical host + */ +void *simcall_vm_get_pm(smx_host_t vm) +{ + /* will jump to SIMIX_pre_vm_migrate in src/simix/smx_smurf_private.h */ + return simcall_BODY_vm_get_pm(vm); } -void simcall_vm_migrate(smx_host_t vm, smx_host_t dst_phys) +void simcall_host_get_params(smx_host_t vm, ws_params_t params) { - /* will jump to SIMIX_pre_vm_migrate */ - simcall_BODY_vm_migrate(vm, dst_phys); + /* will jump to SIMIX_pre_host_get_params in src/simix/smx_smurf_private.h */ + simcall_BODY_host_get_params(vm, params); } +void simcall_host_set_params(smx_host_t vm, ws_params_t params) +{ + /* will jump to SIMIX_pre_host_set_params in src/simix/smx_smurf_private.h */ + simcall_BODY_host_set_params(vm, params); +} + +/** + * \ingroup simix_vm_management + * \brief Migrate the given VM to the given physical host + * + * \param vm VM + * \param host Destination physical host + */ +void simcall_vm_migrate(smx_host_t vm, smx_host_t host) +{ + /* will jump to SIMIX_pre_vm_migrate in src/simix/smx_smurf_private.h */ + simcall_BODY_vm_migrate(vm, host); +} + +/** + * \ingroup simix_vm_management + * \brief Suspend the given VM + * + * \param vm VM + */ void simcall_vm_suspend(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_suspend */ + /* will jump to SIMIX_pre_vm_suspend in src/simix/smx_smurf_private.h */ simcall_BODY_vm_suspend(vm); } +/** + * \ingroup simix_vm_management + * \brief Resume the given VM + * + * \param vm VM + */ void simcall_vm_resume(smx_host_t vm) { - /* - * simcall_BODY_ is defined in src/simix/smx_smurf_private.h. - * This function will jump to SIMIX_pre_vm_resume. - **/ + /* will jump to SIMIX_pre_vm_resume in src/simix/smx_smurf_private.h */ simcall_BODY_vm_resume(vm); } +/** + * \ingroup simix_vm_management + * \brief Save the given VM + * + * \param vm VM + */ +void simcall_vm_save(smx_host_t vm) +{ + /* will jump to SIMIX_pre_vm_save in src/simix/smx_smurf_private.h */ + simcall_BODY_vm_save(vm); +} + +/** + * \ingroup simix_vm_management + * \brief Restore the given VM + * + * \param vm VM + */ +void simcall_vm_restore(smx_host_t vm) +{ + /* will jump to SIMIX_pre_vm_restore in src/simix/smx_smurf_private.h */ + simcall_BODY_vm_restore(vm); +} + +/** + * \ingroup simix_vm_management + * \brief Shutdown the given VM + * + * \param vm VM + */ void simcall_vm_shutdown(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_shutdown */ + /* will jump to SIMIX_pre_vm_shutdown in src/simix/smx_smurf_private.h */ simcall_BODY_vm_shutdown(vm); } +/** + * \ingroup simix_vm_management + * \brief Destroy the given VM + * + * \param vm VM + */ void simcall_vm_destroy(smx_host_t vm) { - /* - * simcall_BODY_ is defined in src/simix/smx_smurf_private.h. - * This function will jump to SIMIX_pre_vm_destroy. - **/ + /* will jump to SIMIX_pre_vm_destroy in src/simix/smx_smurf_private.h */ simcall_BODY_vm_destroy(vm); } + /** * \ingroup simix_process_management * \brief Creates and runs a new SIMIX process. @@ -659,7 +758,7 @@ smx_rdv_t simcall_rdv_get_by_name(const char *name) { xbt_assert(name != NULL, "Invalid parameter for simcall_rdv_get_by_name (name is NULL)"); - /* FIXME: this is a horrible lost of performance, so we hack it out by + /* FIXME: this is a horrible loss of performance, so we hack it out by * skipping the simcall (for now). It works in parallel, it won't work on * distributed but probably we will change MSG for that. */ @@ -787,6 +886,39 @@ smx_action_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_ } +/** + * \ingroup simix_comm_management + */ +void simcall_comm_recv_bounded(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, + int (*match_fun)(void *, void *, smx_action_t), void *data, double timeout, double rate) +{ + xbt_assert(isfinite(timeout), "timeout is not finite!"); + xbt_assert(rdv, "No rendez-vous point defined for recv"); + + if (MC_is_active()) { + /* the model-checker wants two separate simcalls */ + smx_action_t comm = simcall_comm_irecv_bounded(rdv, dst_buff, dst_buff_size, + match_fun, data, rate); + simcall_comm_wait(comm, timeout); + } + else { + simcall_BODY_comm_recv_bounded(rdv, dst_buff, dst_buff_size, + match_fun, data, timeout, rate); + } +} +/** + * \ingroup simix_comm_management + */ +smx_action_t simcall_comm_irecv_bounded(smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, + int (*match_fun)(void *, void *, smx_action_t), void *data, double rate) +{ + xbt_assert(rdv, "No rendez-vous point defined for irecv"); + + return simcall_BODY_comm_irecv_bounded(rdv, dst_buff, dst_buff_size, + match_fun, data, rate); +} + + /** * \ingroup simix_comm_management */ @@ -1180,6 +1312,12 @@ int simcall_mc_compare_snapshots(void *s1, void *s2){ return simcall_BODY_mc_compare_snapshots(s1, s2); } +int simcall_mc_random(void) +{ + return simcall_BODY_mc_random(); +} + + #endif /* HAVE_MC */ /* ****************************************************************************************** */