X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cc5c4029e1b3601786e6373815f7f8b1ec2717b1..d4ec0a086f41795afaa1e1ea759774aca06745cf:/src/instr/instr_routing.c diff --git a/src/instr/instr_routing.c b/src/instr/instr_routing.c index 9ac2f97035..a0a7cc38f9 100644 --- a/src/instr/instr_routing.c +++ b/src/instr/instr_routing.c @@ -9,6 +9,7 @@ #ifdef HAVE_TRACING #include "surf/surf_private.h" #include "surf/network_private.h" +#include "xbt/graph.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy"); @@ -109,6 +110,9 @@ static void recursiveGraphExtraction (routing_component_t rc, container_t contai strcmp (child1_name, child2_name) != 0){ xbt_dynar_t route = global_routing->get_route (child1_name, child2_name); + if (TRACE_onelink_only()){ + if (xbt_dynar_length (route) > 1) continue; + } unsigned int cpt; void *link; container_t previous = child1; @@ -431,6 +435,9 @@ static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xb strcmp (child1_name, child2_name) != 0){ xbt_dynar_t route = global_routing->get_route (child1_name, child2_name); + if (TRACE_onelink_only()){ + if (xbt_dynar_length (route) > 1) continue; + } unsigned int cpt; void *link; xbt_node_t current, previous = new_xbt_graph_node(graph, child1_name, nodes); @@ -475,5 +482,42 @@ xbt_graph_t instr_routing_platform_graph (void) return ret; } +void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename) +{ + unsigned int cursor = 0; + xbt_node_t node = NULL; + xbt_edge_t edge = NULL; + FILE *file = NULL; + + file = fopen(filename, "w"); + xbt_assert(file, "Failed to open %s \n", filename); + + if (g->directed) + fprintf(file, "digraph test {\n"); + else + fprintf(file, "graph test {\n"); + + fprintf(file, " graph [overlap=scale]\n"); + + fprintf(file, " node [shape=box, style=filled]\n"); + fprintf(file, + " node [width=.3, height=.3, style=filled, color=skyblue]\n\n"); + + xbt_dynar_foreach(g->nodes, cursor, node) { + fprintf(file, " \"%s\";\n", TRACE_node_name(node)); + } + xbt_dynar_foreach(g->edges, cursor, edge) { + const char *src_s = TRACE_node_name (edge->src); + const char *dst_s = TRACE_node_name (edge->dst); + if (g->directed) + fprintf(file, " \"%s\" -> \"%s\";\n", src_s, dst_s); + else + fprintf(file, " \"%s\" -- \"%s\";\n", src_s, dst_s); + } + fprintf(file, "}\n"); + fclose(file); + +} + #endif /* HAVE_TRACING */