Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Avoid useless stuff when logging is disabled in SafetyChecker
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 5 Apr 2016 09:33:29 +0000 (11:33 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 5 Apr 2016 14:32:44 +0000 (16:32 +0200)
src/mc/SafetyChecker.cpp

index 567c82d..b1929fc 100644 (file)
@@ -125,10 +125,14 @@ int SafetyChecker::run()
 
     // If there are processes to interleave and the maximum depth has not been
     // reached then perform one step of the exploration algorithm.
-    char* req_str = simgrid::mc::request_to_string(req, value, simgrid::mc::RequestType::simix);
-    XBT_DEBUG("Execute: %s", req_str);
-    xbt_free(req_str);
 
+    if (XBT_LOG_ISENABLED(mc_safety, xbt_log_priority_debug)) {
+      char* req_str = simgrid::mc::request_to_string(req, value, simgrid::mc::RequestType::simix);
+      XBT_DEBUG("Execute: %s", req_str);
+      xbt_free(req_str);
+    }
+
+    char* req_str = nullptr;
     if (dot_output != nullptr)
       req_str = simgrid::mc::request_get_dot_output(req, value);