Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] at the end of tracing, dump everything up to last simulated time
[simgrid.git] / src / instr / instr_paje_trace.c
index cf28231..285f951 100644 (file)
@@ -168,10 +168,16 @@ void TRACE_paje_end(void)
   DEBUG1("Filename %s is closed", filename);
 }
 
+double TRACE_last_timestamp_to_dump = 0;
+//dumps the trace file until the timestamp TRACE_last_timestamp_to_dump
 void TRACE_paje_dump_buffer (void)
 {
   paje_event_t event;
   while (xbt_dynar_length (buffer) > 0){
+    double head_timestamp = (*(paje_event_t*)xbt_dynar_get_ptr(buffer, 0))->timestamp;
+    if (head_timestamp > TRACE_last_timestamp_to_dump){
+      break;
+    }
     xbt_dynar_remove_at (buffer, 0, &event);
     event->print (event);
     event->free (event);
@@ -839,21 +845,5 @@ void new_pajeNewEvent (double timestamp, container_t container, type_t type, con
 
   insert_into_buffer (event);
 }
-//
-//void pajeNewEvent(double time, const char *entityType,
-//                  const char *container, const char *value)
-//{
-//  INSTR_PAJE_ASSERT(entityType);
-//  INSTR_PAJE_ASSERT(container);
-//  INSTR_PAJE_ASSERT(value);
-//
-//  if (time == 0){
-//    fprintf(tracing_file, "%d 0 %s %s %s\n", pajeNewEventId,
-//          entityType, container, value);
-//  }else{
-//    fprintf(tracing_file, "%d %lf %s %s %s\n", pajeNewEventId, time,
-//          entityType, container, value);
-//  }
-//}
 
 #endif /* HAVE_TRACING */