A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix leak of memory caused by DefineEventTypeEvent call
[simgrid.git]
/
src
/
instr
/
instr_paje_trace.cpp
diff --git
a/src/instr/instr_paje_trace.cpp
b/src/instr/instr_paje_trace.cpp
index
a633018
..
3a1033d
100644
(file)
--- a/
src/instr/instr_paje_trace.cpp
+++ b/
src/instr/instr_paje_trace.cpp
@@
-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;
/* 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;
stream << event->timestamp;
-}
+}
/* internal do the instrumentation module */
static void insert_into_buffer (PajeEvent* tbi)
/* internal do the instrumentation module */
static void insert_into_buffer (PajeEvent* tbi)
@@
-212,23
+212,14
@@
void TRACE_paje_end() {
XBT_DEBUG("Filename %s is closed", filename);
}
XBT_DEBUG("Filename %s is closed", filename);
}
-
DefineContainerEvent::
DefineContainerEvent(type_t type)
+
void
DefineContainerEvent(type_t type)
{
{
-
- event_type = PAJE_DefineContainerType;
- timestamp = 0;
- this->type = type;
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineContainerType);
//print it
//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);
+ 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 << std::fixed << std::setprecision(TRACE_precision());
- stream <<
(int)this->event_t
ype;
+ stream <<
PAJE_DefineContainerT
ype;
stream << " " << type->id
<< " " << type->father->id
<< " " << type->name;
stream << " " << type->id
<< " " << type->father->id
<< " " << type->name;
@@
-238,27
+229,21
@@
void DefineContainerEvent::print() {
} else {
THROW_IMPOSSIBLE;
}
} else {
THROW_IMPOSSIBLE;
}
+ //--
}
}
-DefineVariableTypeEvent::DefineVariableTypeEvent(type_t type)
+
+void LogVariableTypeDefinition(type_t type)
{
{
- this->event_type = PAJE_DefineVariableType;
- this->timestamp = 0;
- this->type = type;
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__,
(int)event_t
ype);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__,
PAJE_DefineVariableT
ype);
//print it
//print it
- print ();
- delete this;
-}
-
-void DefineVariableTypeEvent::print() {
- if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+if (instr_fmt_type == instr_fmt_paje) {
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineVariableType, TRACE_precision(), 0.);
stream << std::fixed << std::setprecision(TRACE_precision());
stream << std::fixed << std::setprecision(TRACE_precision());
- stream <<
(int)this->event_t
ype;
+ stream <<
PAJE_DefineVariableT
ype;
stream << " " << type->id << " " << type->father->id << " " << type->name;
if (type->color)
stream << " \"" << type->color << "\"";
stream << " " << type->id << " " << type->father->id << " " << type->name;
if (type->color)
stream << " \"" << type->color << "\"";
@@
-270,38
+255,14
@@
void DefineVariableTypeEvent::print() {
}
}
}
}
-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();
- delete this;
-}
-
-
DefineEventTypeEvent::DefineEventTypeEvent
(type_t type)
+
void LogStateTypeDefinition
(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 it
- print();
-}
-
-
-void DefineStateTypeEvent::print() {
- if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+if (instr_fmt_type == instr_fmt_paje) {
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineStateType, TRACE_precision(), 0.);
stream << std::fixed << std::setprecision(TRACE_precision());
stream << std::fixed << std::setprecision(TRACE_precision());
- stream <<
(int)this->event_t
ype;
+ stream <<
PAJE_DefineStateT
ype;
stream << " " << type->id << " " << type->father->id << " " << type->name;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
stream << " " << type->id << " " << type->father->id << " " << type->name;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
@@
-311,11
+272,14
@@
void DefineStateTypeEvent::print() {
}
}
}
}
-void DefineEventTypeEvent::print() {
+
+void LogDefineEventType(type_t type)
+{
+ //print it
if (instr_fmt_type == instr_fmt_paje) {
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 << std::fixed << std::setprecision(TRACE_precision());
- stream <<
(int)this->event_t
ype;
+ stream <<
PAJE_DefineEventT
ype;
stream << " " << type->id << " " << type->father->id << " " << type->name;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
stream << " " << type->id << " " << type->father->id << " " << type->name;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
@@
-325,26
+289,14
@@
void DefineEventTypeEvent::print() {
}
}
}
}
-
DefineLinkTypeEvent::DefineLinkTypeEvent
(type_t type, type_t source, type_t dest)
+
void LogLinkTypeDefinition
(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);
-
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineLinkType);
//print it
//print it
- print();
- delete this;
-}
-
-void DefineLinkTypeEvent::print() {
- if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+if (instr_fmt_type == instr_fmt_paje) {
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineLinkType, TRACE_precision(), 0.);
stream << std::fixed << std::setprecision(TRACE_precision());
stream << std::fixed << std::setprecision(TRACE_precision());
- stream <<
(int)this->event_t
ype;
+ stream <<
PAJE_DefineLinkT
ype;
stream << " " << type->id << " " << type->father->id << " " << source->id << " " << dest->id << " " << type->name;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
stream << " " << type->id << " " << type->father->id << " " << source->id << " " << dest->id << " " << type->name;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
@@
-354,25
+306,13
@@
void DefineLinkTypeEvent::print() {
}
}
}
}
-
DefineEntityValueEvent::DefineEntityValueEvent
(val_t value)
+
void LogEntityValue
(val_t value)
{
{
- this->event_type = PAJE_DefineEntityValue;
- this->timestamp = 0;
- this->value = value;
-
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineEntityValue);
//print it
//print it
- print();
- delete this;
-}
-
-
-void DefineEntityValueEvent::print() {
- if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+if (instr_fmt_type == instr_fmt_paje) {
stream << std::fixed << std::setprecision(TRACE_precision());
stream << std::fixed << std::setprecision(TRACE_precision());
- stream <<
(int)this->event_typ
e;
+ stream <<
PAJE_DefineEntityValu
e;
stream << " " << value->id << " " << value->father->id << " " << value->name;
if (value->color)
stream << " \"" << value->color << "\"";
stream << " " << value->id << " " << value->father->id << " " << value->name;
if (value->color)
stream << " \"" << value->color << "\"";
@@
-384,26
+324,24
@@
void DefineEntityValueEvent::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);
+void LogContainerCreation (container_t container)
+{
+ double timestamp = SIMIX_get_clock();
- print();
- delete this;
-}
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, PAJE_CreateContainer,timestamp);
-void CreateContainerEvent::print() {
- if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+if (instr_fmt_type == instr_fmt_paje) {
stream << std::fixed << std::setprecision(TRACE_precision());
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
- stream << " " << container->id << " " << container->type->id << " " << container->father->id << " \""
- << container->name << "\"";
+ 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 << "\"";
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
@@
-438,26
+376,22
@@
void CreateContainerEvent::print() {
}
}
}
}
-
DestroyContainerEvent::DestroyContainerEvent
(container_t container)
+
void LogContainerDestruction
(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);
+ double timestamp = SIMIX_get_clock();
- print();
- delete this;
-}
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, PAJE_DestroyContainer, timestamp);
-void DestroyContainerEvent::print() {
- if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+if (instr_fmt_type == instr_fmt_paje) {
stream << std::fixed << std::setprecision(TRACE_precision());
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
- print_timestamp(this);
+ 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;
stream << " " << container->type->id << " " << container->id;
stream << " " << container->type->id << " " << container->id;
-
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || xbt_dict_length(tracing_files) == 1) {
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || xbt_dict_length(tracing_files) == 1) {
@@
-470,6
+404,7
@@
void DestroyContainerEvent::print() {
}
}
}
}
+
SetVariableEvent::SetVariableEvent (double timestamp, container_t container, type_t type, double value)
{
this->event_type = PAJE_SetVariable;
SetVariableEvent::SetVariableEvent (double timestamp, container_t container, type_t type, double value)
{
this->event_type = PAJE_SetVariable;