From e29f4cd7a94c2de60f4a32bf60dcbfff559e963a Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Tue, 5 Apr 2016 11:33:29 +0200 Subject: [PATCH] [mc] Avoid useless stuff when logging is disabled in SafetyChecker --- src/mc/SafetyChecker.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mc/SafetyChecker.cpp b/src/mc/SafetyChecker.cpp index 567c82da36..b1929fc3fc 100644 --- a/src/mc/SafetyChecker.cpp +++ b/src/mc/SafetyChecker.cpp @@ -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); -- 2.20.1