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 / VisitedState.cpp
index 873154cc3ee1037222ac6d0c7b7b280b739730ce..5ad40434294e2196d432605f2257ac6948b9c177 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_VisitedState, mc, "Logging specific to state equality detection mechanisms");
 
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
 
 /** @brief Save the current state */
 VisitedState::VisitedState(unsigned long state_number) : num(state_number)
 {
   this->heap_bytes_used = Api::get().get_remote_heap_bytes();
-  this->actors_count    = Api::get().get_actors().size();
+  this->actors_count    = mc_model_checker->get_remote_process().actors().size();
   this->system_state = std::make_shared<simgrid::mc::Snapshot>(state_number);
 }
 
@@ -48,10 +47,10 @@ VisitedStates::addVisitedState(unsigned long state_number, simgrid::mc::State* g
   XBT_DEBUG("Snapshot %p of visited state %ld (exploration stack state %ld)", new_state->system_state.get(),
             new_state->num, graph_state->get_num());
 
-  auto range = boost::range::equal_range(states_, new_state.get(), Api::get().compare_pair());
+  auto [range_begin, range_end] = boost::range::equal_range(states_, new_state.get(), Api::get().compare_pair());
 
   if (compare_snapshots)
-    for (auto i = range.first; i != range.second; ++i) {
+    for (auto i = range_begin; i != range_end; ++i) {
       auto& visited_state = *i;
       if (Api::get().snapshot_equal(visited_state->system_state.get(), new_state->system_state.get())) {
         // The state has been visited:
@@ -81,10 +80,9 @@ VisitedStates::addVisitedState(unsigned long state_number, simgrid::mc::State* g
     }
 
   XBT_DEBUG("Insert new visited state %ld (total : %lu)", new_state->num, (unsigned long)states_.size());
-  states_.insert(range.first, std::move(new_state));
+  states_.insert(range_begin, std::move(new_state));
   this->prune();
   return nullptr;
 }
 
-}
-}
+} // namespace simgrid::mc