Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
get methods and theirs print methods together
authorTakishipp <toufik.boubehziz@gmail.com>
Thu, 4 May 2017 10:21:33 +0000 (12:21 +0200)
committerTakishipp <toufik.boubehziz@gmail.com>
Thu, 4 May 2017 10:21:33 +0000 (12:21 +0200)
src/instr/instr_TI_trace.cpp
src/instr/instr_paje_trace.cpp
src/instr/instr_trace.cpp [deleted file]
src/xbt/log.c
tools/cmake/DefinePackages.cmake

index 1b191e0..c6e7ea8 100644 (file)
@@ -16,7 +16,7 @@
 #include <direct.h> // _mkdir
 #endif
 
 #include <direct.h> // _mkdir
 #endif
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_TI_trace, instr_trace, "tracing event system");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_TI_trace, instr, "tracing event system");
 
 extern FILE *tracing_file;
 double prefix=0.0;
 
 extern FILE *tracing_file;
 double prefix=0.0;
index 6e6f7fa..3e92c07 100644 (file)
@@ -5,18 +5,89 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/instr/instr_private.h"
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/instr/instr_private.h"
+#include "src/instr/instr_smpi.h"
+#include "src/smpi/private.hpp"
+#include "typeinfo"
 #include "xbt/virtu.h" /* sg_cmdline */
 #include <sstream>
 #include <vector>
 #include <iomanip> /** std::setprecision **/
 #include "simgrid/sg_config.h"
 
 #include "xbt/virtu.h" /* sg_cmdline */
 #include <sstream>
 #include <vector>
 #include <iomanip> /** std::setprecision **/
 #include "simgrid/sg_config.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_trace, instr_trace, "tracing event system");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_trace, instr, "tracing event system");
 
 extern FILE * tracing_file;
 extern s_instr_trace_writer_t active_writer;
 
 static std::stringstream stream;
 
 extern FILE * tracing_file;
 extern s_instr_trace_writer_t active_writer;
 
 static std::stringstream stream;
