From 7ac4abc35931448d0bbc5f3c1260320dfe4110c9 Mon Sep 17 00:00:00 2001 From: Takishipp Date: Tue, 13 Jun 2017 17:00:50 +0200 Subject: [PATCH 1/1] update requested changes --- src/instr/instr_paje_containers.cpp | 4 +- src/instr/instr_paje_trace.cpp | 70 +++++++++++------------------ src/instr/instr_paje_types.cpp | 6 +-- src/instr/instr_paje_values.cpp | 2 +- src/instr/instr_private.h | 12 ++--- 5 files changed, 39 insertions(+), 55 deletions(-) diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index 16bbd9ba02..c2b651568a 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -138,7 +138,7 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe newContainer->children = xbt_dict_new_homogeneous(nullptr); if (newContainer->father){ xbt_dict_set(newContainer->father->children, newContainer->name, newContainer, nullptr); - CreateContainerEvent(newContainer); + LogContainerCreation(newContainer); } //register all kinds by name @@ -206,7 +206,7 @@ void PJ_container_free (container_t container) if (not TRACE_disable_destroy() && container != PJ_container_get_root()) { //do not trace the container destruction if user requests //or if the container is root - DestroyContainerEvent(container); + LogContainerDestruction(container); } //remove it from allContainers data structure diff --git a/src/instr/instr_paje_trace.cpp b/src/instr/instr_paje_trace.cpp index 5cabc10819..3a61d2035a 100644 --- a/src/instr/instr_paje_trace.cpp +++ b/src/instr/instr_paje_trace.cpp @@ -214,14 +214,12 @@ void TRACE_paje_end() { void DefineContainerEvent(type_t type) { - e_event_type event_type = PAJE_DefineContainerType; - double timestamp = 0; - XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type); + XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineContainerType); //print it 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_DefineContainerType, TRACE_precision(), 0.); stream << std::fixed << std::setprecision(TRACE_precision()); - stream << (int)event_type; + stream << PAJE_DefineContainerType; stream << " " << type->id << " " << type->father->id << " " << type->name; @@ -236,18 +234,16 @@ void DefineContainerEvent(type_t type) -void DefineVariableTypeEvent(type_t type) +void LogVariableTypeDefinition(type_t type) { - e_event_type event_type = PAJE_DefineVariableType; - double timestamp = 0; - XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type); + XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineVariableType); //print it 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_DefineVariableType, TRACE_precision(), 0.); stream << std::fixed << std::setprecision(TRACE_precision()); - stream << (int)event_type; + stream << PAJE_DefineVariableType; stream << " " << type->id << " " << type->father->id << " " << type->name; if (type->color) stream << " \"" << type->color << "\""; @@ -260,18 +256,16 @@ if (instr_fmt_type == instr_fmt_paje) { } -void DefineStateTypeEvent(type_t type) +void LogStateTypeDefinition(type_t type) { - e_event_type event_type = PAJE_DefineStateType; - double timestamp = 0; - XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type); + XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineStateType); //print it 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_DefineStateType, TRACE_precision(), 0.); stream << std::fixed << std::setprecision(TRACE_precision()); - stream << (int)event_type; + stream << PAJE_DefineStateType; stream << " " << type->id << " " << type->father->id << " " << type->name; print_row(); } else if (instr_fmt_type == instr_fmt_TI) { @@ -309,18 +303,14 @@ void DefineEventTypeEvent::print() { } } -void DefineLinkTypeEvent(type_t type, type_t source, type_t dest) +void LogLinkTypeDefinition(type_t type, type_t source, type_t dest) { - e_event_type event_type = PAJE_DefineLinkType; - double timestamp = 0; - - XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type); - + XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineLinkType); //print it 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_DefineLinkType, TRACE_precision(), 0.); stream << std::fixed << std::setprecision(TRACE_precision()); - stream << (int)event_type; + stream << PAJE_DefineLinkType; stream << " " << type->id << " " << type->father->id << " " << source->id << " " << dest->id << " " << type->name; print_row(); } else if (instr_fmt_type == instr_fmt_TI) { @@ -330,18 +320,14 @@ if (instr_fmt_type == instr_fmt_paje) { } } -void DefineEntityValueEvent (val_t value) +void LogEntityValue (val_t value) { - e_event_type event_type = PAJE_DefineEntityValue; - double timestamp = 0; - - XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type); - + XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineEntityValue); //print it 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_DefineEntityValue, TRACE_precision(),0.); stream << std::fixed << std::setprecision(TRACE_precision()); - stream << (int)event_type; + stream << PAJE_DefineEntityValue; stream << " " << value->id << " " << value->father->id << " " << value->name; if (value->color) stream << " \"" << value->color << "\""; @@ -354,17 +340,16 @@ if (instr_fmt_type == instr_fmt_paje) { } -void CreateContainerEvent (container_t container) +void LogContainerCreation (container_t container) { - e_event_type event_type = PAJE_CreateContainer; double timestamp = SIMIX_get_clock(); - XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type,timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, PAJE_CreateContainer,timestamp); 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_CreateContainer, TRACE_precision(), timestamp); stream << std::fixed << std::setprecision(TRACE_precision()); - stream << (int)event_type; + stream << PAJE_CreateContainer; stream << " "; /* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */ if (timestamp < 1e-12) @@ -407,17 +392,16 @@ if (instr_fmt_type == instr_fmt_paje) { } } -void DestroyContainerEvent (container_t container) +void LogContainerDestruction(container_t container) { - e_event_type event_type = PAJE_DestroyContainer; double timestamp = SIMIX_get_clock(); - XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, PAJE_DestroyContainer, timestamp); 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_DestroyContainer, TRACE_precision(), timestamp); stream << std::fixed << std::setprecision(TRACE_precision()); - stream << (int)event_type; + stream << PAJE_DestroyContainer; stream << " "; /* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */ if (timestamp < 1e-12) diff --git a/src/instr/instr_paje_types.cpp b/src/instr/instr_paje_types.cpp index 461f96b9d5..56fa62b81e 100644 --- a/src/instr/instr_paje_types.cpp +++ b/src/instr/instr_paje_types.cpp @@ -162,7 +162,7 @@ type_t PJ_type_variable_new (const char *name, const char *color, type_t father) ret = newType (name, name, color, TYPE_VARIABLE, father); } XBT_DEBUG("VariableType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id); - DefineVariableTypeEvent (ret); + LogVariableTypeDefinition (ret); return ret; } @@ -179,7 +179,7 @@ type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t ret = newType (name, key, nullptr, TYPE_LINK, father); XBT_DEBUG("LinkType %s(%s), child of %s(%s) %s(%s)->%s(%s)", ret->name, ret->id, father->name, father->id, source->name, source->id, dest->name, dest->id); - DefineLinkTypeEvent(ret, source, dest); + LogLinkTypeDefinition(ret, source, dest); return ret; } @@ -193,6 +193,6 @@ type_t PJ_type_state_new (const char *name, type_t father) ret = newType (name, name, nullptr, TYPE_STATE, father); XBT_DEBUG("StateType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id); - DefineStateTypeEvent(ret); + LogStateTypeDefinition(ret); return ret; } diff --git a/src/instr/instr_paje_values.cpp b/src/instr/instr_paje_values.cpp index f07a6409e2..7c0505ff23 100644 --- a/src/instr/instr_paje_values.cpp +++ b/src/instr/instr_paje_values.cpp @@ -27,7 +27,7 @@ val_t PJ_value_new (const char *name, const char *color, type_t father) xbt_dict_set (father->values, name, ret, nullptr); XBT_DEBUG("new value %s, child of %s", ret->name, ret->father->name); - DefineEntityValueEvent(ret); + LogEntityValue(ret); return ret; } diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index 9b3d7a8c9d..78e8aec654 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -421,11 +421,11 @@ extern instr_fmt_type_t instr_fmt_type; SG_END_DECL() void DefineContainerEvent(type_t type); -void DefineVariableTypeEvent(type_t type); -void DefineStateTypeEvent(type_t type); -void DefineLinkTypeEvent(type_t type, type_t source, type_t dest); -void DefineEntityValueEvent (val_t value); -void CreateContainerEvent (container_t container); -void DestroyContainerEvent (container_t container); +void LogVariableTypeDefinition(type_t type); +void LogStateTypeDefinition(type_t type); +void LogLinkTypeDefinition(type_t type, type_t source, type_t dest); +void LogEntityValue (val_t value); +void LogContainerCreation (container_t container); +void LogContainerDestruction (container_t container); #endif -- 2.20.1