X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f0a8a2d708e0a6a1cffac49fbc83d451fe8203a8..4485d715fa3a090c1dd38def83ab8239feebecb3:/src/s4u/s4u_Engine.cpp diff --git a/src/s4u/s4u_Engine.cpp b/src/s4u/s4u_Engine.cpp index 2bcc793eee..aa28e1a034 100644 --- a/src/s4u/s4u_Engine.cpp +++ b/src/s4u/s4u_Engine.cpp @@ -55,10 +55,11 @@ Engine::~Engine() /** @brief Retrieve the engine singleton */ Engine* Engine::get_instance() { - if (s4u::Engine::instance_ == nullptr) - return new Engine(0, nullptr); - else - return s4u::Engine::instance_; + if (s4u::Engine::instance_ == nullptr) { + auto e = new Engine(0, nullptr); + xbt_assert(s4u::Engine::instance_ == e); + } + return s4u::Engine::instance_; } void Engine::shutdown() @@ -86,20 +87,15 @@ double Engine::get_clock() */ void Engine::load_platform(std::string platf) { - double start = 0; - double end = 0; - if (XBT_LOG_ISENABLED(s4u_engine, xbt_log_priority_debug)) - start = xbt_os_time(); + double start = xbt_os_time(); try { parse_platform_file(platf); } catch (xbt_ex& e) { xbt_die("Error while loading %s: %s", platf.c_str(), e.what()); } - if (XBT_LOG_ISENABLED(s4u_engine, xbt_log_priority_debug)) { - end = xbt_os_time(); - XBT_DEBUG("PARSE TIME: %g", (end - start)); - } + double end = xbt_os_time(); + XBT_DEBUG("PARSE TIME: %g", (end - start)); } void Engine::register_function(std::string name, int (*code)(int, char**))