+FILE *tracing_file = nullptr;
+
+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 */
+
+s_instr_trace_writer_t active_writer = {&print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL,
+                                        &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL,
+                                        &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL};
+
+std::vector<PajeEvent*> buffer;
+void buffer_debug(std::vector<PajeEvent*> *buf);
+
+void dump_comment (const char *comment)
+{
+  if (!strlen(comment)) return;
+  fprintf (tracing_file, "# %s\n", comment);
+}
+
+void dump_comment_file (const char *filename)
+{
+  if (!strlen(filename)) return;
+  FILE *file = fopen (filename, "r");
+  if (!file){
+    THROWF (system_error, 1, "Comment file %s could not be opened for reading.", filename);
+  }
+  while (!feof(file)){
+    char c;
+    c = fgetc(file);
+    if (feof(file)) break;
+    fprintf (tracing_file, "# ");
+    while (c != '\n'){
+      fprintf (tracing_file, "%c", c);
+      c = fgetc(file);
+      if (feof(file)) break;
+    }
+    fprintf (tracing_file, "\n");
+  }
+  fclose(file);
+}
+
+double TRACE_last_timestamp_to_dump = 0;
+//dumps the trace file until the timestamp TRACE_last_timestamp_to_dump
+void TRACE_paje_dump_buffer (int force)
+{
+  if (!TRACE_is_enabled()) return;
+  XBT_DEBUG("%s: dump until %f. starts", __FUNCTION__, TRACE_last_timestamp_to_dump);
+  if (force){
+    for (auto event : buffer){
+      event->print();
+      delete event;
+    }
+    buffer.clear();
+  }else{
+    std::vector<PajeEvent*>::iterator i = buffer.begin();
+    for (auto event :buffer){
+      double head_timestamp = event->timestamp;
+      if (head_timestamp > TRACE_last_timestamp_to_dump)
+        break;
+      event->print();
+      delete event;
+      ++i;
+    }
+    buffer.erase(buffer.begin(), i);
+  }
+  XBT_DEBUG("%s: ends", __FUNCTION__);
+}
 
 void buffer_debug(std::vector<PajeEvent*> *buf);
 void buffer_debug(std::vector<PajeEvent*> *buf) {
 
 void buffer_debug(std::vector<PajeEvent*> *buf);
 void buffer_debug(std::vector<PajeEvent*> *buf) {
@@ -48,6 +119,58 @@ static void print_timestamp(PajeEvent* event) {
     stream << event->timestamp;
 }  
 
     stream << event->timestamp;
 }  
 
+/* internal do the instrumentation module */
+static void insert_into_buffer (PajeEvent* tbi)
+{
+  if (TRACE_buffer() == 0){
+    tbi->print ();
+    delete tbi;
+    return;
+  }
+  buffer_debug(&buffer);
+
+  XBT_DEBUG("%s: insert event_type=%d, timestamp=%f, buffersize=%zu)",
+      __FUNCTION__, (int)tbi->event_type, tbi->timestamp, buffer.size());
+  std::vector<PajeEvent*>::reverse_iterator i;
+  for (i = buffer.rbegin(); i != buffer.rend(); ++i) {
+    PajeEvent* e1 = *i;
+    XBT_DEBUG("compare to %p is of type %d; timestamp:%f", e1,
+        (int)e1->event_type, e1->timestamp);
+    if (e1->timestamp <= tbi->timestamp)
+      break;
+  }
+  buffer.insert(i.base(), tbi);
+  if (i == buffer.rend())
+    XBT_DEBUG("%s: inserted at beginning", __FUNCTION__);
+  else if (i == buffer.rbegin())
+    XBT_DEBUG("%s: inserted at end", __FUNCTION__);
+  else
+    XBT_DEBUG("%s: inserted at pos= %zd from its end", __FUNCTION__,
+        std::distance(buffer.rbegin(),i));
+
+  buffer_debug(&buffer);
+}
+
+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() {
   char *filename = TRACE_get_filename();
   tracing_file = fopen(filename, "w");
 void TRACE_paje_start() {
   char *filename = TRACE_get_filename();
   tracing_file = fopen(filename, "w");
@@ -84,6 +207,17 @@ void TRACE_paje_end() {
   XBT_DEBUG("Filename %s is closed", filename);
 }
 
   XBT_DEBUG("Filename %s is closed", filename);
 }
 
+DefineContainerEvent::DefineContainerEvent(type_t type)
+{
+
+  event_type                            = PAJE_DefineContainerType;
+  timestamp                             = 0;
+  this->type = type;
+  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
+  //print it
+  print ();
+}
+
 void DefineContainerEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void DefineContainerEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -94,6 +228,20 @@ void DefineContainerEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+
+
+DefineVariableTypeEvent::DefineVariableTypeEvent(type_t type)
+{
+  this->event_type                           = PAJE_DefineVariableType;
+  this->timestamp                            = 0;
+  this->type = type;
+
+  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
+
+  //print it
+  print ();
+}
+
 void DefineVariableTypeEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void DefineVariableTypeEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -106,6 +254,32 @@ void DefineVariableTypeEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+DefineStateTypeEvent::DefineStateTypeEvent(type_t type)
+{
+  this->event_type                        = PAJE_DefineStateType;
+  this->timestamp                         = 0;
+  this->type = type;
+
+  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
+
+  //print it
+  print();
+}
+
+
+DefineEventTypeEvent::DefineEventTypeEvent(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 DefineStateTypeEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void DefineStateTypeEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -126,6 +300,20 @@ void DefineEventTypeEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+DefineLinkTypeEvent::DefineLinkTypeEvent(type_t type, type_t source, type_t dest)
+{
+  this->event_type                         = PAJE_DefineLinkType;
+  this->timestamp                          = 0;
+  this->type   = type;
+  this->source = source;
+  this->dest   = dest;
+
+  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
+
+  //print it
+  print();
+}
+
 void DefineLinkTypeEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void DefineLinkTypeEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -138,6 +326,19 @@ void DefineLinkTypeEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+DefineEntityValueEvent::DefineEntityValueEvent (val_t value)
+{
+  this->event_type                           = PAJE_DefineEntityValue;
+  this->timestamp                            = 0;
+  this->value = value;
+
+  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
+
+  //print it
+  print();
+}
+
+
 void DefineEntityValueEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void DefineEntityValueEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -150,6 +351,18 @@ void DefineEntityValueEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+CreateContainerEvent::CreateContainerEvent (container_t container)
+{
+  this->event_type                             = PAJE_CreateContainer;
+  this->timestamp                              = SIMIX_get_clock();
+  this->container = container;
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  //print it
+  print();
+}
+
 void CreateContainerEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void CreateContainerEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -163,6 +376,17 @@ void CreateContainerEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+DestroyContainerEvent::DestroyContainerEvent (container_t container)
+{
+  this->event_type                              = PAJE_DestroyContainer;
+  this->timestamp                               = SIMIX_get_clock();
+  this->container = container;
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  print();
+}
+
 void DestroyContainerEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void DestroyContainerEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -174,6 +398,19 @@ void DestroyContainerEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+SetVariableEvent::SetVariableEvent (double timestamp, container_t container, type_t type, double value)
+{
+  this->event_type                         = PAJE_SetVariable;
+  this->timestamp                          = timestamp;
+  this->type      = type;
+  this->container = container;
+  this->value     = value;
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  insert_into_buffer (this);
+}
+
 void SetVariableEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void SetVariableEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -185,6 +422,19 @@ void SetVariableEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+AddVariableEvent::AddVariableEvent (double timestamp, container_t container, type_t type, double value)
+{
+  this->event_type                         = PAJE_AddVariable;
+  this->timestamp                          = timestamp;
+  this->type      = type;
+  this->container = container;
+  this->value     = value;
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  insert_into_buffer (this);
+}
+
 void AddVariableEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void AddVariableEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -196,6 +446,19 @@ void AddVariableEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+SubVariableEvent::SubVariableEvent (double timestamp, container_t container, type_t type, double value)
+{
+  this->event_type                         = PAJE_SubVariable;
+  this->timestamp                          = timestamp;
+  this->type      = type;
+  this->container = container;
+  this->value     = value;
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  insert_into_buffer (this);
+}
+
 void SubVariableEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void SubVariableEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -207,6 +470,27 @@ void SubVariableEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+SetStateEvent::SetStateEvent (double timestamp, container_t container, type_t type, val_t value)
+{
+  this->event_type                      = PAJE_SetState;
+  this->timestamp                       = timestamp;
+  this->type      = type;
+  this->container = container;
+  this->value     = value;
+
+#if HAVE_SMPI
+  if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
+    smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
+    filename   = loc->filename;
+    linenumber = loc->linenumber;
+  }
+#endif
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  insert_into_buffer (this);
+}
+
 void SetStateEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void SetStateEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -224,6 +508,31 @@ void SetStateEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+PushStateEvent::PushStateEvent (double timestamp, container_t container, type_t type, val_t value, void* extra)
+{
+  this->event_type                  = PAJE_PushState;
+  this->timestamp                   = timestamp;
+  this->type = type;
+  this->container = container;
+  this->value     = value;
+  this->extra     = extra;
+
+#if HAVE_SMPI
+  if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
+    smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
+    filename   = loc->filename;
+    linenumber = loc->linenumber;
+  }
+#endif
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  insert_into_buffer (this);
+}
+
+PushStateEvent::PushStateEvent (double timestamp, container_t container, type_t type, val_t value)
+ : PushStateEvent(timestamp, container, type, value, nullptr)
+{}
 void PushStateEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void PushStateEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -259,6 +568,19 @@ void PushStateEvent::print() {
   }
 }
 
   }
 }
 
