Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Only sleep to handle real computation if the time to sleep is large enough; do not...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 15 Jul 2009 16:38:07 +0000 (16:38 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 15 Jul 2009 16:38:07 +0000 (16:38 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6507 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/smpi/private.h
src/smpi/smpi_bench.c
src/smpi/smpi_global.c

index e3ffb89..bfb38ef 100644 (file)
@@ -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
index 51731ec..cc81f08 100644 (file)
@@ -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;
 }
 
index c5c0e43..f604a9b 100644 (file)
@@ -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) {