From: mquinson Date: Wed, 15 Jul 2009 16:38:07 +0000 (+0000) Subject: Only sleep to handle real computation if the time to sleep is large enough; do not... X-Git-Tag: SVN~1141 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/606955dcf8fe80ad56c207e68de88de0b7b8b58b Only sleep to handle real computation if the time to sleep is large enough; do not protect the access to the timer by mutex: there is no concurency in simgrid git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6507 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/smpi/private.h b/src/smpi/private.h index e3ffb899cf..bfb38ef0b0 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -91,7 +91,6 @@ typedef struct smpi_global_t { smx_process_t *main_processes; xbt_os_timer_t timer; - smx_mutex_t timer_mutex; smx_cond_t timer_cond; // keeps track of previous times diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index 51731ecae1..cc81f08ebb 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -12,6 +12,9 @@ void smpi_execute(double duration) smx_action_t action; e_surf_action_state_t state; + if (duration < 0.001) + return; + DEBUG1("Sleep for %f to handle real computation time",duration); SIMIX_mutex_lock(mutex); action = @@ -35,7 +38,6 @@ void smpi_execute(double duration) void smpi_start_timer() { - SIMIX_mutex_lock(smpi_global->timer_mutex); xbt_os_timer_start(smpi_global->timer); } @@ -44,7 +46,6 @@ double smpi_stop_timer() double duration; xbt_os_timer_stop(smpi_global->timer); duration = xbt_os_timer_elapsed(smpi_global->timer); - SIMIX_mutex_unlock(smpi_global->timer_mutex); return duration; } diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index c5c0e437f2..f604a9bc82 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -168,7 +168,6 @@ void smpi_global_init() // timers smpi_global->timer = xbt_os_timer_new(); - smpi_global->timer_mutex = SIMIX_mutex_init(); smpi_global->timer_cond = SIMIX_cond_init(); smpi_global->do_once_duration_nodes = NULL; @@ -231,7 +230,6 @@ void smpi_global_destroy() xbt_mallocator_free(smpi_global->message_mallocator); xbt_os_timer_free(smpi_global->timer); - SIMIX_mutex_destroy(smpi_global->timer_mutex); SIMIX_cond_destroy(smpi_global->timer_cond); for (curr = smpi_global->do_once_duration_nodes; NULL != curr; curr = next) {