From: Martin Quinson Date: Mon, 28 Aug 2017 00:20:57 +0000 (+0200) Subject: move all inst declarations into their namespace X-Git-Tag: v3_17~199 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c7edbf695cf8cae1e5bbca502b505d349510eebb move all inst declarations into their namespace --- diff --git a/src/instr/instr_config.cpp b/src/instr/instr_config.cpp index 8bbe263a69..b0640bbee0 100644 --- a/src/instr/instr_config.cpp +++ b/src/instr/instr_config.cpp @@ -63,7 +63,7 @@ static int trace_precision; static bool trace_configured = false; static bool trace_active = false; -static Type* rootType = nullptr; /* the root type */ +static simgrid::instr::Type* rootType = nullptr; /* the root type */ instr_fmt_type_t instr_fmt_type = instr_fmt_paje; @@ -138,7 +138,7 @@ int TRACE_end() TRACE_generate_viva_cat_conf(); /* dump trace buffer */ - TRACE_last_timestamp_to_dump = surf_get_clock(); + simgrid::instr::TRACE_last_timestamp_to_dump = surf_get_clock(); TRACE_paje_dump_buffer(1); /* destroy all data structures of tracing (and free) */ @@ -480,9 +480,9 @@ static void output_types (const char *name, xbt_dynar_t types, FILE *file) static void output_categories(const char* name, FILE* file) { - unsigned int i = created_categories.size(); + unsigned int i = simgrid::instr::created_categories.size(); fprintf (file, " values = ("); - for (auto const& cat : created_categories) { + for (auto const& cat : simgrid::instr::created_categories) { --i; fprintf(file, "\"%s%s\"", name, cat.c_str()); if (i > 0) { @@ -560,7 +560,7 @@ static void generate_cat_configuration (const char *output, const char *name, in { if (output && strlen(output) > 0){ //check if we do have categories declared - if (created_categories.empty()) { + if (simgrid::instr::created_categories.empty()) { XBT_INFO("No categories declared, ignoring generation of %s graph configuration", name); return; } diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index 8a0accaaf1..fcfea69698 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -21,11 +21,11 @@ typedef enum { XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API"); -std::set created_categories; -std::set declared_marks; -std::set user_host_variables; -std::set user_vm_variables; -std::set user_link_variables; +std::set simgrid::instr::created_categories; +std::set simgrid::instr::declared_marks; +std::set simgrid::instr::user_host_variables; +std::set simgrid::instr::user_vm_variables; +std::set simgrid::instr::user_link_variables; extern std::set trivaNodeTypes; extern std::set trivaEdgeTypes; @@ -86,10 +86,10 @@ void TRACE_category_with_color (const char *category, const char *color) return; //check if category is already created - if (created_categories.find(category) != created_categories.end()) + if (simgrid::instr::created_categories.find(category) != simgrid::instr::created_categories.end()) return; else - created_categories.insert(category); + simgrid::instr::created_categories.insert(category); //define final_color char final_color[INSTR_DEFAULT_STR_SIZE]; @@ -125,7 +125,7 @@ xbt_dynar_t TRACE_get_categories () { if (not TRACE_is_enabled() || not TRACE_categorized()) return nullptr; - return instr_set_to_dynar(&created_categories); + return instr_set_to_dynar(&simgrid::instr::created_categories); } /** \ingroup TRACE_mark @@ -148,13 +148,13 @@ void TRACE_declare_mark(const char *mark_type) THROWF (tracing_error, 1, "mark_type is nullptr"); //check if mark_type is already declared - if (declared_marks.find(mark_type) != declared_marks.end()) { + if (simgrid::instr::declared_marks.find(mark_type) != simgrid::instr::declared_marks.end()) { THROWF (tracing_error, 1, "mark_type with name (%s) is already declared", mark_type); } XBT_DEBUG("MARK,declare %s", mark_type); - Type::eventNew(mark_type, PJ_type_get_root()); - declared_marks.insert(mark_type); + simgrid::instr::Type::eventNew(mark_type, PJ_type_get_root()); + simgrid::instr::declared_marks.insert(mark_type); } /** \ingroup TRACE_mark @@ -183,7 +183,7 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar if (not mark_value) THROWF (tracing_error, 1, "mark_value is nullptr"); - Type* type = PJ_type_get (mark_type, PJ_type_get_root()); + simgrid::instr::Type* type = PJ_type_get(mark_type, PJ_type_get_root()); if (not type) { THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type); } @@ -193,7 +193,7 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar mark_color = white; XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color); - Value rett(mark_value, mark_color, type); + simgrid::instr::Value rett(mark_value, mark_color, type); } /** \ingroup TRACE_mark @@ -239,13 +239,14 @@ void TRACE_mark(const char *mark_type, const char *mark_value) THROWF (tracing_error, 1, "mark_value is nullptr"); //check if mark_type is already declared - Type* type = PJ_type_get (mark_type, PJ_type_get_root()); + simgrid::instr::Type* type = PJ_type_get(mark_type, PJ_type_get_root()); if (not type) { THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type); } XBT_DEBUG("MARK %s %s", mark_type, mark_value); - new NewEvent(MSG_get_clock(), PJ_container_get_root(), type, Value::get(mark_value, type)); + new simgrid::instr::NewEvent(MSG_get_clock(), PJ_container_get_root(), type, + simgrid::instr::Value::get(mark_value, type)); } /** \ingroup TRACE_mark @@ -260,7 +261,7 @@ xbt_dynar_t TRACE_get_marks () if (not TRACE_is_enabled()) return nullptr; - return instr_set_to_dynar(&declared_marks); + return instr_set_to_dynar(&simgrid::instr::declared_marks); } static void instr_user_variable(double time, const char* resource, const char* variable, const char* father_type, @@ -282,16 +283,16 @@ static void instr_user_variable(double time, const char* resource, const char* v char valuestr[100]; snprintf(valuestr, 100, "%g", value); container_t container = PJ_container_get(resource); - Type* type = PJ_type_get (variable, container->type); + simgrid::instr::Type* type = PJ_type_get(variable, container->type); switch (what){ case INSTR_US_SET: - new SetVariableEvent(time, container, type, value); + new simgrid::instr::SetVariableEvent(time, container, type, value); break; case INSTR_US_ADD: - new AddVariableEvent(time, container, type, value); + new simgrid::instr::AddVariableEvent(time, container, type, value); break; case INSTR_US_SUB: - new SubVariableEvent(time, container, type, value); + new simgrid::instr::SubVariableEvent(time, container, type, value); break; default: THROW_IMPOSSIBLE; @@ -315,7 +316,8 @@ static void instr_user_srcdst_variable(double time, const char *src, const char std::vector route; simgrid::kernel::routing::NetZoneImpl::getGlobalRoute(src_elm, dst_elm, &route, nullptr); for (auto const& link : route) - instr_user_variable(time, link->cname(), variable, father_type, value, what, nullptr, &user_link_variables); + instr_user_variable(time, link->cname(), variable, father_type, value, what, nullptr, + &simgrid::instr::user_link_variables); } /** \ingroup TRACE_API @@ -361,7 +363,7 @@ int TRACE_platform_graph_export_graphviz (const char *filename) */ void TRACE_vm_variable_declare (const char *variable) { - instr_user_variable(0, nullptr, variable, "MSG_VM", 0, INSTR_US_DECLARE, nullptr, &user_vm_variables); + instr_user_variable(0, nullptr, variable, "MSG_VM", 0, INSTR_US_DECLARE, nullptr, &simgrid::instr::user_vm_variables); } /** \ingroup TRACE_user_variables @@ -376,7 +378,7 @@ void TRACE_vm_variable_declare (const char *variable) */ void TRACE_vm_variable_declare_with_color (const char *variable, const char *color) { - instr_user_variable(0, nullptr, variable, "MSG_VM", 0, INSTR_US_DECLARE, color, &user_vm_variables); + instr_user_variable(0, nullptr, variable, "MSG_VM", 0, INSTR_US_DECLARE, color, &simgrid::instr::user_vm_variables); } /** \ingroup TRACE_user_variables @@ -438,7 +440,7 @@ void TRACE_vm_variable_sub (const char *vm, const char *variable, double value) */ void TRACE_vm_variable_set_with_time (double time, const char *vm, const char *variable, double value) { - instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SET, nullptr, &user_vm_variables); + instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SET, nullptr, &simgrid::instr::user_vm_variables); } /** \ingroup TRACE_user_variables @@ -458,7 +460,7 @@ void TRACE_vm_variable_set_with_time (double time, const char *vm, const char *v */ void TRACE_vm_variable_add_with_time (double time, const char *vm, const char *variable, double value) { - instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_ADD, nullptr, &user_vm_variables); + instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_ADD, nullptr, &simgrid::instr::user_vm_variables); } /** \ingroup TRACE_user_variables @@ -478,7 +480,7 @@ void TRACE_vm_variable_add_with_time (double time, const char *vm, const char *v */ void TRACE_vm_variable_sub_with_time (double time, const char *vm, const char *variable, double value) { - instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SUB, nullptr, &user_vm_variables); + instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SUB, nullptr, &simgrid::instr::user_vm_variables); } /* for host variables */ @@ -495,7 +497,7 @@ void TRACE_vm_variable_sub_with_time (double time, const char *vm, const char *v */ void TRACE_host_variable_declare (const char *variable) { - instr_user_variable(0, nullptr, variable, "HOST", 0, INSTR_US_DECLARE, nullptr, &user_host_variables); + instr_user_variable(0, nullptr, variable, "HOST", 0, INSTR_US_DECLARE, nullptr, &simgrid::instr::user_host_variables); } /** \ingroup TRACE_user_variables @@ -510,7 +512,7 @@ void TRACE_host_variable_declare (const char *variable) */ void TRACE_host_variable_declare_with_color (const char *variable, const char *color) { - instr_user_variable(0, nullptr, variable, "HOST", 0, INSTR_US_DECLARE, color, &user_host_variables); + instr_user_variable(0, nullptr, variable, "HOST", 0, INSTR_US_DECLARE, color, &simgrid::instr::user_host_variables); } /** \ingroup TRACE_user_variables @@ -572,7 +574,7 @@ void TRACE_host_variable_sub (const char *host, const char *variable, double val */ void TRACE_host_variable_set_with_time (double time, const char *host, const char *variable, double value) { - instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SET, nullptr, &user_host_variables); + instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SET, nullptr, &simgrid::instr::user_host_variables); } /** \ingroup TRACE_user_variables @@ -592,7 +594,7 @@ void TRACE_host_variable_set_with_time (double time, const char *host, const cha */ void TRACE_host_variable_add_with_time (double time, const char *host, const char *variable, double value) { - instr_user_variable(time, host, variable, "HOST", value, INSTR_US_ADD, nullptr, &user_host_variables); + instr_user_variable(time, host, variable, "HOST", value, INSTR_US_ADD, nullptr, &simgrid::instr::user_host_variables); } /** \ingroup TRACE_user_variables @@ -612,7 +614,7 @@ void TRACE_host_variable_add_with_time (double time, const char *host, const cha */ void TRACE_host_variable_sub_with_time (double time, const char *host, const char *variable, double value) { - instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SUB, nullptr, &user_host_variables); + instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SUB, nullptr, &simgrid::instr::user_host_variables); } /** \ingroup TRACE_user_variables @@ -625,7 +627,7 @@ void TRACE_host_variable_sub_with_time (double time, const char *host, const cha */ xbt_dynar_t TRACE_get_host_variables () { - return instr_set_to_dynar(&user_host_variables); + return instr_set_to_dynar(&simgrid::instr::user_host_variables); } /* for link variables */ @@ -642,7 +644,7 @@ xbt_dynar_t TRACE_get_host_variables () */ void TRACE_link_variable_declare (const char *variable) { - instr_user_variable(0, nullptr, variable, "LINK", 0, INSTR_US_DECLARE, nullptr, &user_link_variables); + instr_user_variable(0, nullptr, variable, "LINK", 0, INSTR_US_DECLARE, nullptr, &simgrid::instr::user_link_variables); } /** \ingroup TRACE_user_variables @@ -657,7 +659,7 @@ void TRACE_link_variable_declare (const char *variable) */ void TRACE_link_variable_declare_with_color (const char *variable, const char *color) { - instr_user_variable(0, nullptr, variable, "LINK", 0, INSTR_US_DECLARE, color, &user_link_variables); + instr_user_variable(0, nullptr, variable, "LINK", 0, INSTR_US_DECLARE, color, &simgrid::instr::user_link_variables); } /** \ingroup TRACE_user_variables @@ -719,7 +721,7 @@ void TRACE_link_variable_sub (const char *link, const char *variable, double val */ void TRACE_link_variable_set_with_time (double time, const char *link, const char *variable, double value) { - instr_user_variable(time, link, variable, "LINK", value, INSTR_US_SET, nullptr, &user_link_variables); + instr_user_variable(time, link, variable, "LINK", value, INSTR_US_SET, nullptr, &simgrid::instr::user_link_variables); } /** \ingroup TRACE_user_variables @@ -739,7 +741,7 @@ void TRACE_link_variable_set_with_time (double time, const char *link, const cha */ void TRACE_link_variable_add_with_time (double time, const char *link, const char *variable, double value) { - instr_user_variable(time, link, variable, "LINK", value, INSTR_US_ADD, nullptr, &user_link_variables); + instr_user_variable(time, link, variable, "LINK", value, INSTR_US_ADD, nullptr, &simgrid::instr::user_link_variables); } /** \ingroup TRACE_user_variables @@ -759,7 +761,7 @@ void TRACE_link_variable_add_with_time (double time, const char *link, const cha */ void TRACE_link_variable_sub_with_time (double time, const char *link, const char *variable, double value) { - instr_user_variable(time, link, variable, "LINK", value, INSTR_US_SUB, nullptr, &user_link_variables); + instr_user_variable(time, link, variable, "LINK", value, INSTR_US_SUB, nullptr, &simgrid::instr::user_link_variables); } /* for link variables, but with src and dst used for get_route */ @@ -896,7 +898,7 @@ void TRACE_link_srcdst_variable_sub_with_time (double time, const char *src, con */ xbt_dynar_t TRACE_get_link_variables () { - return instr_set_to_dynar(&user_link_variables); + return instr_set_to_dynar(&simgrid::instr::user_link_variables); } /** \ingroup TRACE_user_variables @@ -945,10 +947,10 @@ void TRACE_host_state_declare_value (const char *state, const char *value, const void TRACE_host_set_state(const char* host, const char* state, const char* value_str) { container_t container = PJ_container_get(host); - Type* type = PJ_type_get (state, container->type); - Value* val = - Value::get_or_new(value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */ - new SetStateEvent(MSG_get_clock(), container, type, val); + simgrid::instr::Type* type = PJ_type_get(state, container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get_or_new( + value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */ + new simgrid::instr::SetStateEvent(MSG_get_clock(), container, type, val); } /** \ingroup TRACE_user_variables @@ -965,10 +967,10 @@ void TRACE_host_set_state(const char* host, const char* state, const char* value void TRACE_host_push_state(const char* host, const char* state, const char* value_str) { container_t container = PJ_container_get(host); - Type* type = PJ_type_get (state, container->type); - Value* val = - Value::get_or_new(value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */ - new PushStateEvent(MSG_get_clock(), container, type, val); + simgrid::instr::Type* type = PJ_type_get(state, container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get_or_new( + value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */ + new simgrid::instr::PushStateEvent(MSG_get_clock(), container, type, val); } /** \ingroup TRACE_user_variables @@ -984,8 +986,8 @@ void TRACE_host_push_state(const char* host, const char* state, const char* valu void TRACE_host_pop_state (const char *host, const char *state) { container_t container = PJ_container_get(host); - Type* type = PJ_type_get (state, container->type); - new PopStateEvent(MSG_get_clock(), container, type); + simgrid::instr::Type* type = PJ_type_get(state, container->type); + new simgrid::instr::PopStateEvent(MSG_get_clock(), container, type); } /** \ingroup TRACE_API diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index 7bae0bb849..3fd13280c2 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -38,7 +38,7 @@ void PJ_container_set_root (container_t root) rootContainer = root; } -container_t PJ_container_new (const char *name, e_container_types kind, container_t father) +container_t PJ_container_new(const char* name, simgrid::instr::e_container_types kind, container_t father) { if (name == nullptr){ THROWF (tracing_error, 0, "can't create a container with a nullptr name"); @@ -49,7 +49,7 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe snprintf (id_str, INSTR_DEFAULT_STR_SIZE, "%lld", container_id); container_id++; - container_t newContainer = xbt_new0(s_container, 1); + container_t newContainer = xbt_new0(simgrid::instr::s_container, 1); newContainer->name = xbt_strdup (name); // name of the container newContainer->id = xbt_strdup (id_str); // id (or alias) of the container newContainer->father = father; @@ -57,15 +57,15 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe //Search for network_element_t switch (kind){ - case INSTR_HOST: + case simgrid::instr::INSTR_HOST: newContainer->netpoint = sg_host->pimpl_netpoint; xbt_assert(newContainer->netpoint, "Element '%s' not found", name); break; - case INSTR_ROUTER: + case simgrid::instr::INSTR_ROUTER: newContainer->netpoint = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name); xbt_assert(newContainer->netpoint, "Element '%s' not found", name); break; - case INSTR_AS: + case simgrid::instr::INSTR_AS: newContainer->netpoint = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name); xbt_assert(newContainer->netpoint, "Element '%s' not found", name); break; @@ -83,50 +83,50 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe } // type definition (method depends on kind of this new container) newContainer->kind = kind; - if (newContainer->kind == INSTR_AS){ + if (newContainer->kind == simgrid::instr::INSTR_AS) { //if this container is of an AS, its type name depends on its level char as_typename[INSTR_DEFAULT_STR_SIZE]; snprintf (as_typename, INSTR_DEFAULT_STR_SIZE, "L%d", newContainer->level); if (newContainer->father){ - newContainer->type = Type::getOrNull (as_typename, newContainer->father->type); + newContainer->type = simgrid::instr::Type::getOrNull(as_typename, newContainer->father->type); if (newContainer->type == nullptr){ - newContainer->type = Type::containerNew (as_typename, newContainer->father->type); + newContainer->type = simgrid::instr::Type::containerNew(as_typename, newContainer->father->type); } }else{ - newContainer->type = Type::containerNew ("0", nullptr); + newContainer->type = simgrid::instr::Type::containerNew("0", nullptr); } }else{ //otherwise, the name is its kind char typeNameBuff[INSTR_DEFAULT_STR_SIZE]; switch (newContainer->kind){ - case INSTR_HOST: + case simgrid::instr::INSTR_HOST: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "HOST"); break; - case INSTR_LINK: + case simgrid::instr::INSTR_LINK: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "LINK"); break; - case INSTR_ROUTER: + case simgrid::instr::INSTR_ROUTER: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "ROUTER"); break; - case INSTR_SMPI: + case simgrid::instr::INSTR_SMPI: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MPI"); break; - case INSTR_MSG_PROCESS: + case simgrid::instr::INSTR_MSG_PROCESS: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_PROCESS"); break; - case INSTR_MSG_VM: + case simgrid::instr::INSTR_MSG_VM: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_VM"); break; - case INSTR_MSG_TASK: + case simgrid::instr::INSTR_MSG_TASK: snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_TASK"); break; default: THROWF (tracing_error, 0, "new container kind is unknown."); break; } - Type* type = Type::getOrNull (typeNameBuff, newContainer->father->type); + simgrid::instr::Type* type = simgrid::instr::Type::getOrNull(typeNameBuff, newContainer->father->type); if (type == nullptr){ - newContainer->type = Type::containerNew (typeNameBuff, newContainer->father->type); + newContainer->type = simgrid::instr::Type::containerNew(typeNameBuff, newContainer->father->type); }else{ newContainer->type = type; } @@ -146,7 +146,8 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe XBT_DEBUG("Add container name '%s'",newContainer->name); //register NODE types for triva configuration - if (newContainer->kind == INSTR_HOST || newContainer->kind == INSTR_LINK || newContainer->kind == INSTR_ROUTER) { + if (newContainer->kind == simgrid::instr::INSTR_HOST || newContainer->kind == simgrid::instr::INSTR_LINK || + newContainer->kind == simgrid::instr::INSTR_ROUTER) { trivaNodeTypes.insert(newContainer->type->name); } return newContainer; @@ -195,7 +196,7 @@ void PJ_container_free (container_t container) //obligation to dump previous events because they might //reference the container that is about to be destroyed - TRACE_last_timestamp_to_dump = surf_get_clock(); + simgrid::instr::TRACE_last_timestamp_to_dump = surf_get_clock(); TRACE_paje_dump_buffer(1); //trace my destruction diff --git a/src/instr/instr_paje_header.cpp b/src/instr/instr_paje_header.cpp index d0b48b1853..4f49363a9b 100644 --- a/src/instr/instr_paje_header.cpp +++ b/src/instr/instr_paje_header.cpp @@ -13,7 +13,7 @@ extern FILE *tracing_file; static void TRACE_header_PajeDefineContainerType (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeDefineContainerType %d\n", PAJE_DefineContainerType); + fprintf(tracing_file, "%%EventDef PajeDefineContainerType %d\n", simgrid::instr::PAJE_DefineContainerType); fprintf(tracing_file, "%% Alias string\n"); if (basic){ fprintf(tracing_file, "%% ContainerType string\n"); @@ -26,7 +26,7 @@ static void TRACE_header_PajeDefineContainerType (int basic, int size) static void TRACE_header_PajeDefineVariableType (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeDefineVariableType %d\n", PAJE_DefineVariableType); + fprintf(tracing_file, "%%EventDef PajeDefineVariableType %d\n", simgrid::instr::PAJE_DefineVariableType); fprintf(tracing_file, "%% Alias string\n"); if (basic){ fprintf(tracing_file, "%% ContainerType string\n"); @@ -40,7 +40,7 @@ static void TRACE_header_PajeDefineVariableType (int basic, int size) static void TRACE_header_PajeDefineStateType (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeDefineStateType %d\n", PAJE_DefineStateType); + fprintf(tracing_file, "%%EventDef PajeDefineStateType %d\n", simgrid::instr::PAJE_DefineStateType); fprintf(tracing_file, "%% Alias string\n"); if (basic){ fprintf(tracing_file, "%% ContainerType string\n"); @@ -53,7 +53,7 @@ static void TRACE_header_PajeDefineStateType (int basic, int size) static void TRACE_header_PajeDefineEventType (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeDefineEventType %d\n", PAJE_DefineEventType); + fprintf(tracing_file, "%%EventDef PajeDefineEventType %d\n", simgrid::instr::PAJE_DefineEventType); fprintf(tracing_file, "%% Alias string\n"); if (basic){ fprintf(tracing_file, "%% ContainerType string\n"); @@ -66,7 +66,7 @@ static void TRACE_header_PajeDefineEventType (int basic, int size) static void TRACE_header_PajeDefineLinkType (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeDefineLinkType %d\n", PAJE_DefineLinkType); + fprintf(tracing_file, "%%EventDef PajeDefineLinkType %d\n", simgrid::instr::PAJE_DefineLinkType); fprintf(tracing_file, "%% Alias string\n"); if (basic){ fprintf(tracing_file, "%% ContainerType string\n"); @@ -83,7 +83,7 @@ static void TRACE_header_PajeDefineLinkType (int basic, int size) static void TRACE_header_PajeDefineEntityValue (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeDefineEntityValue %d\n", PAJE_DefineEntityValue); + fprintf(tracing_file, "%%EventDef PajeDefineEntityValue %d\n", simgrid::instr::PAJE_DefineEntityValue); fprintf(tracing_file, "%% Alias string\n"); if (basic){ fprintf(tracing_file, "%% EntityType string\n"); @@ -97,7 +97,7 @@ static void TRACE_header_PajeDefineEntityValue (int basic, int size) static void TRACE_header_PajeCreateContainer (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeCreateContainer %d\n", PAJE_CreateContainer); + fprintf(tracing_file, "%%EventDef PajeCreateContainer %d\n", simgrid::instr::PAJE_CreateContainer); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Alias string\n"); fprintf(tracing_file, "%% Type string\n"); @@ -108,7 +108,7 @@ static void TRACE_header_PajeCreateContainer (int basic, int size) static void TRACE_header_PajeDestroyContainer (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeDestroyContainer %d\n", PAJE_DestroyContainer); + fprintf(tracing_file, "%%EventDef PajeDestroyContainer %d\n", simgrid::instr::PAJE_DestroyContainer); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Name string\n"); @@ -117,7 +117,7 @@ static void TRACE_header_PajeDestroyContainer (int basic, int size) static void TRACE_header_PajeSetVariable (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeSetVariable %d\n", PAJE_SetVariable); + fprintf(tracing_file, "%%EventDef PajeSetVariable %d\n", simgrid::instr::PAJE_SetVariable); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Container string\n"); @@ -127,7 +127,7 @@ static void TRACE_header_PajeSetVariable (int basic, int size) static void TRACE_header_PajeAddVariable (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeAddVariable %d\n", PAJE_AddVariable); + fprintf(tracing_file, "%%EventDef PajeAddVariable %d\n", simgrid::instr::PAJE_AddVariable); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Container string\n"); @@ -137,7 +137,7 @@ static void TRACE_header_PajeAddVariable (int basic, int size) static void TRACE_header_PajeSubVariable (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeSubVariable %d\n", PAJE_SubVariable); + fprintf(tracing_file, "%%EventDef PajeSubVariable %d\n", simgrid::instr::PAJE_SubVariable); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Container string\n"); @@ -148,7 +148,7 @@ static void TRACE_header_PajeSubVariable (int basic, int size) static void TRACE_header_PajeSetState (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeSetState %d\n", PAJE_SetState); + fprintf(tracing_file, "%%EventDef PajeSetState %d\n", simgrid::instr::PAJE_SetState); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Container string\n"); @@ -158,7 +158,7 @@ static void TRACE_header_PajeSetState (int basic, int size) static void TRACE_header_PajePushState (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajePushState %d\n", PAJE_PushState); + fprintf(tracing_file, "%%EventDef PajePushState %d\n", simgrid::instr::PAJE_PushState); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Container string\n"); @@ -179,7 +179,7 @@ static void TRACE_header_PajePushState (int basic, int size) static void TRACE_header_PajePopState (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajePopState %d\n", PAJE_PopState); + fprintf(tracing_file, "%%EventDef PajePopState %d\n", simgrid::instr::PAJE_PopState); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Container string\n"); @@ -190,7 +190,7 @@ static void TRACE_header_PajeResetState (int basic, int size) { if (basic) return; - fprintf(tracing_file, "%%EventDef PajeResetState %d\n", PAJE_ResetState); + fprintf(tracing_file, "%%EventDef PajeResetState %d\n", simgrid::instr::PAJE_ResetState); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Container string\n"); @@ -199,7 +199,7 @@ static void TRACE_header_PajeResetState (int basic, int size) static void TRACE_header_PajeStartLink (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeStartLink %d\n", PAJE_StartLink); + fprintf(tracing_file, "%%EventDef PajeStartLink %d\n", simgrid::instr::PAJE_StartLink); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Container string\n"); @@ -216,7 +216,7 @@ static void TRACE_header_PajeStartLink (int basic, int size) static void TRACE_header_PajeEndLink (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeEndLink %d\n", PAJE_EndLink); + fprintf(tracing_file, "%%EventDef PajeEndLink %d\n", simgrid::instr::PAJE_EndLink); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Container string\n"); @@ -232,7 +232,7 @@ static void TRACE_header_PajeEndLink (int basic, int size) static void TRACE_header_PajeNewEvent (int basic, int size) { - fprintf(tracing_file, "%%EventDef PajeNewEvent %d\n", PAJE_NewEvent); + fprintf(tracing_file, "%%EventDef PajeNewEvent %d\n", simgrid::instr::PAJE_NewEvent); fprintf(tracing_file, "%% Time date\n"); fprintf(tracing_file, "%% Type string\n"); fprintf(tracing_file, "%% Container string\n"); diff --git a/src/instr/instr_paje_trace.cpp b/src/instr/instr_paje_trace.cpp index 84c6059dea..8efa88f174 100644 --- a/src/instr/instr_paje_trace.cpp +++ b/src/instr/instr_paje_trace.cpp @@ -27,8 +27,8 @@ FILE *tracing_file = nullptr; static xbt_dict_t tracing_files = nullptr; // TI specific static double prefix=0.0; // TI specific -std::vector buffer; -void buffer_debug(std::vector *buf); +std::vector buffer; +void buffer_debug(std::vector* buf); void dump_comment (const char *comment) { @@ -74,7 +74,7 @@ void TRACE_paje_dump_buffer (int force) } buffer.clear(); }else{ - std::vector::iterator i = buffer.begin(); + std::vector::iterator i = buffer.begin(); for (auto const& event : buffer) { double head_timestamp = event->timestamp; if (head_timestamp > TRACE_last_timestamp_to_dump) @@ -88,8 +88,9 @@ void TRACE_paje_dump_buffer (int force) XBT_DEBUG("%s: ends", __FUNCTION__); } -void buffer_debug(std::vector *buf); -void buffer_debug(std::vector *buf) { +void buffer_debug(std::vector* buf); +void buffer_debug(std::vector* buf) +{ return; XBT_DEBUG(">>>>>> Dump the state of the buffer. %zu events", buf->size()); for (auto const& event : *buf) { @@ -109,7 +110,8 @@ static void print_row() { stream.clear(); } -static void print_timestamp(PajeEvent* event) { +static void print_timestamp(simgrid::instr::PajeEvent* event) +{ stream << " "; /* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */ if (event->timestamp < 1e-12) @@ -119,7 +121,7 @@ static void print_timestamp(PajeEvent* event) { } /* internal do the instrumentation module */ -static void insert_into_buffer (PajeEvent* tbi) +static void insert_into_buffer(simgrid::instr::PajeEvent* tbi) { if (TRACE_buffer() == 0){ tbi->print (); @@ -130,9 +132,9 @@ static void insert_into_buffer (PajeEvent* tbi) XBT_DEBUG("%s: insert event_type=%d, timestamp=%f, buffersize=%zu)", __FUNCTION__, (int)tbi->event_type, tbi->timestamp, buffer.size()); - std::vector::reverse_iterator i; + std::vector::reverse_iterator i; for (i = buffer.rbegin(); i != buffer.rend(); ++i) { - PajeEvent* e1 = *i; + simgrid::instr::PajeEvent* e1 = *i; XBT_DEBUG("compare to %p is of type %d; timestamp:%f", e1, (int)e1->event_type, e1->timestamp); if (e1->timestamp <= tbi->timestamp) @@ -150,7 +152,7 @@ static void insert_into_buffer (PajeEvent* tbi) buffer_debug(&buffer); } -PajeEvent:: ~PajeEvent() +simgrid::instr::PajeEvent::~PajeEvent() { XBT_DEBUG("%s not implemented for %p: event_type=%d, timestamp=%f", __FUNCTION__, this, (int)event_type, timestamp); @@ -192,14 +194,15 @@ void TRACE_paje_end() { XBT_DEBUG("Filename %s is closed", filename); } -void DefineContainerEvent(Type* type) +void DefineContainerEvent(simgrid::instr::Type* type) { - XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineContainerType); + XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineContainerType); //print it if (instr_fmt_type == instr_fmt_paje) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineContainerType, TRACE_precision(), 0.); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineContainerType, + TRACE_precision(), 0.); stream << std::fixed << std::setprecision(TRACE_precision()); - stream << PAJE_DefineContainerType; + stream << simgrid::instr::PAJE_DefineContainerType; stream << " " << type->id << " " << type->father->id << " " << type->name; print_row(); } else if (instr_fmt_type == instr_fmt_TI) { @@ -210,20 +213,21 @@ void DefineContainerEvent(Type* type) //-- } -void LogVariableTypeDefinition(Type* type) +void LogVariableTypeDefinition(simgrid::instr::Type* type) { - XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineVariableType); + XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineVariableType); //print it 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 << PAJE_DefineVariableType; - stream << " " << type->id << " " << type->father->id << " " << type->name; - if (type->color) - stream << " \"" << type->color << "\""; - print_row(); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineVariableType, + TRACE_precision(), 0.); + stream << std::fixed << std::setprecision(TRACE_precision()); + stream << simgrid::instr::PAJE_DefineVariableType; + stream << " " << type->id << " " << type->father->id << " " << type->name; + if (type->color) + stream << " \"" << type->color << "\""; + print_row(); } else if (instr_fmt_type == instr_fmt_TI) { /* Nothing to do */ } else { @@ -231,15 +235,16 @@ if (instr_fmt_type == instr_fmt_paje) { } } -void LogStateTypeDefinition(Type* type) +void LogStateTypeDefinition(simgrid::instr::Type* type) { //print it 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 << PAJE_DefineStateType; - stream << " " << type->id << " " << type->father->id << " " << type->name; - print_row(); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineStateType, TRACE_precision(), + 0.); + stream << std::fixed << std::setprecision(TRACE_precision()); + stream << simgrid::instr::PAJE_DefineStateType; + stream << " " << type->id << " " << type->father->id << " " << type->name; + print_row(); } else if (instr_fmt_type == instr_fmt_TI) { /* Nothing to do */ } else { @@ -247,13 +252,14 @@ if (instr_fmt_type == instr_fmt_paje) { } } -void LogDefineEventType(Type* type) +void LogDefineEventType(simgrid::instr::Type* type) { //print it if (instr_fmt_type == instr_fmt_paje) { - XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineEventType, TRACE_precision(), 0.); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineEventType, + TRACE_precision(), 0.); stream << std::fixed << std::setprecision(TRACE_precision()); - stream << PAJE_DefineEventType; + stream << simgrid::instr::PAJE_DefineEventType; stream << " " << type->id << " " << type->father->id << " " << type->name; print_row(); } else if (instr_fmt_type == instr_fmt_TI) { @@ -263,16 +269,17 @@ void LogDefineEventType(Type* type) } } -void LogLinkTypeDefinition(Type* type, Type* source, Type* dest) +void LogLinkTypeDefinition(simgrid::instr::Type* type, simgrid::instr::Type* source, simgrid::instr::Type* dest) { - XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineLinkType); + XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineLinkType); //print it 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 << PAJE_DefineLinkType; - stream << " " << type->id << " " << type->father->id << " " << source->id << " " << dest->id << " " << type->name; - print_row(); + XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineLinkType, TRACE_precision(), + 0.); + stream << std::fixed << std::setprecision(TRACE_precision()); + stream << simgrid::instr::PAJE_DefineLinkType; + stream << " " << type->id << " " << type->father->id << " " << source->id << " " << dest->id << " " << type->name; + print_row(); } else if (instr_fmt_type == instr_fmt_TI) { /* Nothing to do */ } else { @@ -280,13 +287,13 @@ if (instr_fmt_type == instr_fmt_paje) { } } -void LogEntityValue(Value* val) +void LogEntityValue(simgrid::instr::Value* val) { - XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineEntityValue); + XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineEntityValue); //print it if (instr_fmt_type == instr_fmt_paje) { stream << std::fixed << std::setprecision(TRACE_precision()); - stream << PAJE_DefineEntityValue; + stream << simgrid::instr::PAJE_DefineEntityValue; stream << " " << val->id << " " << val->father->id << " " << val->name; if (val->color) stream << " \"" << val->color << "\""; @@ -301,13 +308,13 @@ if (instr_fmt_type == instr_fmt_paje) { void LogContainerCreation (container_t container) { - double timestamp = SIMIX_get_clock(); + double timestamp = SIMIX_get_clock(); - XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, PAJE_CreateContainer,timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, simgrid::instr::PAJE_CreateContainer, timestamp); -if (instr_fmt_type == instr_fmt_paje) { + if (instr_fmt_type == instr_fmt_paje) { stream << std::fixed << std::setprecision(TRACE_precision()); - stream << PAJE_CreateContainer; + stream << simgrid::instr::PAJE_CreateContainer; stream << " "; /* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */ if (timestamp < 1e-12) @@ -354,11 +361,11 @@ void LogContainerDestruction(container_t container) { double timestamp = SIMIX_get_clock(); - XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, PAJE_DestroyContainer, timestamp); + XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, simgrid::instr::PAJE_DestroyContainer, timestamp); -if (instr_fmt_type == instr_fmt_paje) { + if (instr_fmt_type == instr_fmt_paje) { stream << std::fixed << std::setprecision(TRACE_precision()); - stream << PAJE_DestroyContainer; + stream << simgrid::instr::PAJE_DestroyContainer; stream << " "; /* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */ if (timestamp < 1e-12) @@ -378,8 +385,7 @@ if (instr_fmt_type == instr_fmt_paje) { } } - -SetVariableEvent::SetVariableEvent (double timestamp, container_t container, Type* type, double value) +simgrid::instr::SetVariableEvent::SetVariableEvent(double timestamp, container_t container, Type* type, double value) { this->event_type = PAJE_SetVariable; this->timestamp = timestamp; @@ -392,7 +398,8 @@ SetVariableEvent::SetVariableEvent (double timestamp, container_t container, Typ insert_into_buffer (this); } -void SetVariableEvent::print() { +void simgrid::instr::SetVariableEvent::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()); @@ -407,7 +414,8 @@ void SetVariableEvent::print() { } } -AddVariableEvent::AddVariableEvent (double timestamp, container_t container, Type* type, double value) +simgrid::instr::AddVariableEvent::AddVariableEvent(double timestamp, container_t container, simgrid::instr::Type* type, + double value) { this->event_type = PAJE_AddVariable; this->timestamp = timestamp; @@ -420,7 +428,8 @@ AddVariableEvent::AddVariableEvent (double timestamp, container_t container, Typ insert_into_buffer (this); } -void AddVariableEvent::print() { +void simgrid::instr::AddVariableEvent::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()); @@ -435,7 +444,7 @@ void AddVariableEvent::print() { } } -SubVariableEvent::SubVariableEvent (double timestamp, container_t container, Type* type, double value) +simgrid::instr::SubVariableEvent::SubVariableEvent(double timestamp, container_t container, Type* type, double value) { this->event_type = PAJE_SubVariable; this->timestamp = timestamp; @@ -448,7 +457,8 @@ SubVariableEvent::SubVariableEvent (double timestamp, container_t container, Typ insert_into_buffer (this); } -void SubVariableEvent::print() { +void simgrid::instr::SubVariableEvent::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()); @@ -463,7 +473,7 @@ void SubVariableEvent::print() { } } -SetStateEvent::SetStateEvent(double timestamp, container_t container, Type* type, Value* val) +simgrid::instr::SetStateEvent::SetStateEvent(double timestamp, container_t container, Type* type, Value* val) { this->event_type = PAJE_SetState; this->timestamp = timestamp; @@ -484,7 +494,8 @@ SetStateEvent::SetStateEvent(double timestamp, container_t container, Type* type insert_into_buffer (this); } -void SetStateEvent::print() { +void simgrid::instr::SetStateEvent::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()); @@ -505,7 +516,8 @@ void SetStateEvent::print() { } } -PushStateEvent::PushStateEvent(double timestamp, container_t container, Type* type, Value* val, void* extra) +simgrid::instr::PushStateEvent::PushStateEvent(double timestamp, container_t container, Type* type, Value* val, + void* extra) { this->event_type = PAJE_PushState; this->timestamp = timestamp; @@ -527,10 +539,11 @@ PushStateEvent::PushStateEvent(double timestamp, container_t container, Type* ty insert_into_buffer (this); } -PushStateEvent::PushStateEvent(double timestamp, container_t container, Type* type, Value* val) +simgrid::instr::PushStateEvent::PushStateEvent(double timestamp, container_t container, Type* type, Value* val) : PushStateEvent(timestamp, container, type, val, nullptr) {} -void PushStateEvent::print() { +void simgrid::instr::PushStateEvent::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()); @@ -694,8 +707,7 @@ void PushStateEvent::print() { } } - -PopStateEvent::PopStateEvent (double timestamp, container_t container, Type* type) +simgrid::instr::PopStateEvent::PopStateEvent(double timestamp, container_t container, Type* type) { this->event_type = PAJE_PopState; this->timestamp = timestamp; @@ -707,7 +719,8 @@ PopStateEvent::PopStateEvent (double timestamp, container_t container, Type* typ insert_into_buffer (this); } -void PopStateEvent::print() { +void simgrid::instr::PopStateEvent::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()); @@ -722,7 +735,7 @@ void PopStateEvent::print() { } } -ResetStateEvent::ResetStateEvent (double timestamp, container_t container, Type* type) +simgrid::instr::ResetStateEvent::ResetStateEvent(double timestamp, container_t container, Type* type) { this->event_type = PAJE_ResetState; this->timestamp = timestamp; @@ -735,7 +748,8 @@ ResetStateEvent::ResetStateEvent (double timestamp, container_t container, Type* delete[] this; } -void ResetStateEvent::print() { +void simgrid::instr::ResetStateEvent::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()); @@ -750,18 +764,19 @@ void ResetStateEvent::print() { } } -StartLinkEvent::~StartLinkEvent() +simgrid::instr::StartLinkEvent::~StartLinkEvent() { free(value); free(key); } -StartLinkEvent::StartLinkEvent (double timestamp, container_t container, - Type* type, container_t sourceContainer, const char *value, const char *key) - : StartLinkEvent(timestamp, container, type, sourceContainer, value, key, -1) +simgrid::instr::StartLinkEvent::StartLinkEvent(double timestamp, container_t container, Type* type, + container_t sourceContainer, const char* value, const char* key) + : StartLinkEvent(timestamp, container, type, sourceContainer, value, key, -1) {} -StartLinkEvent::StartLinkEvent (double timestamp, container_t container, Type* type, container_t sourceContainer, - const char *value, const char *key, int size) +simgrid::instr::StartLinkEvent::StartLinkEvent(double timestamp, container_t container, Type* type, + container_t sourceContainer, const char* value, const char* key, + int size) { event_type = PAJE_StartLink; this->timestamp = timestamp; @@ -778,7 +793,8 @@ StartLinkEvent::StartLinkEvent (double timestamp, container_t container, Type* t insert_into_buffer (this); } -void StartLinkEvent::print() { +void simgrid::instr::StartLinkEvent::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()); @@ -798,8 +814,8 @@ void StartLinkEvent::print() { } } -EndLinkEvent::EndLinkEvent (double timestamp, container_t container, Type* type, container_t destContainer, - const char *value, const char *key) +simgrid::instr::EndLinkEvent::EndLinkEvent(double timestamp, container_t container, Type* type, + container_t destContainer, const char* value, const char* key) { this->event_type = PAJE_EndLink; this->timestamp = timestamp; @@ -814,12 +830,13 @@ EndLinkEvent::EndLinkEvent (double timestamp, container_t container, Type* type, insert_into_buffer (this); } -EndLinkEvent::~EndLinkEvent() +simgrid::instr::EndLinkEvent::~EndLinkEvent() { free(value); free(key); } -void EndLinkEvent::print() { +void simgrid::instr::EndLinkEvent::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()); @@ -835,7 +852,7 @@ void EndLinkEvent::print() { } } -NewEvent::NewEvent(double timestamp, container_t container, Type* type, Value* val) +simgrid::instr::NewEvent::NewEvent(double timestamp, container_t container, Type* type, Value* val) { this->event_type = PAJE_NewEvent; this->timestamp = timestamp; @@ -848,7 +865,8 @@ NewEvent::NewEvent(double timestamp, container_t container, Type* type, Value* v insert_into_buffer (this); } -void NewEvent::print () { +void simgrid::instr::NewEvent::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()); diff --git a/src/instr/instr_paje_types.cpp b/src/instr/instr_paje_types.cpp index c5ccbfa4c1..2dae9593c0 100644 --- a/src/instr/instr_paje_types.cpp +++ b/src/instr/instr_paje_types.cpp @@ -8,19 +8,20 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_types, instr, "Paje tracing event system (types)"); -static Type* rootType = nullptr; /* the root type */ +static simgrid::instr::Type* rootType = nullptr; /* the root type */ void PJ_type_release () { rootType = nullptr; } -Type* PJ_type_get_root() +simgrid::instr::Type* PJ_type_get_root() { return rootType; } -Type::Type (const char *typeNameBuff, const char *key, const char *color, e_entity_types kind, Type* father) +simgrid::instr::Type::Type(const char* typeNameBuff, const char* key, const char* color, e_entity_types kind, + Type* father) { if (typeNameBuff == nullptr || key == nullptr){ THROWF(tracing_error, 0, "can't create a new type with name or key equal nullptr"); @@ -43,9 +44,9 @@ Type::Type (const char *typeNameBuff, const char *key, const char *color, e_enti } } -void PJ_type_free(Type* type) +void PJ_type_free(simgrid::instr::Type* type) { - Value* val; + simgrid::instr::Value* val; char *value_name; xbt_dict_cursor_t cursor = nullptr; xbt_dict_foreach (type->values, cursor, value_name, val) { @@ -61,11 +62,11 @@ void PJ_type_free(Type* type) type = nullptr; } -void recursiveDestroyType(Type* type) +void recursiveDestroyType(simgrid::instr::Type* type) { XBT_DEBUG("recursiveDestroyType %s", type->name); xbt_dict_cursor_t cursor = nullptr; - Type* child; + simgrid::instr::Type* child; char *child_name; xbt_dict_foreach(type->children, cursor, child_name, child) { recursiveDestroyType (child); @@ -73,23 +74,23 @@ void recursiveDestroyType(Type* type) PJ_type_free(type); } -Type* PJ_type_get(const char* name, Type* father) +simgrid::instr::Type* PJ_type_get(const char* name, simgrid::instr::Type* father) { - Type* ret = Type::getOrNull (name, father); + simgrid::instr::Type* ret = simgrid::instr::Type::getOrNull(name, father); if (ret == nullptr){ THROWF (tracing_error, 2, "type with name (%s) not found in father type (%s)", name, father->name); } return ret; } -Type* Type::getOrNull(const char* name, Type* father) +simgrid::instr::Type* simgrid::instr::Type::getOrNull(const char* name, simgrid::instr::Type* father) { if (name == nullptr || father == nullptr){ THROWF (tracing_error, 0, "can't get type with a nullptr name or from a nullptr father"); } - Type* ret = nullptr; - Type* child; + simgrid::instr::Type* ret = nullptr; + simgrid::instr::Type* child; char *child_name; xbt_dict_cursor_t cursor = nullptr; xbt_dict_foreach(father->children, cursor, child_name, child) { @@ -104,13 +105,13 @@ Type* Type::getOrNull(const char* name, Type* father) return ret; } -Type* Type::containerNew(const char* name, Type* father) +simgrid::instr::Type* simgrid::instr::Type::containerNew(const char* name, simgrid::instr::Type* father) { if (name == nullptr){ THROWF (tracing_error, 0, "can't create a container type with a nullptr name"); } - Type* ret = new Type (name, name, nullptr, TYPE_CONTAINER, father); + simgrid::instr::Type* ret = new simgrid::instr::Type(name, name, nullptr, TYPE_CONTAINER, father); if (father == nullptr) { rootType = ret; } else { @@ -120,7 +121,7 @@ Type* Type::containerNew(const char* name, Type* father) return ret; } -Type* Type::eventNew(const char* name, Type* father) +simgrid::instr::Type* simgrid::instr::Type::eventNew(const char* name, simgrid::instr::Type* father) { if (name == nullptr){ THROWF (tracing_error, 0, "can't create an event type with a nullptr name"); @@ -132,7 +133,8 @@ Type* Type::eventNew(const char* name, Type* father) return ret; } -Type* Type::variableNew(const char* name, const char* color, Type* father) +simgrid::instr::Type* simgrid::instr::Type::variableNew(const char* name, const char* color, + simgrid::instr::Type* father) { if (name == nullptr){ THROWF (tracing_error, 0, "can't create a variable type with a nullptr name"); @@ -151,7 +153,7 @@ Type* Type::variableNew(const char* name, const char* color, Type* father) return ret; } -Type* Type::linkNew(const char* name, Type* father, Type* source, Type* dest) +simgrid::instr::Type* simgrid::instr::Type::linkNew(const char* name, Type* father, Type* source, Type* dest) { if (name == nullptr){ THROWF (tracing_error, 0, "can't create a link type with a nullptr name"); @@ -168,7 +170,7 @@ Type* Type::linkNew(const char* name, Type* father, Type* source, Type* dest) return ret; } -Type* Type::stateNew(const char* name, Type* father) +simgrid::instr::Type* simgrid::instr::Type::stateNew(const char* name, Type* father) { if (name == nullptr){ THROWF (tracing_error, 0, "can't create a state type with a nullptr name"); diff --git a/src/instr/instr_paje_values.cpp b/src/instr/instr_paje_values.cpp index 020735bad2..8847a5e46a 100644 --- a/src/instr/instr_paje_values.cpp +++ b/src/instr/instr_paje_values.cpp @@ -10,7 +10,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_values, instr, "Paje tracing event system (values)"); -Value::Value(const char* name, const char* color, Type* father) +simgrid::instr::Value::Value(const char* name, const char* color, simgrid::instr::Type* father) { if (name == nullptr || father == nullptr){ THROWF (tracing_error, 0, "can't create a value with a nullptr name (or a nullptr father)"); @@ -29,7 +29,7 @@ Value::Value(const char* name, const char* color, Type* father) LogEntityValue(this->ret); }; -Value::~Value() +simgrid::instr::Value::~Value() { /* FIXME: this should be cleanable xbt_free(name); @@ -38,7 +38,8 @@ Value::~Value() */ } -Value* Value::get_or_new(const char* name, const char* color, Type* father) +simgrid::instr::Value* simgrid::instr::Value::get_or_new(const char* name, const char* color, + simgrid::instr::Type* father) { Value* ret = 0; try { @@ -51,7 +52,7 @@ Value* Value::get_or_new(const char* name, const char* color, Type* father) return ret; } -Value* Value::get(const char* name, Type* father) +simgrid::instr::Value* simgrid::instr::Value::get(const char* name, Type* father) { if (name == nullptr || father == nullptr){ THROWF (tracing_error, 0, "can't get a value with a nullptr name (or a nullptr father)"); diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index bc9a49c044..01e0e10c78 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -27,6 +27,8 @@ SG_BEGIN_DECL() #include "xbt/graph.h" #include "xbt/dict.h" +namespace simgrid { +namespace instr { typedef enum { PAJE_DefineContainerType, PAJE_DefineVariableType, @@ -106,8 +108,6 @@ typedef enum { } e_container_types; //-------------------------------------------------- -class s_container; -typedef s_container *container_t; class s_container { public: @@ -153,22 +153,24 @@ public: class SetVariableEvent : public PajeEvent { private: - container_t container; - Type* type; - double value; + s_container* container; + Type* type; + double value; + public: - SetVariableEvent(double timestamp, container_t container, Type* type, double value); + SetVariableEvent(double timestamp, s_container* container, Type* type, double value); void print() override; }; class AddVariableEvent:public PajeEvent { private: - container_t container; - Type* type; - double value; + s_container* container; + Type* type; + double value; + public: - AddVariableEvent(double timestamp, container_t container, Type* type, double value); + AddVariableEvent(double timestamp, s_container* container, Type* type, double value); void print() override; }; @@ -177,86 +179,90 @@ class AddVariableEvent:public PajeEvent { class SubVariableEvent : public PajeEvent { private: - container_t container; - Type* type; - double value; + s_container* container; + Type* type; + double value; + public: - SubVariableEvent(double timestamp, container_t container, Type* type, double value); + SubVariableEvent(double timestamp, s_container* container, Type* type, double value); void print() override; }; //-------------------------------------------------- class SetStateEvent : public PajeEvent { private: - container_t container; - Type* type; - Value* val; - const char* filename; - int linenumber; + s_container* container; + Type* type; + Value* val; + const char* filename; + int linenumber; + public: - SetStateEvent(double timestamp, container_t container, Type* type, Value* val); + SetStateEvent(double timestamp, s_container* container, Type* type, Value* val); void print() override; }; class PushStateEvent : public PajeEvent { public: - container_t container; - Type* type; - Value* val; - int size; - const char* filename; - int linenumber; - void* extra_; + s_container* container; + Type* type; + Value* val; + int size; + const char* filename; + int linenumber; + void* extra_; + public: - PushStateEvent(double timestamp, container_t container, Type* type, Value* val); - PushStateEvent(double timestamp, container_t container, Type* type, Value* val, void* extra); + PushStateEvent(double timestamp, s_container* container, Type* type, Value* val); + PushStateEvent(double timestamp, s_container* container, Type* type, Value* val, void* extra); void print() override; }; class PopStateEvent : public PajeEvent { - container_t container; + s_container* container; Type* type; public: - PopStateEvent(double timestamp, container_t container, Type* type); + PopStateEvent(double timestamp, s_container* container, Type* type); void print() override; }; class ResetStateEvent : public PajeEvent { - container_t container; + s_container* container; Type* type; public: - ResetStateEvent(double timestamp, container_t container, Type* type); + ResetStateEvent(double timestamp, s_container* container, Type* type); void print() override; }; class StartLinkEvent : public PajeEvent { public: - container_t container; - Type* type; - container_t sourceContainer; - char *value; - char *key; - int size; + s_container* container; + Type* type; + s_container* sourceContainer; + char* value; + char* key; + int size; + public: ~StartLinkEvent(); - StartLinkEvent(double timestamp, container_t container, Type* type, container_t sourceContainer, const char* value, - const char* key); - StartLinkEvent(double timestamp, container_t container, Type* type, container_t sourceContainer, const char* value, - const char* key, int size); + StartLinkEvent(double timestamp, s_container* container, Type* type, s_container* sourceContainer, + const char* value, const char* key); + StartLinkEvent(double timestamp, s_container* container, Type* type, s_container* sourceContainer, + const char* value, const char* key, int size); void print() override; }; class EndLinkEvent : public PajeEvent { - container_t container; + s_container* container; Type* type; - container_t destContainer; + s_container* destContainer; char *value; char *key; public: - EndLinkEvent(double timestamp, container_t container, Type* type, container_t destContainer, const char* value, + EndLinkEvent(double timestamp, s_container* container, Type* type, s_container* destContainer, const char* value, const char* key); ~EndLinkEvent(); void print() override; @@ -265,14 +271,13 @@ class EndLinkEvent : public PajeEvent { class NewEvent : public PajeEvent { public: - container_t container; - Type* type; - Value* val; - -public: - NewEvent(double timestamp, container_t container, Type* type, Value* val); - void print() override; + s_container* container; + Type* type; + Value* val; + public: + NewEvent(double timestamp, s_container* container, Type* type, Value* val); + void print() override; }; extern XBT_PRIVATE std::set created_categories; @@ -281,6 +286,9 @@ extern XBT_PRIVATE std::set user_host_variables; extern XBT_PRIVATE std::set user_vm_variables; extern XBT_PRIVATE std::set user_link_variables; extern XBT_PRIVATE double TRACE_last_timestamp_to_dump; +} +} // namespace simgrid::instr +typedef simgrid::instr::s_container* container_t; /* instr_paje_header.c */ XBT_PRIVATE void TRACE_header(int basic, int size); @@ -339,7 +347,7 @@ extern XBT_PRIVATE std::set trivaEdgeTypes; XBT_PRIVATE long long int instr_new_paje_id (); XBT_PRIVATE void PJ_container_alloc (); XBT_PRIVATE void PJ_container_release (); -XBT_PUBLIC(container_t) PJ_container_new (const char *name, e_container_types kind, container_t father); +XBT_PUBLIC(container_t) PJ_container_new(const char* name, simgrid::instr::e_container_types kind, container_t father); XBT_PUBLIC(container_t) PJ_container_get (const char *name); XBT_PUBLIC(container_t) PJ_container_get_or_null (const char *name); XBT_PUBLIC(container_t) PJ_container_get_root (); @@ -350,12 +358,12 @@ XBT_PUBLIC(void) PJ_container_remove_from_parent (container_t container); /* instr_paje_types.c */ XBT_PRIVATE void PJ_type_release (); -XBT_PUBLIC(Type*) PJ_type_get_root(); -XBT_PUBLIC(Type*) PJ_type_get(const char* name, Type* father); -XBT_PRIVATE XBT_PRIVATE void PJ_type_free(Type* type); +XBT_PUBLIC(simgrid::instr::Type*) PJ_type_get_root(); +XBT_PUBLIC(simgrid::instr::Type*) PJ_type_get(const char* name, simgrid::instr::Type* father); +XBT_PRIVATE XBT_PRIVATE void PJ_type_free(simgrid::instr::Type* type); /* instr_config.c */ -XBT_PRIVATE void recursiveDestroyType(Type* type); +XBT_PRIVATE void recursiveDestroyType(simgrid::instr::Type* type); XBT_PRIVATE void TRACE_TI_start(); XBT_PRIVATE void TRACE_TI_end(); @@ -429,13 +437,13 @@ extern instr_fmt_type_t instr_fmt_type; SG_END_DECL() -void DefineContainerEvent(Type* type); -void LogVariableTypeDefinition(Type* type); -void LogStateTypeDefinition(Type* type); -void LogLinkTypeDefinition(Type* type, Type* source, Type* dest); -void LogEntityValue(Value* val); +void DefineContainerEvent(simgrid::instr::Type* type); +void LogVariableTypeDefinition(simgrid::instr::Type* type); +void LogStateTypeDefinition(simgrid::instr::Type* type); +void LogLinkTypeDefinition(simgrid::instr::Type* type, simgrid::instr::Type* source, simgrid::instr::Type* dest); +void LogEntityValue(simgrid::instr::Value* val); void LogContainerCreation (container_t container); void LogContainerDestruction (container_t container); -void LogDefineEventType(Type* type); +void LogDefineEventType(simgrid::instr::Type* type); #endif diff --git a/src/instr/instr_resource_utilization.cpp b/src/instr/instr_resource_utilization.cpp index 0bc29723d2..62889c1ca9 100644 --- a/src/instr/instr_resource_utilization.cpp +++ b/src/instr/instr_resource_utilization.cpp @@ -28,17 +28,17 @@ static void __TRACE_surf_check_variable_set_to_zero(double now, const char *vari // check if key exists: if it doesn't, set the variable to zero and mark this in the dict if (platform_variables.find(key) == platform_variables.end()) { container_t container = PJ_container_get (resource); - Type* type = PJ_type_get (variable, container->type); - new SetVariableEvent (now, container, type, 0); + simgrid::instr::Type* type = PJ_type_get(variable, container->type); + new simgrid::instr::SetVariableEvent(now, container, type, 0); platform_variables[key] = std::string(""); } } -static void instr_event (double now, double delta, Type* variable, container_t resource, double value) +static void instr_event(double now, double delta, simgrid::instr::Type* variable, container_t resource, double value) { __TRACE_surf_check_variable_set_to_zero(now, variable->name, resource->name); - new AddVariableEvent(now, resource, variable, value); - new SubVariableEvent(now + delta, resource, variable, value); + new simgrid::instr::AddVariableEvent(now, resource, variable, value); + new simgrid::instr::SubVariableEvent(now + delta, resource, variable, value); } /* TRACE_surf_link_set_utilization: entry point from SimGrid */ @@ -54,7 +54,7 @@ void TRACE_surf_link_set_utilization(const char *resource, const char *category, if (TRACE_uncategorized()){ XBT_DEBUG("UNCAT LINK [%f - %f] %s bandwidth_used %f", now, now+delta, resource, value); container_t container = PJ_container_get (resource); - Type* type = PJ_type_get ("bandwidth_used", container->type); + simgrid::instr::Type* type = PJ_type_get("bandwidth_used", container->type); instr_event (now, delta, type, container, value); } @@ -67,7 +67,7 @@ void TRACE_surf_link_set_utilization(const char *resource, const char *category, snprintf (category_type, INSTR_DEFAULT_STR_SIZE, "b%s", category); XBT_DEBUG("CAT LINK [%f - %f] %s %s %f", now, now+delta, resource, category_type, value); container_t container = PJ_container_get (resource); - Type* type = PJ_type_get (category_type, container->type); + simgrid::instr::Type* type = PJ_type_get(category_type, container->type); instr_event (now, delta, type, container, value); } } @@ -83,7 +83,7 @@ void TRACE_surf_host_set_utilization(const char *resource, const char *category, //trace uncategorized host utilization if (TRACE_uncategorized()){ XBT_DEBUG("UNCAT HOST [%f - %f] %s power_used %f", now, now+delta, resource, value); - Type* type = PJ_type_get ("power_used", container->type); + simgrid::instr::Type* type = PJ_type_get("power_used", container->type); instr_event (now, delta, type, container, value); } @@ -95,7 +95,7 @@ void TRACE_surf_host_set_utilization(const char *resource, const char *category, char category_type[INSTR_DEFAULT_STR_SIZE]; snprintf (category_type, INSTR_DEFAULT_STR_SIZE, "p%s", category); XBT_DEBUG("CAT HOST [%f - %f] %s %s %f", now, now+delta, resource, category_type, value); - Type* type = PJ_type_get (category_type, container->type); + simgrid::instr::Type* type = PJ_type_get(category_type, container->type); instr_event (now, delta, type, container, value); } } diff --git a/src/msg/instr_msg_process.cpp b/src/msg/instr_msg_process.cpp index 6ed284fc26..05ff2d34dd 100644 --- a/src/msg/instr_msg_process.cpp +++ b/src/msg/instr_msg_process.cpp @@ -37,8 +37,8 @@ void TRACE_msg_process_change_host(msg_process_t process, msg_host_t new_host) //start link container_t msg = PJ_container_get (instr_process_id(process, str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_LINK", PJ_type_get_root()); - new StartLinkEvent (MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_LINK", PJ_type_get_root()); + new simgrid::instr::StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); //destroy existing container of this process TRACE_msg_process_destroy (MSG_process_get_name (process), MSG_process_get_PID (process)); @@ -49,7 +49,7 @@ void TRACE_msg_process_change_host(msg_process_t process, msg_host_t new_host) //end link msg = PJ_container_get(instr_process_id(process, str, len)); type = PJ_type_get ("MSG_PROCESS_LINK", PJ_type_get_root()); - new EndLinkEvent (MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); + new simgrid::instr::EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); } } @@ -60,7 +60,8 @@ void TRACE_msg_process_create (const char *process_name, int process_pid, msg_ho char str[INSTR_DEFAULT_STR_SIZE]; container_t host_container = PJ_container_get(host->getCname()); - PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), INSTR_MSG_PROCESS, host_container); + PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), simgrid::instr::INSTR_MSG_PROCESS, + host_container); } } @@ -93,9 +94,9 @@ void TRACE_msg_process_suspend(msg_process_t process) char str[INSTR_DEFAULT_STR_SIZE]; container_t process_container = PJ_container_get (instr_process_id(process, str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type); - Value* val = Value::get("suspend", type); - new PushStateEvent(MSG_get_clock(), process_container, type, val); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get("suspend", type); + new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val); } } @@ -106,8 +107,8 @@ void TRACE_msg_process_resume(msg_process_t process) char str[INSTR_DEFAULT_STR_SIZE]; container_t process_container = PJ_container_get (instr_process_id(process, str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type); - new PopStateEvent (MSG_get_clock(), process_container, type); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type); + new simgrid::instr::PopStateEvent(MSG_get_clock(), process_container, type); } } @@ -118,9 +119,9 @@ void TRACE_msg_process_sleep_in(msg_process_t process) char str[INSTR_DEFAULT_STR_SIZE]; container_t process_container = PJ_container_get (instr_process_id(process, str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type); - Value* val = Value::get("sleep", type); - new PushStateEvent(MSG_get_clock(), process_container, type, val); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get("sleep", type); + new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val); } } @@ -131,7 +132,7 @@ void TRACE_msg_process_sleep_out(msg_process_t process) char str[INSTR_DEFAULT_STR_SIZE]; container_t process_container = PJ_container_get (instr_process_id(process, str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type); - new PopStateEvent (MSG_get_clock(), process_container, type); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type); + new simgrid::instr::PopStateEvent(MSG_get_clock(), process_container, type); } } diff --git a/src/msg/instr_msg_task.cpp b/src/msg/instr_msg_task.cpp index 11c9293fc8..f804005feb 100644 --- a/src/msg/instr_msg_task.cpp +++ b/src/msg/instr_msg_task.cpp @@ -53,9 +53,9 @@ void TRACE_msg_task_execute_start(msg_task_t task) char str[INSTR_DEFAULT_STR_SIZE]; container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type); - Value* val = Value::get("task_execute", type); - new PushStateEvent(MSG_get_clock(), process_container, type, val); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get("task_execute", type); + new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val); } } @@ -68,8 +68,8 @@ void TRACE_msg_task_execute_end(msg_task_t task) char str[INSTR_DEFAULT_STR_SIZE]; container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type); - new PopStateEvent (MSG_get_clock(), process_container, type); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type); + new simgrid::instr::PopStateEvent(MSG_get_clock(), process_container, type); } } @@ -93,9 +93,9 @@ void TRACE_msg_task_get_start() char str[INSTR_DEFAULT_STR_SIZE]; container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type); - Value* val = Value::get("receive", type); - new PushStateEvent(MSG_get_clock(), process_container, type, val); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get("receive", type); + new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val); } } @@ -108,13 +108,13 @@ void TRACE_msg_task_get_end(double start_time, msg_task_t task) char str[INSTR_DEFAULT_STR_SIZE]; container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type); - new PopStateEvent (MSG_get_clock(), process_container, type); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type); + new simgrid::instr::PopStateEvent(MSG_get_clock(), process_container, type); char key[INSTR_DEFAULT_STR_SIZE]; snprintf (key, INSTR_DEFAULT_STR_SIZE, "p%lld", task->counter); type = PJ_type_get ("MSG_PROCESS_TASK_LINK", PJ_type_get_root()); - new EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, process_container, "SR", key); + new simgrid::instr::EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, process_container, "SR", key); } } @@ -128,14 +128,14 @@ int TRACE_msg_task_put_start(msg_task_t task) char str[INSTR_DEFAULT_STR_SIZE]; container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type); - Value* val = Value::get("send", type); - new PushStateEvent(MSG_get_clock(), process_container, type, val); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get("send", type); + new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val); char key[INSTR_DEFAULT_STR_SIZE]; snprintf (key, INSTR_DEFAULT_STR_SIZE, "p%lld", task->counter); type = PJ_type_get ("MSG_PROCESS_TASK_LINK", PJ_type_get_root()); - new StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, process_container, "SR", key); + new simgrid::instr::StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, process_container, "SR", key); } return 1; @@ -150,7 +150,7 @@ void TRACE_msg_task_put_end() char str[INSTR_DEFAULT_STR_SIZE]; container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len)); - Type* type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type); - new PopStateEvent (MSG_get_clock(), process_container, type); + simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type); + new simgrid::instr::PopStateEvent(MSG_get_clock(), process_container, type); } } diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 25a4a0445b..0085d148de 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -187,9 +187,9 @@ void MSG_vm_start(msg_vm_t vm) vm->start(); if (TRACE_msg_vm_is_enabled()) { container_t vm_container = PJ_container_get(vm->getCname()); - Type* type = PJ_type_get("MSG_VM_STATE", vm_container->type); - Value* val = Value::get_or_new("start", "0 0 1", type); // start is blue - new PushStateEvent(MSG_get_clock(), vm_container, type, val); + simgrid::instr::Type* type = PJ_type_get("MSG_VM_STATE", vm_container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("start", "0 0 1", type); // start is blue + new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, type, val); } } @@ -296,8 +296,8 @@ static int migration_rx_fun(int argc, char *argv[]) // start link container_t msg = PJ_container_get(vm->getCname()); - Type* type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root()); - new StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); + simgrid::instr::Type* type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root()); + new simgrid::instr::StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); // destroy existing container of this vm container_t existing_container = PJ_container_get(vm->getCname()); @@ -305,12 +305,12 @@ static int migration_rx_fun(int argc, char *argv[]) PJ_container_free(existing_container); // create new container on the new_host location - PJ_container_new(vm->getCname(), INSTR_MSG_VM, PJ_container_get(ms->dst_pm->getCname())); + PJ_container_new(vm->getCname(), simgrid::instr::INSTR_MSG_VM, PJ_container_get(ms->dst_pm->getCname())); // end link msg = PJ_container_get(vm->getCname()); type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root()); - new EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); + new simgrid::instr::EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key); } // Inform the SRC that the migration has been correctly performed @@ -774,9 +774,9 @@ void MSG_vm_suspend(msg_vm_t vm) if (TRACE_msg_vm_is_enabled()) { container_t vm_container = PJ_container_get(vm->getCname()); - Type* type = PJ_type_get("MSG_VM_STATE", vm_container->type); - Value* val = Value::get_or_new("suspend", "1 0 0", type); // suspend is red - new PushStateEvent(MSG_get_clock(), vm_container, type, val); + simgrid::instr::Type* type = PJ_type_get("MSG_VM_STATE", vm_container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("suspend", "1 0 0", type); // suspend is red + new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, type, val); } } @@ -791,8 +791,8 @@ void MSG_vm_resume(msg_vm_t vm) if (TRACE_msg_vm_is_enabled()) { container_t vm_container = PJ_container_get(vm->getCname()); - Type* type = PJ_type_get("MSG_VM_STATE", vm_container->type); - new PopStateEvent(MSG_get_clock(), vm_container, type); + simgrid::instr::Type* type = PJ_type_get("MSG_VM_STATE", vm_container->type); + new simgrid::instr::PopStateEvent(MSG_get_clock(), vm_container, type); } } diff --git a/src/plugins/vm/s4u_VirtualMachine.cpp b/src/plugins/vm/s4u_VirtualMachine.cpp index 7915262a08..fe298d79df 100644 --- a/src/plugins/vm/s4u_VirtualMachine.cpp +++ b/src/plugins/vm/s4u_VirtualMachine.cpp @@ -33,7 +33,7 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm, int coreAmount) if (TRACE_msg_vm_is_enabled()) { container_t host_container = PJ_container_get(pm->getCname()); - PJ_container_new(name, INSTR_MSG_VM, host_container); + PJ_container_new(name, simgrid::instr::INSTR_MSG_VM, host_container); } } diff --git a/src/smpi/colls/smpi_automatic_selector.cpp b/src/smpi/colls/smpi_automatic_selector.cpp index 376b0d9dd8..df6832b729 100644 --- a/src/smpi/colls/smpi_automatic_selector.cpp +++ b/src/smpi/colls/smpi_automatic_selector.cpp @@ -16,14 +16,15 @@ #define TRACE_AUTO_COLL(cat) \ if (TRACE_is_enabled()) { \ - Type* type = Type::getOrNull(#cat, PJ_type_get_root()); \ + simgrid::instr::Type* type = simgrid::instr::Type::getOrNull(#cat, PJ_type_get_root()); \ if (not type) { \ - type = Type::eventNew(#cat, PJ_type_get_root()); \ + type = simgrid::instr::Type::eventNew(#cat, PJ_type_get_root()); \ } \ char cont_name[25]; \ snprintf(cont_name, 25, "rank-%d", smpi_process()->index()); \ - Value* val = Value::get_or_new(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0", type); \ - new NewEvent(SIMIX_get_clock(), PJ_container_get(cont_name), type, val); \ + simgrid::instr::Value* val = \ + simgrid::instr::Value::get_or_new(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0", type); \ + new simgrid::instr::NewEvent(SIMIX_get_clock(), PJ_container_get(cont_name), type, val); \ } #define AUTOMATIC_COLL_BENCH(cat, ret, args, args2) \ diff --git a/src/smpi/internals/instr_smpi.cpp b/src/smpi/internals/instr_smpi.cpp index eb27740abb..b21edb9a04 100644 --- a/src/smpi/internals/instr_smpi.cpp +++ b/src/smpi/internals/instr_smpi.cpp @@ -199,7 +199,7 @@ void TRACE_smpi_init(int rank) #if HAVE_PAPI container_t container = #endif - PJ_container_new(str, INSTR_SMPI, father); + PJ_container_new(str, simgrid::instr::INSTR_SMPI, father); #if HAVE_PAPI papi_counter_t counters = smpi_process()->papi_counters(); @@ -236,10 +236,10 @@ void TRACE_smpi_collective_in(int rank, const char *operation, instr_extra_data char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); const char *color = instr_find_color (operation); - Value* val = Value::get_or_new(operation, color, type); - new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast(extra)); + simgrid::instr::Value* val = simgrid::instr::Value::get_or_new(operation, color, type); + new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast(extra)); } void TRACE_smpi_collective_out(int rank, const char *operation) @@ -250,9 +250,9 @@ void TRACE_smpi_collective_out(int rank, const char *operation) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); - new PopStateEvent (SIMIX_get_clock(), container, type); + new simgrid::instr::PopStateEvent(SIMIX_get_clock(), container, type); } void TRACE_smpi_computing_init(int rank) @@ -264,9 +264,10 @@ void TRACE_smpi_computing_init(int rank) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get(str); - Type* type = PJ_type_get("MPI_STATE", container->type); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); const char* color = instr_find_color("computing"); - new PushStateEvent(SIMIX_get_clock(), container, type, Value::get_or_new("computing", color, type)); + new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, + simgrid::instr::Value::get_or_new("computing", color, type)); } void TRACE_smpi_computing_in(int rank, instr_extra_data extra) @@ -280,9 +281,9 @@ void TRACE_smpi_computing_in(int rank, instr_extra_data extra) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); - Value* val = Value::get_or_new("computing", nullptr, type); - new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast(extra)); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("computing", nullptr, type); + new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast(extra)); } void TRACE_smpi_computing_out(int rank) @@ -292,8 +293,8 @@ void TRACE_smpi_computing_out(int rank) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); - new PopStateEvent (SIMIX_get_clock(), container, type); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); + new simgrid::instr::PopStateEvent(SIMIX_get_clock(), container, type); } void TRACE_smpi_sleeping_init(int rank) @@ -305,10 +306,10 @@ void TRACE_smpi_sleeping_init(int rank) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); const char *color = instr_find_color ("sleeping"); - Value* val = Value::get_or_new("sleeping", color, type); - new PushStateEvent(SIMIX_get_clock(), container, type, val); + simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("sleeping", color, type); + new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val); } void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra) @@ -322,9 +323,9 @@ void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); - Value* val = Value::get_or_new("sleeping", nullptr, type); - new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast(extra)); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("sleeping", nullptr, type); + new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast(extra)); } void TRACE_smpi_sleeping_out(int rank) @@ -334,8 +335,8 @@ void TRACE_smpi_sleeping_out(int rank) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); - new PopStateEvent (SIMIX_get_clock(), container, type); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); + new simgrid::instr::PopStateEvent(SIMIX_get_clock(), container, type); } void TRACE_smpi_testing_in(int rank, instr_extra_data extra) @@ -349,9 +350,9 @@ void TRACE_smpi_testing_in(int rank, instr_extra_data extra) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); - Value* val = Value::get_or_new("test", nullptr, type); - new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast(extra)); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); + simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("test", nullptr, type); + new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast(extra)); } void TRACE_smpi_testing_out(int rank) @@ -361,8 +362,8 @@ void TRACE_smpi_testing_out(int rank) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); - new PopStateEvent (SIMIX_get_clock(), container, type); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); + new simgrid::instr::PopStateEvent(SIMIX_get_clock(), container, type); } void TRACE_smpi_ptp_in(int rank, const char *operation, instr_extra_data extra) @@ -375,10 +376,10 @@ void TRACE_smpi_ptp_in(int rank, const char *operation, instr_extra_data extra) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); const char *color = instr_find_color (operation); - Value* val = Value::get_or_new(operation, color, type); - new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast(extra)); + simgrid::instr::Value* val = simgrid::instr::Value::get_or_new(operation, color, type); + new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast(extra)); } void TRACE_smpi_ptp_out(int rank, int dst, const char *operation) @@ -389,9 +390,9 @@ void TRACE_smpi_ptp_out(int rank, int dst, const char *operation) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_STATE", container->type); + simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type); - new PopStateEvent (SIMIX_get_clock(), container, type); + new simgrid::instr::PopStateEvent(SIMIX_get_clock(), container, type); } void TRACE_smpi_send(int rank, int src, int dst, int tag, int size) @@ -405,9 +406,9 @@ void TRACE_smpi_send(int rank, int src, int dst, int tag, int size) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(src, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_LINK", PJ_type_get_root()); + simgrid::instr::Type* type = PJ_type_get("MPI_LINK", PJ_type_get_root()); XBT_DEBUG("Send tracing from %d to %d, tag %d, with key %s", src, dst, tag, key); - new StartLinkEvent (SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key, size); + new simgrid::instr::StartLinkEvent(SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key, size); } void TRACE_smpi_recv(int src, int dst, int tag) @@ -421,7 +422,7 @@ void TRACE_smpi_recv(int src, int dst, int tag) char str[INSTR_DEFAULT_STR_SIZE]; smpi_container(dst, str, INSTR_DEFAULT_STR_SIZE); container_t container = PJ_container_get (str); - Type* type = PJ_type_get ("MPI_LINK", PJ_type_get_root()); + simgrid::instr::Type* type = PJ_type_get("MPI_LINK", PJ_type_get_root()); XBT_DEBUG("Recv tracing from %d to %d, tag %d, with key %s", src, dst, tag, key); - new EndLinkEvent (SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key); + new simgrid::instr::EndLinkEvent(SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key); } diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index e8282cbba4..026fcbb3d5 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -54,7 +54,7 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/) smaller = action->getLastUpdate(); } if (smaller > 0) { - TRACE_last_timestamp_to_dump = smaller; + simgrid::instr::TRACE_last_timestamp_to_dump = smaller; } } } @@ -74,7 +74,7 @@ void CpuModel::updateActionsStateFull(double now, double delta) TRACE_surf_host_set_utilization(cpu->cname(), action->getCategory(), lmm_variable_getvalue(action->getVariable()), now - delta, delta); - TRACE_last_timestamp_to_dump = now - delta; + simgrid::instr::TRACE_last_timestamp_to_dump = now - delta; } action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta); diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index 0b8c360c1e..eb5f17e536 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -105,9 +105,9 @@ static void linkContainers (container_t src, container_t dst, xbt_dict_t filter) father->type->name, src->type->name, src->type->id, dst->type->name, dst->type->id); - Type* link_type = Type::getOrNull (link_typename, father->type); + simgrid::instr::Type* link_type = simgrid::instr::Type::getOrNull(link_typename, father->type); if (link_type == nullptr){ - link_type = Type::linkNew (link_typename, father->type, src->type, dst->type); + link_type = simgrid::instr::Type::linkNew(link_typename, father->type, src->type, dst->type); } //register EDGE types for triva configuration @@ -120,8 +120,8 @@ static void linkContainers (container_t src, container_t dst, xbt_dict_t filter) snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", counter); counter++; - new StartLinkEvent(SIMIX_get_clock(), father, link_type, src, "topology", key); - new EndLinkEvent(SIMIX_get_clock(), father, link_type, dst, "topology", key); + new simgrid::instr::StartLinkEvent(SIMIX_get_clock(), father, link_type, src, "topology", key); + new simgrid::instr::EndLinkEvent(SIMIX_get_clock(), father, link_type, dst, "topology", key); XBT_DEBUG (" linkContainers %s <-> %s", src->name, dst->name); } @@ -169,16 +169,16 @@ static void sg_instr_AS_begin(simgrid::s4u::NetZone& netzone) if (PJ_container_get_root() == nullptr){ PJ_container_alloc (); - container_t root = PJ_container_new (id, INSTR_AS, nullptr); + container_t root = PJ_container_new(id, simgrid::instr::INSTR_AS, nullptr); PJ_container_set_root (root); if (TRACE_smpi_is_enabled()) { - Type* mpi = Type::getOrNull ("MPI", root->type); + simgrid::instr::Type* mpi = simgrid::instr::Type::getOrNull("MPI", root->type); if (mpi == nullptr){ - mpi = Type::containerNew("MPI", root->type); + mpi = simgrid::instr::Type::containerNew("MPI", root->type); if (not TRACE_smpi_is_grouped()) - Type::stateNew ("MPI_STATE", mpi); - Type::linkNew ("MPI_LINK", PJ_type_get_root(), mpi, mpi); + simgrid::instr::Type::stateNew("MPI_STATE", mpi); + simgrid::instr::Type::linkNew("MPI_LINK", PJ_type_get_root(), mpi, mpi); } } @@ -190,7 +190,7 @@ static void sg_instr_AS_begin(simgrid::s4u::NetZone& netzone) if (TRACE_needs_platform()){ container_t father = currentContainer.back(); - container_t container = PJ_container_new (id, INSTR_AS, father); + container_t container = PJ_container_new(id, simgrid::instr::INSTR_AS, father); currentContainer.push_back(container); } } @@ -211,24 +211,24 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link) double bandwidth_value = link.bandwidth(); double latency_value = link.latency(); - container_t container = PJ_container_new(link.name(), INSTR_LINK, father); + container_t container = PJ_container_new(link.name(), simgrid::instr::INSTR_LINK, father); if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_link())) { - Type* bandwidth = Type::getOrNull("bandwidth", container->type); + simgrid::instr::Type* bandwidth = simgrid::instr::Type::getOrNull("bandwidth", container->type); if (bandwidth == nullptr) { - bandwidth = Type::variableNew("bandwidth", nullptr, container->type); + bandwidth = simgrid::instr::Type::variableNew("bandwidth", nullptr, container->type); } - Type* latency = Type::getOrNull("latency", container->type); + simgrid::instr::Type* latency = simgrid::instr::Type::getOrNull("latency", container->type); if (latency == nullptr) { - latency = Type::variableNew("latency", nullptr, container->type); + latency = simgrid::instr::Type::variableNew("latency", nullptr, container->type); } - new SetVariableEvent(0, container, bandwidth, bandwidth_value); - new SetVariableEvent(0, container, latency, latency_value); + new simgrid::instr::SetVariableEvent(0, container, bandwidth, bandwidth_value); + new simgrid::instr::SetVariableEvent(0, container, latency, latency_value); } if (TRACE_uncategorized()) { - Type* bandwidth_used = Type::getOrNull("bandwidth_used", container->type); + simgrid::instr::Type* bandwidth_used = simgrid::instr::Type::getOrNull("bandwidth_used", container->type); if (bandwidth_used == nullptr) { - Type::variableNew("bandwidth_used", "0.5 0.5 0.5", container->type); + simgrid::instr::Type::variableNew("bandwidth_used", "0.5 0.5 0.5", container->type); } } } @@ -236,59 +236,59 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link) static void sg_instr_new_host(simgrid::s4u::Host& host) { container_t father = currentContainer.back(); - container_t container = PJ_container_new(host.getCname(), INSTR_HOST, father); + container_t container = PJ_container_new(host.getCname(), simgrid::instr::INSTR_HOST, father); if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_speed())) { - Type* speed = Type::getOrNull ("power", container->type); + simgrid::instr::Type* speed = simgrid::instr::Type::getOrNull("power", container->type); if (speed == nullptr){ - speed = Type::variableNew ("power", nullptr, container->type); + speed = simgrid::instr::Type::variableNew("power", nullptr, container->type); } double current_speed_state = host.getSpeed(); - new SetVariableEvent (0, container, speed, current_speed_state); + new simgrid::instr::SetVariableEvent(0, container, speed, current_speed_state); } if (TRACE_uncategorized()){ - Type* speed_used = Type::getOrNull ("power_used", container->type); + simgrid::instr::Type* speed_used = simgrid::instr::Type::getOrNull("power_used", container->type); if (speed_used == nullptr){ - Type::variableNew ("power_used", "0.5 0.5 0.5", container->type); + simgrid::instr::Type::variableNew("power_used", "0.5 0.5 0.5", container->type); } } if (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped()){ - Type* mpi = Type::getOrNull ("MPI", container->type); + simgrid::instr::Type* mpi = simgrid::instr::Type::getOrNull("MPI", container->type); if (mpi == nullptr){ - mpi = Type::containerNew("MPI", container->type); - Type::stateNew ("MPI_STATE", mpi); + mpi = simgrid::instr::Type::containerNew("MPI", container->type); + simgrid::instr::Type::stateNew("MPI_STATE", mpi); } } if (TRACE_msg_process_is_enabled()) { - Type* msg_process = Type::getOrNull ("MSG_PROCESS", container->type); + simgrid::instr::Type* msg_process = simgrid::instr::Type::getOrNull("MSG_PROCESS", container->type); if (msg_process == nullptr){ - msg_process = Type::containerNew("MSG_PROCESS", container->type); - Type* state = Type::stateNew ("MSG_PROCESS_STATE", msg_process); - Value PJ_value("suspend", "1 0 1", state); - Value::get_or_new("sleep", "1 1 0", state); - Value::get_or_new("receive", "1 0 0", state); - Value::get_or_new("send", "0 0 1", state); - Value::get_or_new("task_execute", "0 1 1", state); - Type::linkNew ("MSG_PROCESS_LINK", PJ_type_get_root(), msg_process, msg_process); - Type::linkNew ("MSG_PROCESS_TASK_LINK", PJ_type_get_root(), msg_process, msg_process); + msg_process = simgrid::instr::Type::containerNew("MSG_PROCESS", container->type); + simgrid::instr::Type* state = simgrid::instr::Type::stateNew("MSG_PROCESS_STATE", msg_process); + simgrid::instr::Value PJ_value("suspend", "1 0 1", state); + simgrid::instr::Value::get_or_new("sleep", "1 1 0", state); + simgrid::instr::Value::get_or_new("receive", "1 0 0", state); + simgrid::instr::Value::get_or_new("send", "0 0 1", state); + simgrid::instr::Value::get_or_new("task_execute", "0 1 1", state); + simgrid::instr::Type::linkNew("MSG_PROCESS_LINK", PJ_type_get_root(), msg_process, msg_process); + simgrid::instr::Type::linkNew("MSG_PROCESS_TASK_LINK", PJ_type_get_root(), msg_process, msg_process); } } if (TRACE_msg_vm_is_enabled()) { - Type* msg_vm = Type::getOrNull ("MSG_VM", container->type); + simgrid::instr::Type* msg_vm = simgrid::instr::Type::getOrNull("MSG_VM", container->type); if (msg_vm == nullptr){ - msg_vm = Type::containerNew("MSG_VM", container->type); - Type* state = Type::stateNew ("MSG_VM_STATE", msg_vm); - Value PJ_value("suspend", "1 0 1", state); - Value::get_or_new("sleep", "1 1 0", state); - Value::get_or_new("receive", "1 0 0", state); - Value::get_or_new("send", "0 0 1", state); - Value::get_or_new("task_execute", "0 1 1", state); - Type::linkNew ("MSG_VM_LINK", PJ_type_get_root(), msg_vm, msg_vm); - Type::linkNew ("MSG_VM_PROCESS_LINK", PJ_type_get_root(), msg_vm, msg_vm); + msg_vm = simgrid::instr::Type::containerNew("MSG_VM", container->type); + simgrid::instr::Type* state = simgrid::instr::Type::stateNew("MSG_VM_STATE", msg_vm); + simgrid::instr::Value PJ_value("suspend", "1 0 1", state); + simgrid::instr::Value::get_or_new("sleep", "1 1 0", state); + simgrid::instr::Value::get_or_new("receive", "1 0 0", state); + simgrid::instr::Value::get_or_new("send", "0 0 1", state); + simgrid::instr::Value::get_or_new("task_execute", "0 1 1", state); + simgrid::instr::Type::linkNew("MSG_VM_LINK", PJ_type_get_root(), msg_vm, msg_vm); + simgrid::instr::Type::linkNew("MSG_VM_PROCESS_LINK", PJ_type_get_root(), msg_vm, msg_vm); } } @@ -300,7 +300,7 @@ static void sg_instr_new_router(simgrid::kernel::routing::NetPoint * netpoint) return; if (TRACE_is_enabled() && TRACE_needs_platform()) { container_t father = currentContainer.back(); - PJ_container_new(netpoint->cname(), INSTR_ROUTER, father); + PJ_container_new(netpoint->cname(), simgrid::instr::INSTR_ROUTER, father); } } @@ -334,25 +334,25 @@ void instr_routing_define_callbacks () /* * user categories support */ -static void recursiveNewVariableType (const char *new_typename, const char *color, Type* root) +static void recursiveNewVariableType(const char* new_typename, const char* color, simgrid::instr::Type* root) { if (not strcmp(root->name, "HOST")) { char tnstr[INSTR_DEFAULT_STR_SIZE]; snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "p%s", new_typename); - Type::variableNew (tnstr, color, root); + simgrid::instr::Type::variableNew(tnstr, color, root); } if (not strcmp(root->name, "MSG_VM")) { char tnstr[INSTR_DEFAULT_STR_SIZE]; snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "p%s", new_typename); - Type::variableNew (tnstr, color, root); + simgrid::instr::Type::variableNew(tnstr, color, root); } if (not strcmp(root->name, "LINK")) { char tnstr[INSTR_DEFAULT_STR_SIZE]; snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "b%s", new_typename); - Type::variableNew (tnstr, color, root); + simgrid::instr::Type::variableNew(tnstr, color, root); } xbt_dict_cursor_t cursor = nullptr; - Type* child_type; + simgrid::instr::Type* child_type; char *name; xbt_dict_foreach(root->children, cursor, name, child_type) { recursiveNewVariableType (new_typename, color, child_type); @@ -364,13 +364,14 @@ void instr_new_variable_type (const char *new_typename, const char *color) recursiveNewVariableType (new_typename, color, PJ_type_get_root()); } -static void recursiveNewUserVariableType (const char *father_type, const char *new_typename, const char *color, Type* root) +static void recursiveNewUserVariableType(const char* father_type, const char* new_typename, const char* color, + simgrid::instr::Type* root) { if (not strcmp(root->name, father_type)) { - Type::variableNew (new_typename, color, root); + simgrid::instr::Type::variableNew(new_typename, color, root); } xbt_dict_cursor_t cursor = nullptr; - Type* child_type; + simgrid::instr::Type* child_type; char *name; xbt_dict_foreach(root->children, cursor, name, child_type) { recursiveNewUserVariableType (father_type, new_typename, color, child_type); @@ -382,13 +383,13 @@ void instr_new_user_variable_type (const char *father_type, const char *new_typ recursiveNewUserVariableType (father_type, new_typename, color, PJ_type_get_root()); } -static void recursiveNewUserStateType (const char *father_type, const char *new_typename, Type* root) +static void recursiveNewUserStateType(const char* father_type, const char* new_typename, simgrid::instr::Type* root) { if (not strcmp(root->name, father_type)) { - Type::stateNew (new_typename, root); + simgrid::instr::Type::stateNew(new_typename, root); } xbt_dict_cursor_t cursor = nullptr; - Type* child_type; + simgrid::instr::Type* child_type; char *name; xbt_dict_foreach(root->children, cursor, name, child_type) { recursiveNewUserStateType (father_type, new_typename, child_type); @@ -400,13 +401,14 @@ void instr_new_user_state_type (const char *father_type, const char *new_typenam recursiveNewUserStateType (father_type, new_typename, PJ_type_get_root()); } -static void recursiveNewValueForUserStateType(const char* type_name, const char* val, const char* color, Type* root) +static void recursiveNewValueForUserStateType(const char* type_name, const char* val, const char* color, + simgrid::instr::Type* root) { if (not strcmp(root->name, type_name)) { - Value PJ_value(val, color, root); + simgrid::instr::Value PJ_value(val, color, root); } xbt_dict_cursor_t cursor = nullptr; - Type* child_type; + simgrid::instr::Type* child_type; char *name; xbt_dict_foreach(root->children, cursor, name, child_type) { recursiveNewValueForUserStateType(type_name, val, color, child_type); diff --git a/src/surf/instr_surf.cpp b/src/surf/instr_surf.cpp index 69d8a98a32..f9f14ae92b 100644 --- a/src/surf/instr_surf.cpp +++ b/src/surf/instr_surf.cpp @@ -13,8 +13,8 @@ void TRACE_surf_host_set_speed(double date, const char *resource, double speed) { if (TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) { container_t container = PJ_container_get(resource); - Type* type = PJ_type_get ("power", container->type); - new SetVariableEvent(date, container, type, speed); + simgrid::instr::Type* type = PJ_type_get("power", container->type); + new simgrid::instr::SetVariableEvent(date, container, type, speed); } } @@ -22,8 +22,8 @@ void TRACE_surf_link_set_bandwidth(double date, const char *resource, double ban { if (TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) { container_t container = PJ_container_get(resource); - Type* type = PJ_type_get ("bandwidth", container->type); - new SetVariableEvent(date, container, type, bandwidth); + simgrid::instr::Type* type = PJ_type_get("bandwidth", container->type); + new simgrid::instr::SetVariableEvent(date, container, type, bandwidth); } }