+
+PopStateEvent::PopStateEvent (double timestamp, container_t container, type_t type)
+{
+  this->event_type                      = PAJE_PopState;
+  this->timestamp                       = timestamp;
+  this->type      = type;
+  this->container = container;
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  insert_into_buffer (this);
+}
+
 void PopStateEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void PopStateEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -269,6 +591,18 @@ void PopStateEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+ResetStateEvent::ResetStateEvent (double timestamp, container_t container, type_t type)
+{
+  this->event_type                        = PAJE_ResetState;
+  this->timestamp                         = timestamp;
+  this->type      = type;
+  this->container = container;
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  insert_into_buffer (this);
+}
+
 void ResetStateEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void ResetStateEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -279,6 +613,29 @@ void ResetStateEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+StartLinkEvent::StartLinkEvent (double timestamp, container_t container,
+    type_t type, container_t sourceContainer, const char *value, const char *key)
+  : StartLinkEvent(timestamp, container, type, sourceContainer, value, key, -1)
+{}
+
+StartLinkEvent::StartLinkEvent (double timestamp, container_t container, type_t type, container_t sourceContainer,
+                                const char *value, const char *key, int size)
+{
+  event_type                             = PAJE_StartLink;
+  this->timestamp       = timestamp;
+  this->type            = type;
+  this->container       = container;
+  this->sourceContainer = sourceContainer;
+  this->value           = xbt_strdup(value);
+  this->key             = xbt_strdup(key);
+  this->size            = size;
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f, value:%s", __FUNCTION__,
+      (int)event_type, this->timestamp, this->value);
+
+  insert_into_buffer (this);
+}
+
 void StartLinkEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void StartLinkEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -296,6 +653,23 @@ void StartLinkEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+EndLinkEvent::EndLinkEvent (double timestamp, container_t container, type_t type, container_t destContainer,
+                      const char *value, const char *key)
+{
+  this->event_type                         = PAJE_EndLink;
+  this->timestamp                          = timestamp;
+  this->type          = type;
+  this->container     = container;
+  this->destContainer = destContainer;
+  this->value         = xbt_strdup(value);
+  this->key           = xbt_strdup(key);
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  insert_into_buffer (this);
+}
+
+
 void EndLinkEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void EndLinkEvent::print() {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
@@ -309,6 +683,19 @@ void EndLinkEvent::print() {
   print_row();
 }
 
   print_row();
 }
 
