Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] C++ification of State
[simgrid.git] / src / mc / CommunicationDeterminismChecker.cpp
index 7075a2e..23c1d53 100644 (file)
@@ -8,7 +8,6 @@
 
 #include <xbt/dynar.h>
 #include <xbt/dynar.hpp>
-#include <xbt/fifo.h>
 #include <xbt/log.h>
 #include <xbt/sysdep.h>
 
@@ -409,14 +408,14 @@ int CommunicationDeterminismChecker::main(void)
     simgrid::mc::State* state = stack_.back().get();
 
     XBT_DEBUG("**************************************************");
-    XBT_DEBUG("Exploration depth = %zi (state = %d, interleaved processes = %d)",
+    XBT_DEBUG("Exploration depth = %zi (state = %d, interleaved processes = %zd)",
               stack_.size(), state->num,
-              MC_state_interleave_size(state));
+              state->interleaveSize());
 
     /* Update statistics */
     mc_stats->visited_states++;
 
-    if (stack_.size() <= _sg_mc_max_depth
+    if (stack_.size() <= (std::size_t) _sg_mc_max_depth
         && (req = MC_state_get_request(state, &value))
         && (visited_state == nullptr)) {
 
@@ -479,7 +478,7 @@ int CommunicationDeterminismChecker::main(void)
 
     } else {
 
-      if (stack_.size() > _sg_mc_max_depth)
+      if (stack_.size() > (std::size_t) _sg_mc_max_depth)
         XBT_WARN("/!\\ Max depth reached ! /!\\ ");
       else if (visited_state != nullptr)
         XBT_DEBUG("State already visited (equal to state %d), exploration stopped on this path.", visited_state->other_num == -1 ? visited_state->num : visited_state->other_num);
@@ -506,8 +505,8 @@ int CommunicationDeterminismChecker::main(void)
       while (!stack_.empty()) {
         std::unique_ptr<simgrid::mc::State> state = std::move(stack_.back());
         stack_.pop_back();
-        if (MC_state_interleave_size(state.get())
-            && stack_.size() < _sg_mc_max_depth) {
+        if (state->interleaveSize()
+            && stack_.size() < (std::size_t) _sg_mc_max_depth) {
           /* We found a back-tracking point, let's loop */
           XBT_DEBUG("Back-tracking to state %d at depth %zi",
             state->num, stack_.size() + 1);
@@ -555,5 +554,10 @@ int CommunicationDeterminismChecker::run()
   return res;
 }
 
+Checker* createCommunicationDeterminismChecker(Session& session)
+{
+  return new CommunicationDeterminismChecker(session);
+}
+
 }
 }
\ No newline at end of file