Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
little function to debug the buffer
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 2 May 2017 13:05:10 +0000 (15:05 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 2 May 2017 13:05:10 +0000 (15:05 +0200)
src/instr/instr_paje_trace.cpp
src/instr/instr_trace.cpp

index 8cec105..d134d20 100644 (file)
@@ -7,6 +7,7 @@
 #include "src/instr/instr_private.h"
 #include "xbt/virtu.h" /* sg_cmdline */
 #include <sstream>
 #include "src/instr/instr_private.h"
 #include "xbt/virtu.h" /* sg_cmdline */
 #include <sstream>
+#include <vector>
 #include <iomanip> /** std::setprecision **/
 #include "simgrid/sg_config.h"
 
 #include <iomanip> /** std::setprecision **/
 #include "simgrid/sg_config.h"
 
@@ -17,6 +18,18 @@ extern s_instr_trace_writer_t active_writer;
 
 static std::stringstream stream;
 
 
 static std::stringstream stream;
 
+void buffer_debug(std::vector<PajeEvent*> *buf);
+void buffer_debug(std::vector<PajeEvent*> *buf) {
+  XBT_DEBUG(">>>>>> Dump the state of the buffer. %zu events", buf->size());
+  for (auto event :*buf){
+    event->print();
+    XBT_DEBUG("%s", stream.str().c_str());
+    stream.str("");
+    stream.clear();
+  }
+  XBT_DEBUG("<<<<<<");
+}
+
 static void print_paje_debug(std::string functionName, PajeEvent* event) {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(),
             event->timestamp);
 static void print_paje_debug(std::string functionName, PajeEvent* event) {
   XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event->event_type, TRACE_precision(),
             event->timestamp);
index 94c161f..f962223 100644 (file)
@@ -10,6 +10,8 @@
 #include "xbt/virtu.h" /* sg_cmdline */
 #include "typeinfo"
 
 #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;
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_trace, instr, "tracing event system");
 
 FILE *tracing_file = nullptr;
@@ -24,6 +26,7 @@ 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};
 
 std::vector<PajeEvent*> buffer;
                                         &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)
 {
 
 void dump_comment (const char *comment)
 {
@@ -88,6 +91,7 @@ static void insert_into_buffer (PajeEvent* tbi)
     delete tbi;
     return;
   }
     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());
 
   XBT_DEBUG("%s: insert event_type=%d, timestamp=%f, buffersize=%zu)",
       __FUNCTION__, (int)tbi->event_type, tbi->timestamp, buffer.size());