Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove the need of pthread_mutex in mmalloc, to allow its use with sthread
[simgrid.git] / src / mc / mc_global.cpp
index e73395080f1779a449502f8105b5e3a00a599899..ef212045bf3295e582fcd4cb41bd58eec51be1dd 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_global, mc, "Logging specific to MC (global)");
 
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
 
 std::vector<double> processes_time;
 
-}
 }
 
 #if SIMGRID_HAVE_MC
@@ -53,9 +51,7 @@ void MC_init_dot_output()
           "digraph graphname{\n fixedsize=true; rankdir=TB; ranksep=.25; edge [fontsize=12]; node [fontsize=10, shape=circle,width=.5 ]; graph [resolution=20, fontsize=10];\n");
 }
 
-
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
 
 /* Liveness */
 xbt_automaton_t property_automaton = nullptr;
@@ -88,20 +84,19 @@ void dumpStack(FILE* file, unw_cursor_t* cursor)
   } while (unw_step(cursor));
 }
 
-}
-}
+} // namespace simgrid::mc
 #endif
 
 double MC_process_clock_get(const simgrid::kernel::actor::ActorImpl* process)
 {
   if (simgrid::mc::processes_time.empty())
     return 0;
-  if (process != nullptr)
-    return simgrid::mc::processes_time[process->get_pid()];
-  return -1;
+  if (process == nullptr)
+    return -1;
+  return simgrid::mc::processes_time.at(process->get_pid());
 }
 
 void MC_process_clock_add(const simgrid::kernel::actor::ActorImpl* process, double amount)
 {
-  simgrid::mc::processes_time[process->get_pid()] += amount;
+  simgrid::mc::processes_time.at(process->get_pid()) += amount;
 }