Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix tracing debug mode (and please sonar)
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 11 May 2018 07:18:49 +0000 (09:18 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 11 May 2018 07:18:49 +0000 (09:18 +0200)
src/instr/instr_paje_events.cpp
src/instr/instr_paje_events.hpp
src/instr/instr_paje_trace.cpp
src/instr/instr_platform.cpp

index a22de7d..92e53e1 100644 (file)
@@ -26,6 +26,15 @@ PajeEvent::PajeEvent(Container* container, Type* type, double timestamp, e_event
   insertIntoBuffer();
 };
 
+void PajeEvent::print()
+{
+  if (trace_format != simgrid::instr::TraceFormat::Paje)
+    return;
+
+  XBT_DEBUG("Dump %s", stream_.str().c_str());
+  tracing_file << stream_.str() << std::endl;
+}
+
 StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra)
     : PajeEvent::PajeEvent(container, type, SIMIX_get_clock(), event_type), value(value), extra_(extra)
 {
index a3a9522..bf82373 100644 (file)
@@ -48,7 +48,7 @@ public:
 
   PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType);
   virtual ~PajeEvent() = default;
-  virtual void print() = 0;
+  virtual void print();
   void insertIntoBuffer();
 };
 
index 3b8d752..f37c0e1 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_trace, instr, "tracing event system");
 
-static std::stringstream stream;
 extern std::ofstream tracing_file;
 
 std::vector<simgrid::instr::PajeEvent*> buffer;
-void buffer_debug(std::vector<simgrid::instr::PajeEvent*>* buf);
 
 void dump_comment(std::string comment)
 {
@@ -72,16 +70,16 @@ void TRACE_paje_dump_buffer(bool force)
   XBT_DEBUG("%s: ends", __func__);
 }
 
-void buffer_debug(std::vector<simgrid::instr::PajeEvent*>* buf)
+static void buffer_debug(std::vector<simgrid::instr::PajeEvent*>* buf)
 {
   if (not XBT_LOG_ISENABLED(instr_paje_trace, xbt_log_priority_debug))
     return;
   XBT_DEBUG(">>>>>> Dump the state of the buffer. %zu events", buf->size());
   for (auto const& event : *buf) {
     event->print();
-    XBT_DEBUG("%p %s", event, stream.str().c_str());
-    stream.str("");
-    stream.clear();
+    XBT_DEBUG("%p %s", event, event->stream_.str().c_str());
+    event->stream_.str("");
+    event->stream_.clear();
   }
   XBT_DEBUG("<<<<<<");
 }
index a6800a3..71cd307 100644 (file)
@@ -232,7 +232,7 @@ static void instr_host_on_creation(simgrid::s4u::Host& host)
 }
 
 static void instr_cpu_action_on_state_change(simgrid::surf::CpuAction* action,
-                                             simgrid::kernel::resource::Action::State previous)
+                                             simgrid::kernel::resource::Action::State /* previous */)
 {
   simgrid::surf::Cpu* cpu = static_cast<simgrid::surf::Cpu*>(action->get_variable()->get_constraint(0)->get_id());
   TRACE_surf_resource_set_utilization("HOST", "power_used", cpu->get_cname(), action->get_category(),