From 78aa51887c68ebffc0a7e2418e1105a5baa41c1c Mon Sep 17 00:00:00 2001 From: schnorr Date: Wed, 21 Mar 2012 10:21:49 +0100 Subject: [PATCH 1/1] [trace] only one public function for extracting the graph of a platform details: - output the extracted graph to a graphviz dot file - this is a side effect of the tracing system (the same algorithm is used for the topological visualization) --- include/instr/instr.h | 8 +++----- src/instr/instr_interface.c | 15 ++++++--------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/include/instr/instr.h b/include/instr/instr.h index 2da6af800a..a4b5a645ed 100644 --- a/include/instr/instr.h +++ b/include/instr/instr.h @@ -32,11 +32,10 @@ XBT_PUBLIC(void) TRACE_declare_mark(const char *mark_type); XBT_PUBLIC(void) TRACE_mark(const char *mark_type, const char *mark_value); /* - * Functions used by graphicator (transform a SimGrid platform + * Function used by graphicator (transform a SimGrid platform * file in a graphviz dot file with the network topology) */ -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(int) TRACE_platform_graph_export_graphviz (const char *filename); /* * User-variables related functions @@ -80,8 +79,7 @@ XBT_PUBLIC(void) TRACE_link_srcdst_variable_sub_with_time (double time, const ch #define TRACE_declare_mark(mark_type) #define TRACE_mark(mark_type,mark_value) -#define TRACE_platform_graph(void) -#define TRACE_platform_graph_export_graphviz(g,filename) +#define TRACE_platform_graph_export_graphviz(filename) #define TRACE_host_variable_declare(var) #define TRACE_host_variable_declare_with_color(var,color) diff --git a/src/instr/instr_interface.c b/src/instr/instr_interface.c index 4472a8285b..00ac548987 100644 --- a/src/instr/instr_interface.c +++ b/src/instr/instr_interface.c @@ -162,19 +162,16 @@ static void instr_user_srcdst_variable(double time, } } - -xbt_graph_t TRACE_platform_graph (void) -{ - if (!TRACE_is_enabled()) return NULL; - return instr_routing_platform_graph (); -} - -void TRACE_platform_graph_export_graphviz (xbt_graph_t g, const char *filename) +int TRACE_platform_graph_export_graphviz (const char *filename) { + /* returns 1 if successful, 0 otherwise */ + if (!TRACE_is_enabled()) return 0; + xbt_graph_t g = instr_routing_platform_graph(); + if (g == NULL) return 0; instr_routing_platform_graph_export_graphviz (g, filename); + return 1; } - /* * Derived functions that use instr_user_variable and TRACE_user_srcdst_variable. * They were previously defined as pre-processors directives, but were transformed -- 2.20.1