X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e44a0d71a8bacd7ab03e284fc32ad23731f5869c..3ba5d4a966c2ac976b2b1656c52145f70189d108:/src/instr/instr_paje_trace.cpp diff --git a/src/instr/instr_paje_trace.cpp b/src/instr/instr_paje_trace.cpp index dce4b1eb0e..6afb85878f 100644 --- a/src/instr/instr_paje_trace.cpp +++ b/src/instr/instr_paje_trace.cpp @@ -126,9 +126,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) @@ -150,7 +150,6 @@ static void insert_into_buffer (PajeEvent* tbi) 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()) @@ -158,6 +157,7 @@ static void insert_into_buffer (PajeEvent* tbi) else XBT_DEBUG("%s: inserted at pos= %zd from its end", __FUNCTION__, std::distance(buffer.rbegin(),i)); + buffer.insert(i.base(), tbi); buffer_debug(&buffer); } @@ -227,20 +227,23 @@ DefineContainerEvent::DefineContainerEvent(type_t type) XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type); //print it print (); + delete this; } void DefineContainerEvent::print() { - if (instr_fmt_type == instr_fmt_paje) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp); - stream << std::fixed << std::setprecision(TRACE_precision()); - stream << (int)this->event_type; - stream << " " << type->id << " " << type->father->id << " " << type->name; - print_row(); - } else if (instr_fmt_type == instr_fmt_TI) { - /* Nothing to do */ - } else { - THROW_IMPOSSIBLE; - } + if (instr_fmt_type == instr_fmt_paje) { + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp); + stream << std::fixed << std::setprecision(TRACE_precision()); + stream << (int)this->event_type; + stream << " " << type->id + << " " << type->father->id + << " " << type->name; + print_row(); + } else if (instr_fmt_type == instr_fmt_TI) { + /* Nothing to do */ + } else { + THROW_IMPOSSIBLE; + } } @@ -254,6 +257,7 @@ DefineVariableTypeEvent::DefineVariableTypeEvent(type_t type) //print it print (); + delete this; } void DefineVariableTypeEvent::print() { @@ -282,6 +286,7 @@ DefineStateTypeEvent::DefineStateTypeEvent(type_t type) //print it print(); + delete this; } @@ -338,6 +343,7 @@ DefineLinkTypeEvent::DefineLinkTypeEvent(type_t type, type_t source, type_t dest //print it print(); + delete this; } void DefineLinkTypeEvent::print() { @@ -364,6 +370,7 @@ DefineEntityValueEvent::DefineEntityValueEvent (val_t value) //print it print(); + delete this; } @@ -392,6 +399,7 @@ CreateContainerEvent::CreateContainerEvent (container_t container) XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp); print(); + delete this; } void CreateContainerEvent::print() { @@ -445,6 +453,7 @@ DestroyContainerEvent::DestroyContainerEvent (container_t container) XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp); print(); + delete this; } void DestroyContainerEvent::print() { @@ -818,6 +827,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; } void ResetStateEvent::print() { @@ -835,6 +845,11 @@ void ResetStateEvent::print() { } } +StartLinkEvent::~StartLinkEvent() +{ + free(value); + free(key); +} 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) @@ -894,7 +909,11 @@ EndLinkEvent::EndLinkEvent (double timestamp, container_t container, type_t type insert_into_buffer (this); } - +EndLinkEvent::~EndLinkEvent() +{ + free(value); + free(key); +} void EndLinkEvent::print() { if (instr_fmt_type == instr_fmt_paje) { XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);