Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] only CPU models control the last timestamp to be dumped to trace file
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 29 Dec 2010 11:38:03 +0000 (11:38 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 29 Dec 2010 11:38:03 +0000 (11:38 +0000)
details:
- for CPU model Cas01_fullupdate, it is safe to set TRACE_last_timestamp_to_dump to now-delta
- for CPU model Cas01, the last timestamp to be dumped must be equal
to the smaller cpu->last_update among all cpu resources
- for now, network models depend on cpu models to dump their events
       => if a simulator is configured to have only a network model, without
       an instrumented cpu model (or without a cpu model at all), the
       dump will occur only in the end of simulation.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9331 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/cpu.c
src/surf/cpu_im.c

index 4a56bfc..b977e50 100644 (file)
@@ -214,6 +214,7 @@ static void cpu_update_actions_state(double now, double delta)
                                     lmm_variable_getvalue
                                     (action->variable), now - delta,
                                     delta);
+    TRACE_last_timestamp_to_dump = now-delta;
 #endif
     double_update(&(action->generic_action.remains),
                   lmm_variable_getvalue(action->variable) * delta);
index 093b626..e2680c1 100644 (file)
@@ -345,6 +345,28 @@ static void cpu_im_update_actions_state(double now, double delta)
     cpu_im_cpu_action_state_set((surf_action_t) action, SURF_ACTION_DONE);
     cpu_im_update_remains(action->cpu, surf_get_clock());
   }
+#ifdef HAVE_TRACING
+  {
+    //defining the last timestamp that we can safely dump to trace file
+    //without losing the event ascending order (considering all CPU's)
+    cpu_Cas01_im_t cpu;
+    xbt_dict_cursor_t cursor;
+    char *key;
+    double smaller = -1;
+    xbt_dict_foreach(surf_model_resource_set(surf_cpu_model), cursor, key, cpu){
+      if (smaller < 0){
+        smaller = cpu->last_update;
+        continue;
+      }
+      if (cpu->last_update < smaller){
+        smaller = cpu->last_update;
+      }
+    }
+    if (smaller > 0) {
+      TRACE_last_timestamp_to_dump = smaller;
+    }
+  }
+#endif
   return;
 }