Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
please codacy
[simgrid.git] / src / instr / instr_paje_trace.cpp
index 3a61d20..8c1aa94 100644 (file)
@@ -120,9 +120,9 @@ static void print_timestamp(PajeEvent* event) {
   /* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */
   if (event->timestamp < 1e-12)
     stream << 0;
-  else 
+  else
     stream << event->timestamp;
-}  
+}
 
 /* internal do the instrumentation module */
 static void insert_into_buffer (PajeEvent* tbi)
@@ -217,18 +217,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;
+  }
   //--
 }
 
@@ -258,9 +256,6 @@ if (instr_fmt_type == instr_fmt_paje) {
 
 void LogStateTypeDefinition(type_t type)
 {
-
-  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineStateType);
-
   //print it
 if (instr_fmt_type == instr_fmt_paje) {
     XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineStateType, TRACE_precision(), 0.);
@@ -276,24 +271,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) {
@@ -325,7 +309,6 @@ void LogEntityValue (val_t value)
   XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineEntityValue);
   //print it
 if (instr_fmt_type == instr_fmt_paje) {
-    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineEntityValue, TRACE_precision(),0.);
     stream << std::fixed << std::setprecision(TRACE_precision());
     stream << PAJE_DefineEntityValue;
     stream << " " << value->id << " " << value->father->id << " " << value->name;
@@ -347,17 +330,16 @@ void LogContainerCreation (container_t container)
   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, PAJE_CreateContainer,timestamp);
 
 if (instr_fmt_type == instr_fmt_paje) {
-    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_CreateContainer, TRACE_precision(), timestamp);
     stream << std::fixed << std::setprecision(TRACE_precision());
     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) {
@@ -399,15 +381,14 @@ void LogContainerDestruction(container_t container)
   XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, PAJE_DestroyContainer, timestamp);
 
 if (instr_fmt_type == instr_fmt_paje) {
-    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DestroyContainer, TRACE_precision(), timestamp);
     stream << std::fixed << std::setprecision(TRACE_precision());
     stream << PAJE_DestroyContainer;
     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;
+    else
+      stream << timestamp;
     stream << " " << container->type->id << " " << container->id;
     print_row();
   } else if (instr_fmt_type == instr_fmt_TI) {
@@ -773,7 +754,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() {