X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c8880fd8bfe302109bdec0629929499479d714b0..ea8f841a468a3db03f1d74e8e92e2dfba3db6f3b:/src/simix/libsmx.c diff --git a/src/simix/libsmx.c b/src/simix/libsmx.c index 199f085502..ab101d1db2 100644 --- a/src/simix/libsmx.c +++ b/src/simix/libsmx.c @@ -5,51 +5,30 @@ /* */ /* This is somehow the "libc" of SimGrid */ -/* Copyright (c) 2010-2014. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2015. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ + * under the terms of the license (GNU LGPL) which comes with this package. */ +#include "src/mc/mc_replay.h" #include "smx_private.h" -#include "mc/mc_interface.h" +#include "src/mc/mc_forward.h" #include "xbt/ex.h" #include /* isfinite() */ +#include "mc/mc.h" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix); #include "popping_bodies.c" -/** - * \ingroup simix_host_management - * \brief Returns a host given its name. - * - * \param name The name of the host to get - * \return The corresponding host - */ -smx_host_t simcall_host_get_by_name(const char *name) -{ - return simcall_BODY_host_get_by_name(name); -} - -/** - * \ingroup simix_host_management - * \brief Returns the name of a host. - * - * \param host A SIMIX host - * \return The name of this host - */ -const char* simcall_host_get_name(smx_host_t host) -{ - return simcall_BODY_host_get_name(host); -} - /** * \ingroup simix_host_management * \brief Start the host if it is off * * \param host A SIMIX host */ -void simcall_host_on(smx_host_t host) +void simcall_host_on(sg_host_t host) { simcall_BODY_host_on(host); } @@ -60,7 +39,7 @@ void simcall_host_on(smx_host_t host) * * \param host A SIMIX host */ -void simcall_host_off(smx_host_t host) +void simcall_host_off(sg_host_t host) { simcall_BODY_host_off(host); } @@ -72,7 +51,7 @@ void simcall_host_off(smx_host_t host) * \param host A host * \return The properties of this host */ -xbt_dict_t simcall_host_get_properties(smx_host_t host) +xbt_dict_t simcall_host_get_properties(sg_host_t host) { return simcall_BODY_host_get_properties(host); } @@ -89,32 +68,6 @@ xbt_dict_t simcall_asr_get_properties(const char *name) return simcall_BODY_asr_get_properties(name); } - -/** - * \ingroup simix_host_management - * \brief Returns the speed of the processor. - * - * The speed returned does not take into account the current load on the machine. - * \param host A SIMIX host - * \return The speed of this host (in Mflop/s) - */ -double simcall_host_get_speed(smx_host_t host) -{ - return simcall_BODY_host_get_speed(host); -} - -/** - * \ingroup simix_host_management - * \brief Returns the number of core of the processor. - * - * \param host A SIMIX host - * \return The number of core - */ -int simcall_host_get_core(smx_host_t host) -{ - return simcall_BODY_host_get_core(host); -} - /** * \ingroup simix_host_management * \brief Returns the list of processes attached to the host. @@ -122,36 +75,11 @@ int simcall_host_get_core(smx_host_t host) * \param host A SIMIX host * \return the swag of attached processes */ -xbt_swag_t simcall_host_get_process_list(smx_host_t host) +xbt_swag_t simcall_host_get_process_list(sg_host_t host) { return simcall_BODY_host_get_process_list(host); } - -/** - * \ingroup simix_host_management - * \brief Returns the available speed of the processor. - * - * \return Speed currently available (in Mflop/s) - */ -double simcall_host_get_available_speed(smx_host_t host) -{ - return simcall_BODY_host_get_available_speed(host); -} - -/** - * \ingroup simix_host_management - * \brief Returns the state of a host. - * - * Two states are possible: 1 if the host is active or 0 if it has crashed. - * \param host A SIMIX host - * \return 1 if the host is available, 0 otherwise - */ -int simcall_host_get_state(smx_host_t host) -{ - return simcall_BODY_host_get_state(host); -} - /** * \ingroup simix_host_management * \brief Returns the power peak of a host. @@ -159,7 +87,7 @@ int simcall_host_get_state(smx_host_t host) * \param host A SIMIX host * \return the current power peak value (double) */ -double simcall_host_get_current_power_peak(smx_host_t host) +double simcall_host_get_current_power_peak(sg_host_t host) { return simcall_BODY_host_get_current_power_peak(host); } @@ -172,196 +100,185 @@ double simcall_host_get_current_power_peak(smx_host_t host) * \param pstate_index pstate to test * \return the current power peak value (double) for pstate_index */ -double simcall_host_get_power_peak_at(smx_host_t host, int pstate_index) +double simcall_host_get_power_peak_at(sg_host_t host, int pstate_index) { return simcall_BODY_host_get_power_peak_at(host, pstate_index); } /** * \ingroup simix_host_management - * \brief Returns the number of power states for a host. + * \brief Sets the pstate at which the host should run * * \param host A SIMIX host - * \return the number of power states + * \param pstate_index The pstate to which the CPU power will be set */ -int simcall_host_get_nb_pstates(smx_host_t host) +void simcall_host_set_pstate(sg_host_t host, int pstate_index) { - return simcall_BODY_host_get_nb_pstates(host); + simcall_BODY_host_set_pstate(host, pstate_index); } -/** - * \ingroup simix_host_management - * \brief Sets a new power peak for a host. - * - * \param host A SIMIX host - * \param pstate_index The pstate to which the CPU power will be set +/** \ingroup simix_host_management + * \brief Returns the amount of watt dissipated at the given pstate when the host is idling */ -void simcall_host_set_power_peak_at(smx_host_t host, int pstate_index) -{ - simcall_BODY_host_set_power_peak_at(host, pstate_index); +double simcall_host_get_wattmin_at(msg_host_t host, int pstate){ + return simcall_BODY_host_get_wattmin_at(host, pstate); } - -/** - * \ingroup simix_host_management - * \brief Returns the total energy consumed by the host (in Joules) - * - * \param host A SIMIX host - * \return the energy consumed by the host (double) +/** \ingroup simix_host_management + * \brief Returns the amount of watt dissipated at the given pstate when the host burns CPU at 100% */ -double simcall_host_get_consumed_energy(smx_host_t host) -{ - return simcall_BODY_host_get_consumed_energy(host); +double simcall_host_get_wattmax_at(msg_host_t host, int pstate){ + return simcall_BODY_host_get_wattmax_at(host, pstate); } + /** - * \ingroup simix_host_management + * \ingroup simix_process_management * \brief Creates a synchro that executes some computation of an host. * * This function creates a SURF action and allocates the data necessary * to create the SIMIX synchro. It can raise a host_error exception if the host crashed. * * \param name Name of the execution synchro to create - * \param host SIMIX host where the synchro will be executed - * \param computation_amount amount Computation amount (in bytes) + * \param flops_amount amount Computation amount (in flops) * \param priority computation priority * \param bound * \param affinity_mask * \return A new SIMIX execution synchronization */ -smx_synchro_t simcall_host_execute(const char *name, smx_host_t host, - double computation_amount, +smx_synchro_t simcall_process_execute(const char *name, + double flops_amount, double priority, double bound, unsigned long affinity_mask) { /* checking for infinite values */ - xbt_assert(isfinite(computation_amount), "computation_amount is not finite!"); + xbt_assert(isfinite(flops_amount), "flops_amount is not finite!"); xbt_assert(isfinite(priority), "priority is not finite!"); - return simcall_BODY_host_execute(name, host, computation_amount, priority, bound, affinity_mask); + return simcall_BODY_process_execute(name, flops_amount, priority, bound, affinity_mask); } /** - * \ingroup simix_host_management + * \ingroup simix_process_management * \brief Creates a synchro that may involve parallel computation on * several hosts and communication between them. * * \param name Name of the execution synchro to create * \param host_nb Number of hosts where the synchro will be executed * \param host_list Array (of size host_nb) of hosts where the synchro will be executed - * \param computation_amount Array (of size host_nb) of computation amount of hosts (in bytes) - * \param communication_amount Array (of size host_nb * host_nb) representing the communication + * \param flops_amount Array (of size host_nb) of computation amount of hosts (in bytes) + * \param bytes_amount Array (of size host_nb * host_nb) representing the communication * amount between each pair of hosts * \param amount the SURF action amount * \param rate the SURF action rate * \return A new SIMIX execution synchronization */ -smx_synchro_t simcall_host_parallel_execute(const char *name, +smx_synchro_t simcall_process_parallel_execute(const char *name, int host_nb, - smx_host_t *host_list, - double *computation_amount, - double *communication_amount, + sg_host_t *host_list, + double *flops_amount, + double *bytes_amount, double amount, double rate) { int i,j; /* checking for infinite values */ for (i = 0 ; i < host_nb ; ++i) { - xbt_assert(isfinite(computation_amount[i]), "computation_amount[%d] is not finite!", i); + xbt_assert(isfinite(flops_amount[i]), "flops_amount[%d] is not finite!", i); for (j = 0 ; j < host_nb ; ++j) { - xbt_assert(isfinite(communication_amount[i + host_nb * j]), - "communication_amount[%d+%d*%d] is not finite!", i, host_nb, j); + xbt_assert(isfinite(bytes_amount[i + host_nb * j]), + "bytes_amount[%d+%d*%d] is not finite!", i, host_nb, j); } } xbt_assert(isfinite(amount), "amount is not finite!"); xbt_assert(isfinite(rate), "rate is not finite!"); - return simcall_BODY_host_parallel_execute(name, host_nb, host_list, - computation_amount, - communication_amount, + return simcall_BODY_process_parallel_execute(name, host_nb, host_list, + flops_amount, + bytes_amount, amount, rate); } /** - * \ingroup simix_host_management + * \ingroup simix_process_management * \brief Destroys an execution synchro. * * Destroys a synchro, freeing its memory. This function cannot be called if there are a conditional waiting for it. * \param execution The execution synchro to destroy */ -void simcall_host_execution_destroy(smx_synchro_t execution) +void simcall_process_execution_destroy(smx_synchro_t execution) { - simcall_BODY_host_execution_destroy(execution); + simcall_BODY_process_execution_destroy(execution); } /** - * \ingroup simix_host_management + * \ingroup simix_process_management * \brief Cancels an execution synchro. * * This functions stops the execution. It calls a surf function. * \param execution The execution synchro to cancel */ -void simcall_host_execution_cancel(smx_synchro_t execution) +void simcall_process_execution_cancel(smx_synchro_t execution) { - simcall_BODY_host_execution_cancel(execution); + simcall_BODY_process_execution_cancel(execution); } /** - * \ingroup simix_host_management + * \ingroup simix_process_management * \brief Returns how much of an execution synchro remains to be done. * * \param execution The execution synchro * \return The remaining amount */ -double simcall_host_execution_get_remains(smx_synchro_t execution) +double simcall_process_execution_get_remains(smx_synchro_t execution) { - return simcall_BODY_host_execution_get_remains(execution); + return simcall_BODY_process_execution_get_remains(execution); } /** - * \ingroup simix_host_management + * \ingroup simix_process_management * \brief Returns the state of an execution synchro. * * \param execution The execution synchro * \return The state */ -e_smx_state_t simcall_host_execution_get_state(smx_synchro_t execution) +e_smx_state_t simcall_process_execution_get_state(smx_synchro_t execution) { - return simcall_BODY_host_execution_get_state(execution); + return simcall_BODY_process_execution_get_state(execution); } /** - * \ingroup simix_host_management + * \ingroup simix_process_management * \brief Changes the priority of an execution synchro. * * This functions changes the priority only. It calls a surf function. * \param execution The execution synchro * \param priority The new priority */ -void simcall_host_execution_set_priority(smx_synchro_t execution, double priority) +void simcall_process_execution_set_priority(smx_synchro_t execution, double priority) { /* checking for infinite values */ xbt_assert(isfinite(priority), "priority is not finite!"); - simcall_BODY_host_execution_set_priority(execution, priority); + simcall_BODY_process_execution_set_priority(execution, priority); } /** - * \ingroup simix_host_management + * \ingroup simix_process_management * \brief Changes the capping (the maximum CPU utilization) of an execution synchro. * * This functions changes the capping only. It calls a surf function. * \param execution The execution synchro * \param bound The new bound */ -void simcall_host_execution_set_bound(smx_synchro_t execution, double bound) +void simcall_process_execution_set_bound(smx_synchro_t execution, double bound) { - simcall_BODY_host_execution_set_bound(execution, bound); + simcall_BODY_process_execution_set_bound(execution, bound); } /** - * \ingroup simix_host_management + * \ingroup simix_process_management * \brief Changes the CPU affinity of an execution synchro. * * This functions changes the CPU affinity of an execution synchro. See taskset(1) on Linux. @@ -369,9 +286,9 @@ void simcall_host_execution_set_bound(smx_synchro_t execution, double bound) * \param host Host * \param mask Affinity mask */ -void simcall_host_execution_set_affinity(smx_synchro_t execution, smx_host_t host, unsigned long mask) +void simcall_process_execution_set_affinity(smx_synchro_t execution, sg_host_t host, unsigned long mask) { - simcall_BODY_host_execution_set_affinity(execution, host, mask); + simcall_BODY_process_execution_set_affinity(execution, host, mask); } /** @@ -380,9 +297,9 @@ void simcall_host_execution_set_affinity(smx_synchro_t execution, smx_host_t hos * * \param execution The execution synchro */ -e_smx_state_t simcall_host_execution_wait(smx_synchro_t execution) +e_smx_state_t simcall_process_execution_wait(smx_synchro_t execution) { - return simcall_BODY_host_execution_wait(execution); + return simcall_BODY_process_execution_wait(execution); } @@ -395,7 +312,7 @@ e_smx_state_t simcall_host_execution_wait(smx_synchro_t execution) * * \return The host object of the VM */ -void* simcall_vm_create(const char *name, smx_host_t phys_host){ +void* simcall_vm_create(const char *name, sg_host_t phys_host){ return simcall_BODY_vm_create(name, phys_host); } @@ -405,7 +322,7 @@ void* simcall_vm_create(const char *name, smx_host_t phys_host){ * * \param vm VM */ -void simcall_vm_start(smx_host_t vm) +void simcall_vm_start(sg_host_t vm) { simcall_BODY_vm_start(vm); } @@ -417,7 +334,7 @@ void simcall_vm_start(smx_host_t vm) * \param vm VM * \return The state of the VM */ -int simcall_vm_get_state(smx_host_t vm) +int simcall_vm_get_state(sg_host_t vm) { return simcall_BODY_vm_get_state(vm); } @@ -429,27 +346,27 @@ int simcall_vm_get_state(smx_host_t vm) * \param vm VM * \return The name of the physical host */ -void *simcall_vm_get_pm(smx_host_t vm) +void *simcall_vm_get_pm(sg_host_t vm) { return simcall_BODY_vm_get_pm(vm); } -void simcall_vm_set_bound(smx_host_t vm, double bound) +void simcall_vm_set_bound(sg_host_t vm, double bound) { simcall_BODY_vm_set_bound(vm, bound); } -void simcall_vm_set_affinity(smx_host_t vm, smx_host_t pm, unsigned long mask) +void simcall_vm_set_affinity(sg_host_t vm, sg_host_t pm, unsigned long mask) { simcall_BODY_vm_set_affinity(vm, pm, mask); } -void simcall_host_get_params(smx_host_t vm, ws_params_t params) +void simcall_host_get_params(sg_host_t vm, vm_params_t params) { simcall_BODY_host_get_params(vm, params); } -void simcall_host_set_params(smx_host_t vm, ws_params_t params) +void simcall_host_set_params(sg_host_t vm, vm_params_t params) { simcall_BODY_host_set_params(vm, params); } @@ -461,7 +378,7 @@ void simcall_host_set_params(smx_host_t vm, ws_params_t params) * \param vm VM * \param host Destination physical host */ -void simcall_vm_migrate(smx_host_t vm, smx_host_t host) +void simcall_vm_migrate(sg_host_t vm, sg_host_t host) { simcall_BODY_vm_migrate(vm, host); } @@ -472,7 +389,7 @@ void simcall_vm_migrate(smx_host_t vm, smx_host_t host) * * \param vm VM */ -void simcall_vm_suspend(smx_host_t vm) +void simcall_vm_suspend(sg_host_t vm) { simcall_BODY_vm_suspend(vm); } @@ -483,7 +400,7 @@ void simcall_vm_suspend(smx_host_t vm) * * \param vm VM */ -void simcall_vm_resume(smx_host_t vm) +void simcall_vm_resume(sg_host_t vm) { simcall_BODY_vm_resume(vm); } @@ -494,7 +411,7 @@ void simcall_vm_resume(smx_host_t vm) * * \param vm VM */ -void simcall_vm_save(smx_host_t vm) +void simcall_vm_save(sg_host_t vm) { simcall_BODY_vm_save(vm); } @@ -505,7 +422,7 @@ void simcall_vm_save(smx_host_t vm) * * \param vm VM */ -void simcall_vm_restore(smx_host_t vm) +void simcall_vm_restore(sg_host_t vm) { simcall_BODY_vm_restore(vm); } @@ -516,7 +433,7 @@ void simcall_vm_restore(smx_host_t vm) * * \param vm VM */ -void simcall_vm_shutdown(smx_host_t vm) +void simcall_vm_shutdown(sg_host_t vm) { simcall_BODY_vm_shutdown(vm); } @@ -527,11 +444,29 @@ void simcall_vm_shutdown(smx_host_t vm) * * \param vm VM */ -void simcall_vm_destroy(smx_host_t vm) +void simcall_vm_destroy(sg_host_t vm) { simcall_BODY_vm_destroy(vm); } +/** + * \ingroup simix_vm_management + * \brief 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 + * + * \param vm VM to migrate + * \param src_pm Source physical host + * \param dst_pmt Destination physical host + */ +void simcall_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm) +{ + simcall_BODY_vm_migratefrom_resumeto(vm, src_pm, dst_pm); +} /** * \ingroup simix_process_management @@ -539,7 +474,6 @@ void simcall_vm_destroy(smx_host_t vm) * * The structure and the corresponding thread are created and put in the list of ready processes. * - * \param process the process created will be stored in this pointer * \param name a name for the process. It is for user-level information and can be NULL. * \param code the main function of the process * \param data a pointer to any data one may want to attach to the new object. It is for user-level information and can be NULL. @@ -551,7 +485,7 @@ void simcall_vm_destroy(smx_host_t vm) * \param properties the properties of the process * \param auto_restart either it is autorestarting or not. */ -void simcall_process_create(smx_process_t *process, const char *name, +smx_process_t simcall_process_create(const char *name, xbt_main_func_t code, void *data, const char *hostname, @@ -560,7 +494,7 @@ void simcall_process_create(smx_process_t *process, const char *name, xbt_dict_t properties, int auto_restart) { - simcall_BODY_process_create(process, name, code, data, hostname, + return (smx_process_t) simcall_BODY_process_create(name, code, data, hostname, kill_time, argc, argv, properties, auto_restart); } @@ -606,9 +540,9 @@ void simcall_process_cleanup(smx_process_t process) * \param process the process to migrate * \param dest name of the new host */ -void simcall_process_change_host(smx_process_t process, smx_host_t dest) +void simcall_process_set_host(smx_process_t process, sg_host_t dest) { - simcall_BODY_process_change_host(process, dest); + simcall_BODY_process_set_host(process, dest); } void simcall_process_join(smx_process_t process, double timeout) @@ -727,8 +661,6 @@ void simcall_process_set_data(smx_process_t process, void *data) /** * \ingroup simix_process_management * \brief Set the kill time of a process. - * \param process a process - * \param kill_time a double */ void simcall_process_set_kill_time(smx_process_t process, double kill_time) { @@ -736,22 +668,29 @@ void simcall_process_set_kill_time(smx_process_t process, double kill_time) if (kill_time > SIMIX_get_clock()) { if (simix_global->kill_process_function) { XBT_DEBUG("Set kill time %f for process %s(%s)",kill_time, process->name, - sg_host_name(process->smx_host)); - SIMIX_timer_set(kill_time, simix_global->kill_process_function, process); + sg_host_name(process->host)); + process->kill_timer = SIMIX_timer_set(kill_time, simix_global->kill_process_function, process); } } } +/** + * \ingroup simix_process_management + * \brief Get the kill time of a process (or 0 if unset). + */ +double simcall_process_get_kill_time(smx_process_t process) { + return SIMIX_timer_get_date(process->kill_timer); +} /** * \ingroup simix_process_management * \brief Return the location on which an agent is running. * - * This functions returns the smx_host_t corresponding to the location on which + * This functions returns the sg_host_t corresponding to the location on which * \a process is running. * \param process SIMIX process * \return SIMIX host */ -smx_host_t simcall_process_get_host(smx_process_t process) +sg_host_t simcall_process_get_host(smx_process_t process) { return simcall_BODY_process_get_host(process); } @@ -886,7 +825,7 @@ smx_rdv_t simcall_rdv_get_by_name(const char *name) * \param host The host to be counted * \return The number of comm synchros pending in the rdv */ -int simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host) +int simcall_rdv_comm_count_by_host(smx_rdv_t rdv, sg_host_t host) { return simcall_BODY_rdv_comm_count_by_host(rdv, host); } @@ -915,7 +854,7 @@ smx_process_t simcall_rdv_get_receiver(smx_rdv_t rdv) /** * \ingroup simix_comm_management */ -void simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, +void simcall_comm_send(smx_process_t sender, smx_rdv_t rdv, 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, @@ -928,16 +867,16 @@ void simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, doubl xbt_assert(rdv, "No rendez-vous point defined for send"); - if (MC_is_active()) { + if (MC_is_active() || MC_record_replay_is_active()) { /* the model-checker wants two separate simcalls */ smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */ - comm = simcall_comm_isend(src, rdv, task_size, rate, + comm = simcall_comm_isend(sender, rdv, task_size, rate, src_buff, src_buff_size, match_fun, NULL, copy_data_fun, data, 0); simcall_comm_wait(comm, timeout); comm = NULL; } else { - simcall_BODY_comm_send(src, rdv, task_size, rate, src_buff, src_buff_size, + simcall_BODY_comm_send(sender, rdv, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout); } } @@ -945,7 +884,7 @@ void simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, doubl /** * \ingroup simix_comm_management */ -smx_synchro_t simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, +smx_synchro_t simcall_comm_isend(smx_process_t sender, smx_rdv_t rdv, 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 *), @@ -959,7 +898,7 @@ smx_synchro_t simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_s xbt_assert(rdv, "No rendez-vous point defined for isend"); - return simcall_BODY_comm_isend(src, rdv, task_size, rate, src_buff, + return simcall_BODY_comm_isend(sender, rdv, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached); } @@ -967,7 +906,7 @@ smx_synchro_t simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_s /** * \ingroup simix_comm_management */ -void simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, +void simcall_comm_recv(smx_process_t receiver, smx_rdv_t rdv, 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) @@ -975,30 +914,30 @@ void simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, xbt_assert(isfinite(timeout), "timeout is not finite!"); xbt_assert(rdv, "No rendez-vous point defined for recv"); - if (MC_is_active()) { + if (MC_is_active() || MC_record_replay_is_active()) { /* the model-checker wants two separate simcalls */ smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */ - comm = simcall_comm_irecv(rdv, dst_buff, dst_buff_size, + comm = simcall_comm_irecv(receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); simcall_comm_wait(comm, timeout); comm = NULL; } else { - simcall_BODY_comm_recv(rdv, dst_buff, dst_buff_size, + simcall_BODY_comm_recv(receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate); } } /** * \ingroup simix_comm_management */ -smx_synchro_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, +smx_synchro_t simcall_comm_irecv(smx_process_t receiver, smx_rdv_t rdv, 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) { xbt_assert(rdv, "No rendez-vous point defined for irecv"); - return simcall_BODY_comm_irecv(rdv, dst_buff, dst_buff_size, + return simcall_BODY_comm_irecv(receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); } @@ -1048,7 +987,6 @@ void simcall_comm_wait(smx_synchro_t comm, double timeout) simcall_BODY_comm_wait(comm, timeout); } -#ifdef HAVE_TRACING /** * \brief Set the category of an synchro. * @@ -1063,7 +1001,6 @@ void simcall_set_category(smx_synchro_t synchro, const char *category) } simcall_BODY_set_category(synchro, category); } -#endif /** * \ingroup simix_comm_management @@ -1309,7 +1246,7 @@ int simcall_sem_get_capacity(smx_sem_t sem) * \ingroup simix_file_management * */ -sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size, smx_host_t host) +sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size, sg_host_t host) { return simcall_BODY_file_read(fd, size, host); } @@ -1318,7 +1255,7 @@ sg_size_t simcall_file_read(smx_file_t fd, sg_size_t size, smx_host_t host) * \ingroup simix_file_management * */ -sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size, smx_host_t host) +sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size, sg_host_t host) { return simcall_BODY_file_write(fd, size, host); } @@ -1327,7 +1264,7 @@ sg_size_t simcall_file_write(smx_file_t fd, sg_size_t size, smx_host_t host) * \ingroup simix_file_management * \brief */ -smx_file_t simcall_file_open(const char* fullpath, smx_host_t host) +smx_file_t simcall_file_open(const char* fullpath, sg_host_t host) { return simcall_BODY_file_open(fullpath, host); } @@ -1336,7 +1273,7 @@ smx_file_t simcall_file_open(const char* fullpath, smx_host_t host) * \ingroup simix_file_management * */ -int simcall_file_close(smx_file_t fd, smx_host_t host) +int simcall_file_close(smx_file_t fd, sg_host_t host) { return simcall_BODY_file_close(fd, host); } @@ -1345,7 +1282,7 @@ int simcall_file_close(smx_file_t fd, smx_host_t host) * \ingroup simix_file_management * */ -int simcall_file_unlink(smx_file_t fd, smx_host_t host) +int simcall_file_unlink(smx_file_t fd, sg_host_t host) { return simcall_BODY_file_unlink(fd, host); } @@ -1419,7 +1356,7 @@ sg_size_t simcall_storage_get_used_size (smx_storage_t storage){ * \param host A SIMIX host * \return a dict containing all storages mounted on the host */ -xbt_dict_t simcall_host_get_mounted_storage_list(smx_host_t host) +xbt_dict_t simcall_host_get_mounted_storage_list(sg_host_t host) { return simcall_BODY_host_get_mounted_storage_list(host); } @@ -1430,7 +1367,7 @@ xbt_dict_t simcall_host_get_mounted_storage_list(smx_host_t host) * \param host A SIMIX host * \return a dict containing all storages attached to the host */ -xbt_dynar_t simcall_host_get_attached_storage_list(smx_host_t host) +xbt_dynar_t simcall_host_get_attached_storage_list(sg_host_t host) { return simcall_BODY_host_get_attached_storage_list(host); } @@ -1471,12 +1408,12 @@ int simcall_mc_compare_snapshots(void *s1, void *s2) { return simcall_BODY_mc_compare_snapshots(s1, s2); } +#endif /* HAVE_MC */ + int simcall_mc_random(int min, int max) { return simcall_BODY_mc_random(min, max); } -#endif /* HAVE_MC */ - /* ************************************************************************** */ /** @brief returns a printable string representing a simcall */