double value, const char *what);
XBT_PUBLIC(const char *) TRACE_node_name (xbt_node_t node);
XBT_PUBLIC(xbt_graph_t) TRACE_platform_graph (void);
+XBT_PUBLIC(void) TRACE_platform_graph_export_graphviz (xbt_graph_t g, const char *filename);
XBT_PUBLIC(void) TRACE_user_link_variable(double time, const char *resource,
const char *variable,
double value, const char *what);
#include "msg/msg.h"
#include "simdag/private.h"
#include "simix/private.h"
+#include "xbt/graph_private.h"
typedef enum {
TYPE_VARIABLE,
void instr_new_user_host_variable_type (const char *new_typename, const char *color);
int instr_platform_traced (void);
xbt_graph_t instr_routing_platform_graph (void);
+void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename);
#endif /* HAVE_TRACING */
#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");
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 */
if (graph == NULL){
XBT_INFO ("%s expects --cfg=tracing:1", argv[0]);
}else{
- xbt_graph_export_graphviz(graph, graphvizFile, &TRACE_node_name, NULL);
+ TRACE_platform_graph_export_graphviz (graph, graphvizFile);
XBT_INFO ("Output is in file %s", graphvizFile);
}
MSG_clean();