X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/91a05dfa0e388fbb8e4fb140bbddb7a1c42d7fd0..db82f9e75280108116a8e70d2e7a163080020d29:/src/simix/smx_user.c diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 016f7abd8a..2b09caa21e 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -147,13 +147,13 @@ void simcall_host_set_data(smx_host_t host, void *data) smx_action_t simcall_host_execute(const char *name, smx_host_t host, double computation_amount, - double priority) + double priority, double bound) { /* checking for infinite values */ xbt_assert(isfinite(computation_amount), "computation_amount is not finite!"); xbt_assert(isfinite(priority), "priority is not finite!"); - return simcall_BODY_host_execute(name, host, computation_amount, priority); + return simcall_BODY_host_execute(name, host, computation_amount, priority, bound); } /** @@ -263,6 +263,19 @@ void simcall_host_execution_set_priority(smx_action_t execution, double priority simcall_BODY_host_execution_set_priority(execution, priority); } +/** + * \ingroup simix_host_management + * \brief Changes the capping (the maximum CPU utilization) of an execution action. + * + * This functions changes the capping only. It calls a surf function. + * \param execution The execution action + * \param bound The new bound + */ +void simcall_host_execution_set_bound(smx_action_t execution, double bound) +{ + simcall_BODY_host_execution_set_bound(execution, bound); +} + /** * \ingroup simix_host_management * \brief Waits for the completion of an execution action and destroy it. @@ -277,61 +290,160 @@ 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_ws_create(const char *name, smx_host_t phys_host){ - return simcall_BODY_vm_ws_create(name, phys_host); +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); } -void simcall_vm_start(smx_host_t vm) { - simcall_BODY_set_vm_state(vm, msg_vm_state_running); +/** + * \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); } -void simcall_vm_migrate(smx_host_t vm, smx_host_t dst_phys) +/** + * \ingroup simix_vm_management + * \brief Get the state of the given VM + * + * \param vm VM + * \return The state of the VM + */ +int simcall_vm_get_state(smx_host_t vm) { - /* will jump to SIMIX_pre_vm_migrate */ - simcall_BODY_vm_migrate(vm, dst_phys); + /* will jump to SIMIX_pre_vm_get_state in src/simix/smx_smurf_private.h */ + return simcall_BODY_vm_get_state(vm); } -const char *simcall_vm_get_phys_host(smx_host_t vm) +/** + * \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 */ - simcall_BODY_vm_get_phys_host(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_set_bound(smx_host_t vm, double bound) +{ + /* will jump to SIMIX_pre_vm_set_bound in src/simix/smx_smurf_private.h */ + simcall_BODY_vm_set_bound(vm, bound); +} + +void simcall_host_get_params(smx_host_t vm, ws_params_t params) +{ + /* 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. @@ -665,7 +777,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. */ @@ -793,6 +905,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 */ @@ -1186,6 +1331,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 */ /* ****************************************************************************************** */