]> AND Public Git Repository - simgrid.git/blobdiff - src/mc/api/State.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use #include <...> for foreign header files.
[simgrid.git] / src / mc / api / State.cpp
index a9d97afd1b7f4cc9749633f0d06c2555eeda4823..6b49c65faab5d09a69c2ae065d3193292f0ebc45 100644 (file)
@@ -14,17 +14,16 @@ namespace simgrid::mc {
 
 long State::expended_states_ = 0;
 
-State::State(const RemoteApp& remote_app) : num_(++expended_states_)
+State::State(RemoteApp& remote_app) : num_(++expended_states_)
 {
   remote_app.get_actors_status(actors_to_run_);
 
   /* Stateful model checking */
-  if ((_sg_mc_checkpoint > 0 && (num_ % _sg_mc_checkpoint == 0)) || _sg_mc_termination) {
-    system_state_ = std::make_shared<simgrid::mc::Snapshot>(num_);
-  }
+  if ((_sg_mc_checkpoint > 0 && (num_ % _sg_mc_checkpoint == 0)) || _sg_mc_termination)
+    system_state_ = std::make_shared<simgrid::mc::Snapshot>(num_, remote_app.get_page_store());
 }
 
-State::State(const RemoteApp& remote_app, const State* previous_state)
+State::State(RemoteApp& remote_app, const State* previous_state)
     : default_transition_(std::make_unique<Transition>()), num_(++expended_states_)
 {
 
@@ -34,7 +33,7 @@ State::State(const RemoteApp& remote_app, const State* previous_state)
 
   /* Stateful model checking */
   if ((_sg_mc_checkpoint > 0 && (num_ % _sg_mc_checkpoint == 0)) || _sg_mc_termination) {
-    system_state_ = std::make_shared<simgrid::mc::Snapshot>(num_);
+    system_state_ = std::make_shared<simgrid::mc::Snapshot>(num_, remote_app.get_page_store());
   }
 
   /* For each actor in the previous sleep set, keep it if it is not dependent with current transition.
@@ -61,12 +60,12 @@ std::size_t State::count_todo() const
   return boost::range::count_if(this->actors_to_run_, [](auto& pair) { return pair.second.is_todo(); });
 }
 
-void State::mark_all_todo()
+void State::mark_all_enabled_todo()
 {
-  for (auto& [aid, actor] : actors_to_run_) {
-
-    if (actor.is_enabled() and not actor.is_done() and not actor.is_todo())
-      actor.mark_todo();
+  for (auto const& [aid, _] : this->get_actors_list()) {
+      if (this->is_actor_enabled(aid) and not is_actor_done(aid)) {
+      this->mark_todo(aid);
+    }
   }
 }