X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2acec8bc88bd643a4c60f183ba50c50c11a9d5c4..fa5821e46784328e7e2a71843e124254e8141d11:/src/smpi/smpi_bench.c diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index 9bd1f19aa9..b43a1280f7 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -5,45 +5,28 @@ void smpi_bench_begin() { - int index = smpi_host_index(); - - SIMIX_mutex_lock(smpi_global->timers_mutexes[index]); - - xbt_os_timer_start(smpi_global->timers[index]); - + SIMIX_mutex_lock(smpi_global->timer_mutex); + xbt_os_timer_start(smpi_global->timer); return; } void smpi_bench_end() { - int index = smpi_host_index(); double duration; smx_host_t host; char computation[] = "computation"; smx_action_t action; - smx_mutex_t mutex; - smx_cond_t cond; - - xbt_os_timer_stop(smpi_global->timers[index]); - - duration = xbt_os_timer_elapsed(smpi_global->timers[index]); - - SIMIX_mutex_unlock(smpi_global->timers_mutexes[index]); - host = smpi_global->hosts[index]; - action = SIMIX_action_execute(host, computation, duration * SMPI_DEFAULT_SPEED); - mutex = SIMIX_mutex_init(); - cond = SIMIX_cond_init(); + xbt_os_timer_stop(smpi_global->timer); + duration = xbt_os_timer_elapsed(smpi_global->timer); + host = SIMIX_host_self(); + action = SIMIX_action_execute(host, computation, duration * SMPI_DEFAULT_SPEED); - SIMIX_mutex_lock(mutex); - SIMIX_register_action_to_condition(action, cond); - SIMIX_cond_wait(cond, mutex); - SIMIX_unregister_action_to_condition(action, cond); - SIMIX_mutex_unlock(mutex); + SIMIX_register_action_to_condition(action, smpi_global->timer_cond); + SIMIX_cond_wait(smpi_global->timer_cond, smpi_global->timer_mutex); + SIMIX_unregister_action_to_condition(action, smpi_global->timer_cond); - SIMIX_mutex_destroy(mutex); - SIMIX_cond_destroy(cond); - //SIMIX_action_destroy(action); + SIMIX_mutex_unlock(smpi_global->timer_mutex); return; }