+NewEvent::NewEvent (double timestamp, container_t container, type_t type, val_t value)
+{
+  this->event_type                      = PAJE_NewEvent;
+  this->timestamp                       = timestamp;
+  this->type      = type;
+  this->container = container;
+  this->value     = value;
+
+  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+
+  insert_into_buffer (this);
+}
+
 void NewEvent::print () {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
 void NewEvent::print () {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
   stream << std::fixed << std::setprecision(TRACE_precision());
diff --git a/src/instr/instr_trace.cpp b/src/instr/instr_trace.cpp
deleted file mode 100644 (file)
index b226de9..0000000
+++ /dev/null
@@ -1,401 +0,0 @@
-/* Copyright (c) 2010-2015. The SimGrid Team.
- * All rights reserved.                                                     */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "src/instr/instr_private.h"
-#include "src/instr/instr_smpi.h"
-#include "src/smpi/private.hpp"
-#include "xbt/virtu.h" /* sg_cmdline */
-#include "typeinfo"
-
-#include <vector>
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_trace, instr, "tracing event system");
-
-FILE *tracing_file = nullptr;
-
-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 */
-
-s_instr_trace_writer_t active_writer = {&print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL,
-                                        &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL,
-                                        &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL, &print_NULL};
-
-std::vector<PajeEvent*> buffer;
-void buffer_debug(std::vector<PajeEvent*> *buf);
-
-void dump_comment (const char *comment)
-{
-  if (!strlen(comment)) return;
-  fprintf (tracing_file, "# %s\n", comment);
-}
-
-void dump_comment_file (const char *filename)
-{
-  if (!strlen(filename)) return;
-  FILE *file = fopen (filename, "r");
-  if (!file){
-    THROWF (system_error, 1, "Comment file %s could not be opened for reading.", filename);
-  }
-  while (!feof(file)){
-    char c;
-    c = fgetc(file);
-    if (feof(file)) break;
-    fprintf (tracing_file, "# ");
-    while (c != '\n'){
-      fprintf (tracing_file, "%c", c);
-      c = fgetc(file);
-      if (feof(file)) break;
-    }
-    fprintf (tracing_file, "\n");
-  }
-  fclose(file);
-}
-
-double TRACE_last_timestamp_to_dump = 0;
-//dumps the trace file until the timestamp TRACE_last_timestamp_to_dump
-void TRACE_paje_dump_buffer (int force)
-{
-  if (!TRACE_is_enabled()) return;
-  XBT_DEBUG("%s: dump until %f. starts", __FUNCTION__, TRACE_last_timestamp_to_dump);
-  if (force){
-    for (auto event : buffer){
-      event->print();
-      delete event;
-    }
-    buffer.clear();
-  }else{
-    std::vector<PajeEvent*>::iterator i = buffer.begin();
-    for (auto event :buffer){
-      double head_timestamp = event->timestamp;
-      if (head_timestamp > TRACE_last_timestamp_to_dump)
-        break;
-      event->print();
-      delete event;
-      ++i;
-    }
-    buffer.erase(buffer.begin(), i);
-  }
-  XBT_DEBUG("%s: ends", __FUNCTION__);
-}
-
-/* internal do the instrumentation module */
-static void insert_into_buffer (PajeEvent* tbi)
-{
-  if (TRACE_buffer() == 0){
-    tbi->print ();
-    delete tbi;
-    return;
-  }
-  buffer_debug(&buffer);
-
-  XBT_DEBUG("%s: insert event_type=%d, timestamp=%f, buffersize=%zu)",
-      __FUNCTION__, (int)tbi->event_type, tbi->timestamp, buffer.size());
-  std::vector<PajeEvent*>::reverse_iterator i;
-  for (i = buffer.rbegin(); i != buffer.rend(); ++i) {
-    PajeEvent* e1 = *i;
-    XBT_DEBUG("compare to %p is of type %d; timestamp:%f", e1,
-        (int)e1->event_type, e1->timestamp);
-    if (e1->timestamp <= tbi->timestamp)
-      break;
-  }
-  buffer.insert(i.base(), tbi);
-  if (i == buffer.rend())
-    XBT_DEBUG("%s: inserted at beginning", __FUNCTION__);
-  else if (i == buffer.rbegin())
-    XBT_DEBUG("%s: inserted at end", __FUNCTION__);
-  else
-    XBT_DEBUG("%s: inserted at pos= %zd from its end", __FUNCTION__,
-        std::distance(buffer.rbegin(),i));
-
-  buffer_debug(&buffer);
-}
-
-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;
-  }*/
-}
-
-
-//--------------------------------------------------------
-
-DefineContainerEvent::DefineContainerEvent(type_t type)
-{
-
-  event_type                            = PAJE_DefineContainerType;
-  timestamp                             = 0;
-  this->type = type;
-  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-  //print it
-  print ();
-}
-
-
-DefineVariableTypeEvent::DefineVariableTypeEvent(type_t type)
-{
-  this->event_type                           = PAJE_DefineVariableType;
-  this->timestamp                            = 0;
-  this->type = type;
-
-  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
-  //print it
-  print ();
-}
-// TODO convertir tt les constructeurs proprement.
-DefineStateTypeEvent::DefineStateTypeEvent(type_t type)
-{
-  this->event_type                        = PAJE_DefineStateType;
-  this->timestamp                         = 0;
-  this->type = type;
-
-  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
-  //print it
-  print();
-}
-
-DefineEventTypeEvent::DefineEventTypeEvent(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();
-}
-
-DefineLinkTypeEvent::DefineLinkTypeEvent(type_t type, type_t source, type_t dest)
-{
-  this->event_type                         = PAJE_DefineLinkType;
-  this->timestamp                          = 0;
-  this->type   = type;
-  this->source = source;
-  this->dest   = dest;
-
-  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
-  //print it
-  print();
-}
-
-DefineEntityValueEvent::DefineEntityValueEvent (val_t value)
-{
-  this->event_type                           = PAJE_DefineEntityValue;
-  this->timestamp                            = 0;
-  this->value = value;
-
-  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
-  //print it
-  print();
-}
-
-CreateContainerEvent::CreateContainerEvent (container_t container)
-{
-  this->event_type                             = PAJE_CreateContainer;
-  this->timestamp                              = SIMIX_get_clock();
-  this->container = container;
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  //print it
-  print();
-}
-
-DestroyContainerEvent::DestroyContainerEvent (container_t container)
-{
-  this->event_type                              = PAJE_DestroyContainer;
-  this->timestamp                               = SIMIX_get_clock();
-  this->container = container;
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  print();
-}
-
-SetVariableEvent::SetVariableEvent (double timestamp, container_t container, type_t type, double value)
-{
-  this->event_type                         = PAJE_SetVariable;
-  this->timestamp                          = timestamp;
-  this->type      = type;
-  this->container = container;
-  this->value     = value;
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  insert_into_buffer (this);
-}
-
-AddVariableEvent::AddVariableEvent (double timestamp, container_t container, type_t type, double value)
-{
-  this->event_type                         = PAJE_AddVariable;
-  this->timestamp                          = timestamp;
-  this->type      = type;
-  this->container = container;
-  this->value     = value;
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  insert_into_buffer (this);
-}
-
-SubVariableEvent::SubVariableEvent (double timestamp, container_t container, type_t type, double value)
-{
-  this->event_type                         = PAJE_SubVariable;
-  this->timestamp                          = timestamp;
-  this->type      = type;
-  this->container = container;
-  this->value     = value;
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  insert_into_buffer (this);
-}
-
-SetStateEvent::SetStateEvent (double timestamp, container_t container, type_t type, val_t value)
-{
-  this->event_type                      = PAJE_SetState;
-  this->timestamp                       = timestamp;
-  this->type      = type;
-  this->container = container;
-  this->value     = value;
-
-#if HAVE_SMPI
-  if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
-    smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
-    filename   = loc->filename;
-    linenumber = loc->linenumber;
-  }
-#endif
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  insert_into_buffer (this);
-}
-
-
-PushStateEvent::PushStateEvent (double timestamp, container_t container, type_t type, val_t value, void* extra)
-{
-  this->event_type                  = PAJE_PushState;
-  this->timestamp                   = timestamp;
-  this->type = type;
-  this->container = container;
-  this->value     = value;
-  this->extra     = extra;
-
-#if HAVE_SMPI
-  if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
-    smpi_trace_call_location_t* loc = smpi_trace_get_call_location();
-    filename   = loc->filename;
-    linenumber = loc->linenumber;
-  }
-#endif
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  insert_into_buffer (this);
-}
-
-
-PushStateEvent::PushStateEvent (double timestamp, container_t container, type_t type, val_t value)
- : PushStateEvent(timestamp, container, type, value, nullptr)
-{}
-
-PopStateEvent::PopStateEvent (double timestamp, container_t container, type_t type)
-{
-  this->event_type                      = PAJE_PopState;
-  this->timestamp                       = timestamp;
-  this->type      = type;
-  this->container = container;
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  insert_into_buffer (this);
-}
-
-
-ResetStateEvent::ResetStateEvent (double timestamp, container_t container, type_t type)
-{
-  this->event_type                        = PAJE_ResetState;
-  this->timestamp                         = timestamp;
-  this->type      = type;
-  this->container = container;
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  insert_into_buffer (this);
-}
-
-StartLinkEvent::StartLinkEvent (double timestamp, container_t container,
-    type_t type, container_t sourceContainer, const char *value, const char *key)
-  : StartLinkEvent(timestamp, container, type, sourceContainer, value, key, -1)
-{}
-
-StartLinkEvent::StartLinkEvent (double timestamp, container_t container, type_t type, container_t sourceContainer,
-                                const char *value, const char *key, int size)
-{
-  event_type                             = PAJE_StartLink;
-  this->timestamp       = timestamp;
-  this->type            = type;
-  this->container       = container;
-  this->sourceContainer = sourceContainer;
-  this->value           = xbt_strdup(value);
-  this->key             = xbt_strdup(key);
-  this->size            = size;
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f, value:%s", __FUNCTION__,
-      (int)event_type, this->timestamp, this->value);
-
-  insert_into_buffer (this);
-}
-
-EndLinkEvent::EndLinkEvent (double timestamp, container_t container, type_t type, container_t destContainer,
-                      const char *value, const char *key)
-{
-  this->event_type                         = PAJE_EndLink;
-  this->timestamp                          = timestamp;
-  this->type          = type;
-  this->container     = container;
-  this->destContainer = destContainer;
-  this->value         = xbt_strdup(value);
-  this->key           = xbt_strdup(key);
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  insert_into_buffer (this);
-}
-
-NewEvent::NewEvent (double timestamp, container_t container, type_t type, val_t value)
-{
-  this->event_type                      = PAJE_NewEvent;
-  this->timestamp                       = timestamp;
-  this->type      = type;
-  this->container = container;
-  this->value     = value;
-
-  XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
-
-  insert_into_buffer (this);
-}
index 9e3da3c..d24eb8c 100644 (file)
@@ -146,7 +146,6 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(instr_resource);
   XBT_LOG_CONNECT(instr_routing);
   XBT_LOG_CONNECT(instr_surf);
   XBT_LOG_CONNECT(instr_resource);
   XBT_LOG_CONNECT(instr_routing);
   XBT_LOG_CONNECT(instr_surf);
-  XBT_LOG_CONNECT(instr_trace);
   XBT_LOG_CONNECT(instr_TI_trace);
 
   /* jedule */
   XBT_LOG_CONNECT(instr_TI_trace);
 
   /* jedule */
index 3ee6a75..bb0c2b5 100644 (file)
@@ -544,7 +544,6 @@ set(TRACING_SRC
   src/instr/instr_private.h
   src/instr/instr_smpi.h
   src/instr/instr_resource_utilization.cpp
   src/instr/instr_private.h
   src/instr/instr_smpi.h
   src/instr/instr_resource_utilization.cpp
-  src/instr/instr_trace.cpp
   )
 
 set(JEDULE_SRC
   )
 
 set(JEDULE_SRC