Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make Liveness and CommDet more similar to Safety
[simgrid.git] / src / mc / checker / CommunicationDeterminismChecker.cpp
index c33c444ed90c51edd461f761863d3cf1a26c17da..a1a136b39f2d342f6c3adea600c185b65b09687f 100644 (file)
@@ -269,10 +269,8 @@ RecordTrace CommunicationDeterminismChecker::get_record_trace() // override
 std::vector<std::string> CommunicationDeterminismChecker::get_textual_trace() // override
 {
   std::vector<std::string> trace;
-  for (auto const& state : stack_) {
-    smx_simcall_t req = &state->executed_req_;
-    trace.push_back(api::get().request_to_string(req, state->transition_.times_considered_));
-  }
+  for (auto const& state : stack_)
+    trace.push_back(state->transition_.to_string());
   return trace;
 }
 
@@ -294,7 +292,7 @@ void CommunicationDeterminismChecker::log_state() // override
   }
   XBT_INFO("Expanded states = %lu", expanded_states_count_);
   XBT_INFO("Visited states = %lu", api::get().mc_get_visited_states());
-  XBT_INFO("Executed transitions = %lu", api::get().mc_get_executed_trans());
+  XBT_INFO("Executed transitions = %lu", Transition::get_executed_transitions());
   XBT_INFO("Send-deterministic : %s", this->send_deterministic ? "Yes" : "No");
   if (_sg_mc_comms_determinism)
     XBT_INFO("Recv-deterministic : %s", this->recv_deterministic ? "Yes" : "No");
@@ -371,13 +369,11 @@ void CommunicationDeterminismChecker::restoreState()
 
     /* TODO : handle test and testany simcalls */
     CallType call = MC_get_call_type(req);
-    api::get().handle_simcall(state->transition_);
+    state->transition_.execute();
     handle_comm_pattern(call, req, req_num, 1);
-    api::get().mc_wait_for_requests();
 
     /* Update statistics */
     api::get().mc_inc_visited_states();
-    api::get().mc_inc_executed_trans();
   }
 }
 
@@ -427,16 +423,15 @@ void CommunicationDeterminismChecker::real_run()
       found_transition = api::get().mc_state_choose_request(cur_state);
 
     if (found_transition && visited_state == nullptr) {
+      aid_t aid         = cur_state->transition_.aid_;
       int req_num = cur_state->transition_.times_considered_;
       smx_simcall_t req = &cur_state->executed_req_;
 
-      XBT_DEBUG("Execute: %s", api::get().request_to_string(req, req_num).c_str());
+      XBT_DEBUG("Execute: %s", cur_state->transition_.to_string().c_str());
 
       std::string req_str;
       if (dot_output != nullptr)
-        req_str = api::get().request_get_dot_output(req, req_num);
-
-      api::get().mc_inc_executed_trans();
+        req_str = api::get().request_get_dot_output(aid, req_num);
 
       /* TODO : handle test and testany simcalls */
       CallType call = CallType::NONE;
@@ -444,14 +439,11 @@ void CommunicationDeterminismChecker::real_run()
         call = MC_get_call_type(req);
 
       /* Answer the request */
-      api::get().handle_simcall(cur_state->transition_);
+      cur_state->transition_.execute();
       /* After this call req is no longer useful */
 
       handle_comm_pattern(call, req, req_num, 0);
 
-      /* Wait for requests (schedules processes) */
-      api::get().mc_wait_for_requests();
-
       /* Create the new expanded state */
       ++expanded_states_count_;
       auto next_state = std::make_unique<State>(expanded_states_count_);