Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
tracing: new configuration option to control if tracing is active or not
authorschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 23 Nov 2010 14:42:07 +0000 (14:42 +0000)
committerschnorr <schnorr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 23 Nov 2010 14:42:07 +0000 (14:42 +0000)
details:
- if tracing is 0, the tracing system is completely inactive
even if SimGrid was compiled with tracing=on
- by default it is 0

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8617 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/instr/instr_config.c
src/instr/interface.c
src/instr/private.h

index 87f1540..7c26072 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifdef HAVE_TRACING
 
+#define OPT_TRACING               "tracing"
 #define OPT_TRACING_SMPI          "tracing/smpi"
 #define OPT_TRACING_SMPI_GROUP    "tracing/smpi/group"
 #define OPT_TRACING_PLATFORM      "tracing/platform"
 
 static int trace_configured = 0;
 
+int TRACE_is_enabled(void)
+{
+  return xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING);
+}
+
 int TRACE_is_configured(void)
 {
   return trace_configured;
@@ -80,6 +86,13 @@ void TRACE_global_init(int *argc, char **argv)
                    xbt_cfgelm_string, &default_tracing_filename, 1, 1,
                    NULL, NULL);
 
+  /* tracing */
+  int default_tracing = 0;
+  xbt_cfg_register(&_surf_cfg_set, OPT_TRACING,
+                   "Enable Tracing.",
+                   xbt_cfgelm_int, &default_tracing, 0, 1,
+                   NULL, NULL);
+
   /* smpi */
   int default_tracing_smpi = 0;
   xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_SMPI,
index ac237fc..feab87e 100644 (file)
@@ -23,6 +23,10 @@ int TRACE_start()
     return 0;
   }
 
+  if (!TRACE_is_enabled()){
+    return 0;
+  }
+
   if (IS_TRACING) {             /* what? trace is already active... ignore.. */
     THROW0(tracing_error, TRACE_ERROR_START,
            "TRACE_start called, but tracing is already active.");
index e13b084..e57eb0a 100644 (file)
@@ -168,6 +168,7 @@ void TRACE_smpi_send(int rank, int src, int dst);
 void TRACE_smpi_recv(int rank, int src, int dst);
 
 /* from instr_config.c */
+int TRACE_is_enabled(void);
 int TRACE_is_configured(void);
 int TRACE_smpi_is_enabled(void);
 int TRACE_smpi_is_grouped(void);