/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_containers, instr, "Paje tracing event system (containers)");
static container_t rootContainer = nullptr; /* the root container */
static xbt_dict_t allContainers = nullptr; /* all created containers indexed by name */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_containers, instr, "Paje tracing event system (containers)");
static container_t rootContainer = nullptr; /* the root container */
static xbt_dict_t allContainers = nullptr; /* all created containers indexed by name */
-xbt_dict_t trivaNodeTypes = nullptr; /* all host types defined */
-xbt_dict_t trivaEdgeTypes = nullptr; /* all link types defined */
+std::set<std::string> trivaNodeTypes; /* all host types defined */
+std::set<std::string> trivaEdgeTypes; /* all link types defined */
snprintf (id_str, INSTR_DEFAULT_STR_SIZE, "%lld", container_id);
container_id++;
snprintf (id_str, INSTR_DEFAULT_STR_SIZE, "%lld", container_id);
container_id++;
newContainer->name = xbt_strdup (name); // name of the container
newContainer->id = xbt_strdup (id_str); // id (or alias) of the container
newContainer->father = father;
newContainer->name = xbt_strdup (name); // name of the container
newContainer->id = xbt_strdup (id_str); // id (or alias) of the container
newContainer->father = father;
- case INSTR_HOST:
- newContainer->netcard = sg_host->pimpl_netcard;
- xbt_assert(newContainer->netcard, "Element '%s' not found",name);
+ case simgrid::instr::INSTR_HOST:
+ newContainer->netpoint = sg_host->pimpl_netpoint;
+ xbt_assert(newContainer->netpoint, "Element '%s' not found", name);
- case INSTR_ROUTER:
- newContainer->netcard = static_cast<sg_netcard_t>(xbt_lib_get_or_null(as_router_lib,name,ROUTING_ASR_LEVEL));
- xbt_assert(newContainer->netcard, "Element '%s' not found",name);
+ case simgrid::instr::INSTR_ROUTER:
+ newContainer->netpoint = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+ xbt_assert(newContainer->netpoint, "Element '%s' not found", name);
- case INSTR_AS:
- newContainer->netcard = static_cast<sg_netcard_t>(xbt_lib_get_or_null(as_router_lib,name,ROUTING_ASR_LEVEL));
- xbt_assert(newContainer->netcard, "Element '%s' not found",name);
+ case simgrid::instr::INSTR_AS:
+ newContainer->netpoint = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+ xbt_assert(newContainer->netpoint, "Element '%s' not found", name);
//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){
//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){
}
}else{
//otherwise, the name is its kind
char typeNameBuff[INSTR_DEFAULT_STR_SIZE];
switch (newContainer->kind){
}
}else{
//otherwise, the name is its kind
char typeNameBuff[INSTR_DEFAULT_STR_SIZE];
switch (newContainer->kind){
snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_TASK");
break;
default:
THROWF (tracing_error, 0, "new container kind is unknown.");
break;
}
snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_TASK");
break;
default:
THROWF (tracing_error, 0, "new container kind is unknown.");
break;
}
newContainer->children = xbt_dict_new_homogeneous(nullptr);
if (newContainer->father){
xbt_dict_set(newContainer->father->children, newContainer->name, newContainer, nullptr);
newContainer->children = xbt_dict_new_homogeneous(nullptr);
if (newContainer->father){
xbt_dict_set(newContainer->father->children, newContainer->name, newContainer, nullptr);
XBT_DEBUG("Add container name '%s'",newContainer->name);
//register NODE types for triva configuration
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) {
- xbt_dict_set (trivaNodeTypes, newContainer->type->name, xbt_strdup("1"), nullptr);
+ if (newContainer->kind == simgrid::instr::INSTR_HOST || newContainer->kind == simgrid::instr::INSTR_LINK ||
+ newContainer->kind == simgrid::instr::INSTR_ROUTER) {
+ trivaNodeTypes.insert(newContainer->type->name);
//obligation to dump previous events because they might
//reference the container that is about to be destroyed
//obligation to dump previous events because they might
//reference the container that is about to be destroyed