Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Include standard header files after local includes.
[simgrid.git] / src / instr / instr_config.c
index 95163f1..3c37551 100644 (file)
@@ -430,7 +430,7 @@ void TRACE_help (int detailed)
       "  are grouped by the hosts where they were executed.",
       detailed);
   print_line (OPT_TRACING_SMPI_COMPUTING, "Generates a \" Computing \" State",
-         "  This option aims at tracing computations in the application, outside SMPI\n"
+      "  This option aims at tracing computations in the application, outside SMPI\n"
       "  to allow further study of simulated or real computation time",
       detailed);
   print_line (OPT_TRACING_MSG_PROCESS, "Trace processes behavior (MSG)",
@@ -634,6 +634,37 @@ void TRACE_generate_viva_cat_conf (void)
   generate_cat_configuration (TRACE_get_viva_cat_conf(), "viva", 0);
 }
 
+static int previous_trace_state = -1;
+
+void instr_pause_tracing (void)
+{
+  previous_trace_state = trace_enabled;
+  if (!TRACE_is_enabled()){
+    XBT_DEBUG ("Tracing is already paused, therefore do nothing.");
+  }else{
+    XBT_DEBUG ("Tracing is being paused.");
+  }
+  trace_enabled = 0;
+  XBT_DEBUG ("Tracing is paused.");
+}
+
+void instr_resume_tracing (void)
+{
+  if (TRACE_is_enabled()){
+    XBT_DEBUG ("Tracing is already running while trying to resume, therefore do nothing.");
+  }else{
+    XBT_DEBUG ("Tracing is being resumed.");
+  }
+
+  if (previous_trace_state != -1){
+    trace_enabled = previous_trace_state;
+  }else{
+    trace_enabled = 1;
+  }
+  XBT_DEBUG ("Tracing is resumed.");
+  previous_trace_state = -1;
+}
+
 #undef OPT_TRACING
 #undef OPT_TRACING_PLATFORM
 #undef OPT_TRACING_SMPI