Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of github.com:simgrid/simgrid
[simgrid.git] / src / instr / instr_paje_trace.cpp
index 2676cd1..cfaf78f 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "src/instr/instr_private.h"
 #include "src/instr/instr_smpi.h"
-#include "src/smpi/private.hpp"
+#include "src/smpi/include/private.hpp"
 #include "typeinfo"
 #include "xbt/virtu.h" /* sg_cmdline */
 #include "simgrid/sg_config.h"
@@ -27,12 +27,6 @@ FILE *tracing_file = nullptr;
 static xbt_dict_t tracing_files = nullptr; // TI specific
 static double prefix=0.0; // TI specific
 
-
-void print_NULL(PajeEvent* event){}
-
-/* The active set of functions for the selected trace format
- * By default, they all do nothing, hence the print_NULL to avoid segfaults */
-
 std::vector<PajeEvent*> buffer;
 void buffer_debug(std::vector<PajeEvent*> *buf);
 
@@ -160,20 +154,6 @@ PajeEvent:: ~PajeEvent()
 {
   XBT_DEBUG("%s not implemented for %p: event_type=%d, timestamp=%f", __FUNCTION__,
       this, (int)event_type, timestamp);
-//  xbt_backtrace_display_current();
-
- /* switch (event->event_type){
-  case PAJE_StartLink:
-    xbt_free (((startLink_t)(event->data))->value);
-    xbt_free (((startLink_t)(event->data))->key);
-    break;
-  case PAJE_EndLink:
-    xbt_free (((endLink_t)(event->data))->value);
-    xbt_free (((endLink_t)(event->data))->key);
-    break;
-  default:
-    break;
-  }*/
 }
 
 void TRACE_paje_start() {
@@ -217,18 +197,16 @@ void DefineContainerEvent(type_t type)
   XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineContainerType);
   //print it
   if (instr_fmt_type == instr_fmt_paje) {
-               XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineContainerType, TRACE_precision(), 0.);
-               stream << std::fixed << std::setprecision(TRACE_precision());
-               stream << PAJE_DefineContainerType;
-               stream << " " << type->id
-                               << " " << type->father->id
-                               << " " << type->name;
-               print_row();
-       } else if (instr_fmt_type == instr_fmt_TI) {
-               /* Nothing to do */
-       } else {
-               THROW_IMPOSSIBLE;
-       }
+    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineContainerType, TRACE_precision(), 0.);
+    stream << std::fixed << std::setprecision(TRACE_precision());
+    stream << PAJE_DefineContainerType;
+    stream << " " << type->id << " " << type->father->id << " " << type->name;
+    print_row();
+  } else if (instr_fmt_type == instr_fmt_TI) {
+    /* Nothing to do */
+  } else {
+    THROW_IMPOSSIBLE;
+  }
   //--
 }
 
@@ -273,24 +251,13 @@ if (instr_fmt_type == instr_fmt_paje) {
 }
 
 
-DefineEventTypeEvent::DefineEventTypeEvent(type_t type)
+void LogDefineEventType(type_t type)
 {
-  this->event_type                        = PAJE_DefineEventType;
-  this->timestamp                         = 0;
-  this->type = type;
-
-  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
   //print it
-  print();
-}
-
-
-void DefineEventTypeEvent::print() {
   if (instr_fmt_type == instr_fmt_paje) {
-    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineEventType, TRACE_precision(), 0.);
     stream << std::fixed << std::setprecision(TRACE_precision());
-    stream << (int)this->event_type;
+    stream << PAJE_DefineEventType;
     stream << " " << type->id << " " << type->father->id << " " << type->name;
     print_row();
   } else if (instr_fmt_type == instr_fmt_TI) {
@@ -347,12 +314,12 @@ if (instr_fmt_type == instr_fmt_paje) {
     stream << PAJE_CreateContainer;
     stream << " ";
   /* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */
-     if (timestamp < 1e-12)
-         stream << 0;
-      else 
-         stream << timestamp;
-         stream << " " << container->id << " " << container->type->id << " " << container->father->id << " \""
-            << container->name << "\"";
+    if (timestamp < 1e-12)
+      stream << 0;
+    else
+      stream << timestamp;
+    stream << " " << container->id << " " << container->type->id << " " << container->father->id << " \""
+           << container->name << "\"";
 
     print_row();
   } else if (instr_fmt_type == instr_fmt_TI) {
@@ -400,8 +367,8 @@ if (instr_fmt_type == instr_fmt_paje) {
   /* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */
     if (timestamp < 1e-12)
         stream << 0;
-    else 
-        stream << timestamp;
+    else
+      stream << timestamp;
     stream << " " << container->type->id << " " << container->id;
     print_row();
   } else if (instr_fmt_type == instr_fmt_TI) {
@@ -767,7 +734,7 @@ ResetStateEvent::ResetStateEvent (double timestamp, container_t container, type_
   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
 
   insert_into_buffer (this);
-       delete [] this;
+  delete[] this;
 }
 
 void ResetStateEvent::print() {