X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4604ddad802d0245e7b97daa20a646f81e56aecc..74c1bf2b26c5a3aa0d8c29674dc12993e7c0de15:/src/surf/instr_routing.cpp diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index 039ed4c74d..7996735e02 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -111,7 +111,7 @@ static void linkContainers (container_t src, container_t dst, xbt_dict_t filter) } //register EDGE types for triva configuration - xbt_dict_set (trivaEdgeTypes, link_type->name, xbt_strdup("1"), nullptr); + trivaEdgeTypes.insert(link_type->name); //create the link static long long counter = 0; @@ -135,7 +135,7 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t XBT_DEBUG("Graph extraction for NetZone = %s", netzone->getCname()); if (not netzone->getChildren()->empty()) { //bottom-up recursion - for (auto nz_son : *netzone->getChildren()) { + for (auto const& nz_son : *netzone->getChildren()) { container_t child_container = static_cast(xbt_dict_get(container->children, nz_son->getCname())); recursiveGraphExtraction(nz_son, child_container, filter); } @@ -234,7 +234,7 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link) } static void sg_instr_new_host(simgrid::s4u::Host& host) -{ paje_value pj_value; +{ container_t father = currentContainer.back(); container_t container = PJ_container_new(host.getCname(), INSTR_HOST, father); @@ -267,11 +267,11 @@ static void sg_instr_new_host(simgrid::s4u::Host& host) if (msg_process == nullptr){ msg_process = PJ_type_container_new("MSG_PROCESS", container->type); type_t state = PJ_type_state_new ("MSG_PROCESS_STATE", msg_process); - pj_value.PJ_value_new ("suspend", "1 0 1", state); - pj_value.PJ_value_new ("sleep", "1 1 0", state); - pj_value.PJ_value_new ("receive", "1 0 0", state); - pj_value.PJ_value_new ("send", "0 0 1", state); - pj_value.PJ_value_new ("task_execute", "0 1 1", state); + 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); PJ_type_link_new ("MSG_PROCESS_LINK", PJ_type_get_root(), msg_process, msg_process); PJ_type_link_new ("MSG_PROCESS_TASK_LINK", PJ_type_get_root(), msg_process, msg_process); } @@ -282,11 +282,11 @@ static void sg_instr_new_host(simgrid::s4u::Host& host) if (msg_vm == nullptr){ msg_vm = PJ_type_container_new("MSG_VM", container->type); type_t state = PJ_type_state_new ("MSG_VM_STATE", msg_vm); - pj_value.PJ_value_new ("suspend", "1 0 1", state); - pj_value.PJ_value_new ("sleep", "1 1 0", state); - pj_value.PJ_value_new ("receive", "1 0 0", state); - pj_value.PJ_value_new ("send", "0 0 1", state); - pj_value.PJ_value_new ("task_execute", "0 1 1", state); + 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); PJ_type_link_new ("MSG_VM_LINK", PJ_type_get_root(), msg_vm, msg_vm); PJ_type_link_new ("MSG_VM_PROCESS_LINK", PJ_type_get_root(), msg_vm, msg_vm); } @@ -400,16 +400,16 @@ 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 *value, const char *color, type_t root) -{ paje_value pj_value; +static void recursiveNewValueForUserStateType(const char* type_name, const char* val, const char* color, type_t root) +{ if (not strcmp(root->name, type_name)) { - pj_value.PJ_value_new (value, color, root); + value PJ_value(val, color, root); } xbt_dict_cursor_t cursor = nullptr; type_t child_type; char *name; xbt_dict_foreach(root->children, cursor, name, child_type) { - recursiveNewValueForUserStateType (type_name, value, color, child_type); + recursiveNewValueForUserStateType(type_name, val, color, child_type); } } @@ -430,7 +430,7 @@ static void recursiveXBTGraphExtraction(xbt_graph_t graph, xbt_dict_t nodes, xbt { if (not netzone->getChildren()->empty()) { //bottom-up recursion - for (auto netzone_child : *netzone->getChildren()) { + for (auto const& netzone_child : *netzone->getChildren()) { container_t child_container = static_cast(xbt_dict_get(container->children, netzone_child->getCname())); recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container);