Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc_api renamed to Api
authoreazimi <azimi.ehsan@outlook.com>
Mon, 25 Jan 2021 15:21:06 +0000 (16:21 +0100)
committereazimi <azimi.ehsan@outlook.com>
Mon, 25 Jan 2021 15:21:06 +0000 (16:21 +0100)
src/mc/VisitedState.cpp
src/mc/checker/Checker.hpp
src/mc/checker/CommunicationDeterminismChecker.cpp
src/mc/checker/LivenessChecker.cpp
src/mc/checker/SafetyChecker.cpp
src/mc/checker/simgrid_mc.cpp
src/mc/mc_api.cpp
src/mc/mc_api.hpp
src/mc/mc_state.cpp

index ad68b3a..abea35f 100644 (file)
@@ -14,7 +14,7 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_VisitedState, mc, "Logging specific to state equality detection mechanisms");
 
-using mcapi = simgrid::mc::mc_api;
+using api = simgrid::mc::Api;
 
 namespace simgrid {
 namespace mc {
@@ -22,8 +22,8 @@ namespace mc {
 /** @brief Save the current state */
 VisitedState::VisitedState(unsigned long state_number) : num(state_number)
 {  
-  this->heap_bytes_used = mcapi::get().get_remote_heap_bytes();
-  this->actors_count = mcapi::get().get_actors_size();
+  this->heap_bytes_used = api::get().get_remote_heap_bytes();
+  this->actors_count = api::get().get_actors_size();
   this->system_state = std::make_shared<simgrid::mc::Snapshot>(state_number);
 }
 
@@ -51,12 +51,12 @@ VisitedStates::addVisitedState(unsigned long state_number, simgrid::mc::State* g
             new_state->num, graph_state->num_);
 
   auto range =
-      boost::range::equal_range(states_, new_state.get(), mcapi::get().compare_pair());
+      boost::range::equal_range(states_, new_state.get(), api::get().compare_pair());
 
   if (compare_snapshots)
     for (auto i = range.first; i != range.second; ++i) {
       auto& visited_state = *i;
-      if (mcapi::get().snapshot_equal(visited_state->system_state.get(), new_state->system_state.get())) {
+      if (api::get().snapshot_equal(visited_state->system_state.get(), new_state->system_state.get())) {
         // The state has been visited:
 
         std::unique_ptr<simgrid::mc::VisitedState> old_state =
index 0db97a7..b04d6e3 100644 (file)
@@ -27,7 +27,7 @@ namespace mc {
 // abstract
 class Checker {
 public:
-  inline explicit Checker() { mc_api::get().set_checker(this); }
+  inline explicit Checker() { Api::get().set_checker(this); }
 
   // No copy:
   Checker(Checker const&) = delete;
index 5c2f3ae..644a8b3 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <cstdint>
 
-using mcapi = simgrid::mc::mc_api;
+using api = simgrid::mc::Api;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_determinism, mc, "Logging specific to MC communication determinism detection");
 
@@ -64,7 +64,7 @@ static void restore_communications_pattern(simgrid::mc::State* state)
   for (size_t i = 0; i < initial_communications_pattern.size(); i++)
     initial_communications_pattern[i].index_comm = state->communication_indices_[i];
 
-  for (unsigned long i = 0; i < mcapi::get().get_maxpid(); i++)
+  for (unsigned long i = 0; i < api::get().get_maxpid(); i++)
     patterns_copy(incomplete_communications_pattern[i], state->incomplete_comm_pattern_[i]);
 }
 
@@ -113,15 +113,15 @@ static char* print_determinism_result(simgrid::mc::CommPatternDifference diff, a
 static void update_comm_pattern(simgrid::mc::PatternCommunication* comm_pattern,
                                 const simgrid::kernel::activity::CommImpl* comm_addr)
 {
-  auto src_proc = mcapi::get().get_src_actor(comm_addr);
-  auto dst_proc = mcapi::get().get_dst_actor(comm_addr);
+  auto src_proc = api::get().get_src_actor(comm_addr);
+  auto dst_proc = api::get().get_dst_actor(comm_addr);
   comm_pattern->src_proc = src_proc->get_pid();
   comm_pattern->dst_proc = dst_proc->get_pid();
-  comm_pattern->src_host = mcapi::get().get_actor_host_name(src_proc);
-  comm_pattern->dst_host = mcapi::get().get_actor_host_name(dst_proc);
+  comm_pattern->src_host = api::get().get_actor_host_name(src_proc);
+  comm_pattern->dst_host = api::get().get_actor_host_name(dst_proc);
 
   if (comm_pattern->data.empty())
-    comm_pattern->data = mcapi::get().get_pattern_comm_data(comm_addr);
+    comm_pattern->data = api::get().get_pattern_comm_data(comm_addr);
 }
 
 namespace simgrid {
@@ -153,8 +153,8 @@ void CommunicationDeterminismChecker::deterministic_comm_pattern(aid_t process,
         XBT_INFO("%s", this->send_diff);
         xbt_free(this->send_diff);
         this->send_diff = nullptr;
-        mcapi::get().log_state();
-        mcapi::get().mc_exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
+        api::get().log_state();
+        api::get().mc_exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
       } else if (_sg_mc_comms_determinism && (not this->send_deterministic && not this->recv_deterministic)) {
         XBT_INFO("****************************************************");
         XBT_INFO("***** Non-deterministic communications pattern *****");
@@ -169,8 +169,8 @@ void CommunicationDeterminismChecker::deterministic_comm_pattern(aid_t process,
           xbt_free(this->recv_diff);
           this->recv_diff = nullptr;
         }
-        mcapi::get().log_state();
-        mcapi::get().mc_exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
+        api::get().log_state();
+        api::get().mc_exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
       }
     }
   }
@@ -180,7 +180,7 @@ void CommunicationDeterminismChecker::deterministic_comm_pattern(aid_t process,
 
 void CommunicationDeterminismChecker::get_comm_pattern(smx_simcall_t request, CallType call_type, int backtracking)
 {
-  const smx_actor_t issuer                                     = mcapi::get().simcall_get_issuer(request);
+  const smx_actor_t issuer                                     = api::get().simcall_get_issuer(request);
   const mc::PatternCommunicationList& initial_pattern          = initial_communications_pattern[issuer->get_pid()];
   const std::vector<PatternCommunication*>& incomplete_pattern = incomplete_communications_pattern[issuer->get_pid()];
 
@@ -190,18 +190,18 @@ void CommunicationDeterminismChecker::get_comm_pattern(smx_simcall_t request, Ca
   if (call_type == CallType::SEND) {
     /* Create comm pattern */
     pattern->type      = PatternCommunicationType::send;
-    pattern->comm_addr = mcapi::get().get_comm_isend_raw_addr(request);
-    pattern->rdv      = mcapi::get().get_pattern_comm_rdv(pattern->comm_addr);
-    pattern->src_proc = mcapi::get().get_pattern_comm_src_proc(pattern->comm_addr);
-    pattern->src_host = mc_api::get().get_actor_host_name(issuer);
+    pattern->comm_addr = api::get().get_comm_isend_raw_addr(request);
+    pattern->rdv      = api::get().get_pattern_comm_rdv(pattern->comm_addr);
+    pattern->src_proc = api::get().get_pattern_comm_src_proc(pattern->comm_addr);
+    pattern->src_host = Api::get().get_actor_host_name(issuer);
 
 #if HAVE_SMPI
-    pattern->tag = mcapi::get().get_smpi_request_tag(request, simgrid::simix::Simcall::COMM_ISEND);
+    pattern->tag = api::get().get_smpi_request_tag(request, simgrid::simix::Simcall::COMM_ISEND);
 #endif
-    pattern->data = mcapi::get().get_pattern_comm_data(pattern->comm_addr);
+    pattern->data = api::get().get_pattern_comm_data(pattern->comm_addr);
 
 #if HAVE_SMPI
-    auto send_detached = mcapi::get().check_send_request_detached(request);
+    auto send_detached = api::get().check_send_request_detached(request);
     if (send_detached) {
       if (this->initial_communications_pattern_done) {
         /* Evaluate comm determinism */
@@ -216,15 +216,15 @@ void CommunicationDeterminismChecker::get_comm_pattern(smx_simcall_t request, Ca
 #endif
   } else if (call_type == CallType::RECV) {
     pattern->type = PatternCommunicationType::receive;
-    pattern->comm_addr = mcapi::get().get_comm_isend_raw_addr(request);
+    pattern->comm_addr = api::get().get_comm_isend_raw_addr(request);
 
 #if HAVE_SMPI
-    pattern->tag = mcapi::get().get_smpi_request_tag(request, simgrid::simix::Simcall::COMM_IRECV);
+    pattern->tag = api::get().get_smpi_request_tag(request, simgrid::simix::Simcall::COMM_IRECV);
 #endif
     auto comm_addr = pattern->comm_addr;
-    pattern->rdv = mcapi::get().get_pattern_comm_rdv(comm_addr);
-    pattern->dst_proc = mcapi::get().get_pattern_comm_dst_proc(comm_addr);
-    pattern->dst_host = mcapi::get().get_actor_host_name(issuer);
+    pattern->rdv = api::get().get_pattern_comm_rdv(comm_addr);
+    pattern->dst_proc = api::get().get_pattern_comm_dst_proc(comm_addr);
+    pattern->dst_host = api::get().get_actor_host_name(issuer);
   } else
     xbt_die("Unexpected call_type %i", (int)call_type);
 
@@ -239,7 +239,7 @@ void CommunicationDeterminismChecker::complete_comm_pattern(const kernel::activi
   std::vector<PatternCommunication*>& incomplete_pattern = incomplete_communications_pattern[issuer];
   auto current_comm_pattern =
       std::find_if(begin(incomplete_pattern), end(incomplete_pattern),
-                   [&comm_addr](const PatternCommunication* comm) { return mcapi::get().comm_addr_equal(comm->comm_addr, comm_addr); });
+                   [&comm_addr](const PatternCommunication* comm) { return api::get().comm_addr_equal(comm->comm_addr, comm_addr); });
   if (current_comm_pattern == std::end(incomplete_pattern))
     xbt_die("Corresponding communication not found!");
 
@@ -276,7 +276,7 @@ std::vector<std::string> CommunicationDeterminismChecker::get_textual_trace() //
   std::vector<std::string> trace;
   for (auto const& state : stack_) {
     smx_simcall_t req = &state->executed_req_;
-    trace.push_back(mcapi::get().request_to_string(req, state->transition_.argument_, RequestType::executed));
+    trace.push_back(api::get().request_to_string(req, state->transition_.argument_, RequestType::executed));
   }
   return trace;
 }
@@ -298,8 +298,8 @@ void CommunicationDeterminismChecker::log_state() // override
     }
   }
   XBT_INFO("Expanded states = %lu", expanded_states_count_);
-  XBT_INFO("Visited states = %lu", mcapi::get().mc_get_visited_states());
-  XBT_INFO("Executed transitions = %lu", mcapi::get().mc_get_executed_trans());
+  XBT_INFO("Visited states = %lu", api::get().mc_get_visited_states());
+  XBT_INFO("Executed transitions = %lu", api::get().mc_get_executed_trans());
   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");
@@ -307,7 +307,7 @@ void CommunicationDeterminismChecker::log_state() // override
 
 void CommunicationDeterminismChecker::prepare()
 {
-  const auto maxpid = mcapi::get().get_maxpid();
+  const auto maxpid = api::get().get_maxpid();
 
   initial_communications_pattern.resize(maxpid);
   incomplete_communications_pattern.resize(maxpid);
@@ -318,9 +318,9 @@ void CommunicationDeterminismChecker::prepare()
   XBT_DEBUG("********* Start communication determinism verification *********");
 
   /* Get an enabled actor and insert it in the interleave set of the initial state */
-  auto actors = mcapi::get().get_actors();
+  auto actors = api::get().get_actors();
   for (auto& actor : actors)
-    if (mcapi::get().actor_is_enabled(actor.copy.get_buffer()->get_pid()))
+    if (api::get().actor_is_enabled(actor.copy.get_buffer()->get_pid()))
       initial_state->add_interleaving_set(actor.copy.get_buffer());
 
   stack_.push_back(std::move(initial_state));
@@ -328,7 +328,7 @@ void CommunicationDeterminismChecker::prepare()
 
 static inline bool all_communications_are_finished()
 {
-  auto maxpid = mcapi::get().get_maxpid();
+  auto maxpid = api::get().get_maxpid();
   for (size_t current_actor = 1; current_actor < maxpid; current_actor++) {
     if (not incomplete_communications_pattern[current_actor].empty()) {
       XBT_DEBUG("Some communications are not finished, cannot stop the exploration! State not visited.");
@@ -343,15 +343,15 @@ void CommunicationDeterminismChecker::restoreState()
   /* Intermediate backtracking */
   State* last_state = stack_.back().get();
   if (last_state->system_state_) {
-    mc_api::get().restore_state(last_state->system_state_);
+    Api::get().restore_state(last_state->system_state_);
     restore_communications_pattern(last_state);
     return;
   }
 
   /* Restore the initial state */
-  mcapi::get().restore_initial_state();
+  api::get().restore_initial_state();
 
-  unsigned long n = mcapi::get().get_maxpid();
+  unsigned long n = api::get().get_maxpid();
   assert(n == incomplete_communications_pattern.size());
   assert(n == initial_communications_pattern.size());
   for (unsigned long j = 0; j < n; j++) {
@@ -371,18 +371,18 @@ void CommunicationDeterminismChecker::restoreState()
     /* because we got a copy of the executed request, we have to fetch the
        real one, pointed by the request field of the issuer process */
 
-    const smx_actor_t issuer = mcapi::get().simcall_get_issuer(saved_req);
+    const smx_actor_t issuer = api::get().simcall_get_issuer(saved_req);
     smx_simcall_t req        = &issuer->simcall_;
 
     /* TODO : handle test and testany simcalls */
     CallType call = MC_get_call_type(req);
-    mcapi::get().handle_simcall(state->transition_);
+    api::get().handle_simcall(state->transition_);
     handle_comm_pattern(call, req, req_num, 1);
-    mcapi::get().mc_wait_for_requests();
+    api::get().mc_wait_for_requests();
 
     /* Update statistics */
-    mcapi::get().mc_inc_visited_states();
-    mcapi::get().mc_inc_executed_trans();
+    api::get().mc_inc_visited_states();
+    api::get().mc_inc_executed_trans();
   }
 }
 
@@ -400,10 +400,10 @@ void CommunicationDeterminismChecker::handle_comm_pattern(simgrid::mc::CallType
     case CallType::WAITANY: {
       const simgrid::kernel::activity::CommImpl* comm_addr = nullptr;
       if (call_type == CallType::WAIT)
-        comm_addr = mcapi::get().get_comm_wait_raw_addr(req);
+        comm_addr = api::get().get_comm_wait_raw_addr(req);
       else
-        comm_addr = mcapi::get().get_comm_waitany_raw_addr(req, value);
-      auto simcall_issuer = mcapi::get().simcall_get_issuer(req);
+        comm_addr = api::get().get_comm_waitany_raw_addr(req, value);
+      auto simcall_issuer = api::get().simcall_get_issuer(req);
       complete_comm_pattern(comm_addr, simcall_issuer->get_pid(), backtracking);
     } break;
   default:
@@ -425,23 +425,23 @@ void CommunicationDeterminismChecker::real_run()
               cur_state->interleave_size());
 
     /* Update statistics */
-    mcapi::get().mc_inc_visited_states();
+    api::get().mc_inc_visited_states();
 
     if (stack_.size() <= (std::size_t)_sg_mc_max_depth)
-      req = mcapi::get().mc_state_choose_request(cur_state);
+      req = api::get().mc_state_choose_request(cur_state);
     else
       req = nullptr;
 
     if (req != nullptr && visited_state == nullptr) {
       int req_num = cur_state->transition_.argument_;
 
-      XBT_DEBUG("Execute: %s", mcapi::get().request_to_string(req, req_num, RequestType::simix).c_str());
+      XBT_DEBUG("Execute: %s", api::get().request_to_string(req, req_num, RequestType::simix).c_str());
 
       std::string req_str;
       if (dot_output != nullptr)
-        req_str = mcapi::get().request_get_dot_output(req, req_num);
+        req_str = api::get().request_get_dot_output(req, req_num);
 
-      mcapi::get().mc_inc_executed_trans();
+      api::get().mc_inc_executed_trans();
 
       /* TODO : handle test and testany simcalls */
       CallType call = CallType::NONE;
@@ -449,13 +449,13 @@ void CommunicationDeterminismChecker::real_run()
         call = MC_get_call_type(req);
 
       /* Answer the request */
-      mcapi::get().handle_simcall(cur_state->transition_);
+      api::get().handle_simcall(cur_state->transition_);
       /* After this call req is no longer useful */
 
       handle_comm_pattern(call, req, req_num, 0);
 
       /* Wait for requests (schedules processes) */
-      mcapi::get().mc_wait_for_requests();
+      api::get().mc_wait_for_requests();
 
       /* Create the new expanded state */
       ++expanded_states_count_;
@@ -473,9 +473,9 @@ void CommunicationDeterminismChecker::real_run()
 
       if (visited_state == nullptr) {
         /* Get enabled actors and insert them in the interleave set of the next state */
-        auto actors = mcapi::get().get_actors();
+        auto actors = api::get().get_actors();
         for (auto& actor : actors)
-          if (mcapi::get().actor_is_enabled(actor.copy.get_buffer()->get_pid()))
+          if (api::get().actor_is_enabled(actor.copy.get_buffer()->get_pid()))
             next_state->add_interleaving_set(actor.copy.get_buffer());
 
         if (dot_output != nullptr)
@@ -504,8 +504,8 @@ void CommunicationDeterminismChecker::real_run()
       visited_state = nullptr;
 
       /* Check for deadlocks */
-      if (mcapi::get().mc_check_deadlock()) {
-        mcapi::get().mc_show_deadlock();
+      if (api::get().mc_check_deadlock()) {
+        api::get().mc_show_deadlock();
         throw simgrid::mc::DeadlockError();
       }
 
@@ -529,13 +529,13 @@ void CommunicationDeterminismChecker::real_run()
     }
   }
 
-  mcapi::get().log_state();
+  api::get().log_state();
 }
 
 void CommunicationDeterminismChecker::run()
 {
   XBT_INFO("Check communication determinism");
-  mcapi::get().session_initialize();
+  api::get().session_initialize();
 
   this->prepare();
   this->real_run();
index d455340..1a026d4 100644 (file)
@@ -15,7 +15,7 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc, "Logging specific to algorithms for liveness properties verification");
 
-using mcapi = simgrid::mc::mc_api;
+using api = simgrid::mc::Api;
 
 /********* Static functions *********/
 
@@ -30,8 +30,8 @@ VisitedPair::VisitedPair(int pair_num, xbt_automaton_state_t automaton_state,
   this->graph_state = std::move(graph_state);
   if (this->graph_state->system_state_ == nullptr)
     this->graph_state->system_state_ = std::make_shared<Snapshot>(pair_num);
-  this->heap_bytes_used = mcapi::get().get_remote_heap_bytes();
-  this->actors_count = mcapi::get().get_actors_size();
+  this->heap_bytes_used = api::get().get_remote_heap_bytes();
+  this->actors_count = api::get().get_actors_size();
   this->other_num = -1;
   this->atomic_propositions = std::move(atomic_propositions);
 }
@@ -48,7 +48,7 @@ static bool evaluate_label(const xbt_automaton_exp_label* l, std::vector<int> co
   case xbt_automaton_exp_label::AUT_NOT:
     return not evaluate_label(l->u.exp_not, values);
   case xbt_automaton_exp_label::AUT_PREDICAT:{
-      auto cursor = mcapi::get().compare_automaton_exp_label(l);
+      auto cursor = api::get().compare_automaton_exp_label(l);
       if(cursor >= 0)
         return values[cursor] != 0;
       xbt_die("Missing predicate");
@@ -66,7 +66,7 @@ Pair::Pair(unsigned long expanded_pairs) : num(expanded_pairs)
 
 std::shared_ptr<const std::vector<int>> LivenessChecker::get_proposition_values() const
 {
-  auto values = mcapi::get().automaton_propositional_symbol_evaluate();  
+  auto values = api::get().automaton_propositional_symbol_evaluate();  
   return std::make_shared<const std::vector<int>>(std::move(values));
 }
 
@@ -75,13 +75,13 @@ std::shared_ptr<VisitedPair> LivenessChecker::insert_acceptance_pair(simgrid::mc
   auto new_pair =
       std::make_shared<VisitedPair>(pair->num, pair->automaton_state, pair->atomic_propositions, pair->graph_state);
 
-  auto res = boost::range::equal_range(acceptance_pairs_, new_pair.get(), mcapi::get().compare_pair());
+  auto res = boost::range::equal_range(acceptance_pairs_, new_pair.get(), api::get().compare_pair());
 
   if (pair->search_cycle) for (auto i = res.first; i != res.second; ++i) {
     std::shared_ptr<simgrid::mc::VisitedPair> const& pair_test = *i;
-    if (mcapi::get().automaton_state_compare(pair_test->automaton_state, new_pair->automaton_state) != 0 ||
+    if (api::get().automaton_state_compare(pair_test->automaton_state, new_pair->automaton_state) != 0 ||
         *(pair_test->atomic_propositions) != *(new_pair->atomic_propositions) ||
-        not mcapi::get().snapshot_equal(pair_test->graph_state->system_state_.get(), new_pair->graph_state->system_state_.get()))
+        not api::get().snapshot_equal(pair_test->graph_state->system_state_.get(), new_pair->graph_state->system_state_.get()))
       continue;
     XBT_INFO("Pair %d already reached (equal to pair %d) !", new_pair->num, pair_test->num);
     exploration_stack_.pop_back();
@@ -112,13 +112,13 @@ void LivenessChecker::replay()
   if(_sg_mc_checkpoint > 0) {
     const Pair* pair = exploration_stack_.back().get();
     if (pair->graph_state->system_state_) {
-      mcapi::get().restore_state(pair->graph_state->system_state_);
+      api::get().restore_state(pair->graph_state->system_state_);
       return;
     }
   }
 
   /* Restore the initial state */
-  mcapi::get().restore_initial_state();
+  api::get().restore_initial_state();
 
   /* Traverse the stack from the initial state and re-execute the transitions */
   int depth = 1;
@@ -136,19 +136,19 @@ void LivenessChecker::replay()
 
       /* because we got a copy of the executed request, we have to fetch the
          real one, pointed by the request field of the issuer process */
-      const smx_actor_t issuer = mcapi::get().simcall_get_issuer(saved_req);
+      const smx_actor_t issuer = api::get().simcall_get_issuer(saved_req);
       req                      = &issuer->simcall_;
 
       /* Debug information */
       XBT_DEBUG("Replay (depth = %d) : %s (%p)", depth,
-                mcapi::get().request_to_string(req, req_num, simgrid::mc::RequestType::simix).c_str(), state.get());
+                api::get().request_to_string(req, req_num, simgrid::mc::RequestType::simix).c_str(), state.get());
 
-      mcapi::get().execute(state->transition_);
+      api::get().execute(state->transition_);
     }
 
     /* Update statistics */
     visited_pairs_count_++;
-    mcapi::get().mc_inc_executed_trans();
+    api::get().mc_inc_executed_trans();
 
     depth++;
   }
@@ -167,13 +167,13 @@ int LivenessChecker::insert_visited_pair(std::shared_ptr<VisitedPair> visited_pa
     visited_pair =
         std::make_shared<VisitedPair>(pair->num, pair->automaton_state, pair->atomic_propositions, pair->graph_state);
 
-  auto range = boost::range::equal_range(visited_pairs_, visited_pair.get(), mcapi::get().compare_pair());
+  auto range = boost::range::equal_range(visited_pairs_, visited_pair.get(), api::get().compare_pair());
 
   for (auto i = range.first; i != range.second; ++i) {
     const VisitedPair* pair_test = i->get();
-    if (mcapi::get().automaton_state_compare(pair_test->automaton_state, visited_pair->automaton_state) != 0 ||
+    if (api::get().automaton_state_compare(pair_test->automaton_state, visited_pair->automaton_state) != 0 ||
         *(pair_test->atomic_propositions) != *(visited_pair->atomic_propositions) ||
-        not mcapi::get().snapshot_equal(pair_test->graph_state->system_state_.get(), visited_pair->graph_state->system_state_.get()))
+        not api::get().snapshot_equal(pair_test->graph_state->system_state_.get(), visited_pair->graph_state->system_state_.get()))
       continue;
     if (pair_test->other_num == -1)
       visited_pair->other_num = pair_test->num;
@@ -219,7 +219,7 @@ void LivenessChecker::log_state() // override
 {
   XBT_INFO("Expanded pairs = %lu", expanded_pairs_count_);
   XBT_INFO("Visited pairs = %lu", visited_pairs_count_);
-  XBT_INFO("Executed transitions = %lu", mcapi::get().mc_get_executed_trans());
+  XBT_INFO("Executed transitions = %lu", api::get().mc_get_executed_trans());
 }
 
 void LivenessChecker::show_acceptance_cycle(std::size_t depth)
@@ -230,8 +230,8 @@ void LivenessChecker::show_acceptance_cycle(std::size_t depth)
   XBT_INFO("Counter-example that violates formula:");
   for (auto const& s : this->get_textual_trace())
     XBT_INFO("  %s", s.c_str());
-  mcapi::get().dump_record_path();
-  mcapi::get().log_state();
+  api::get().dump_record_path();
+  api::get().log_state();
   XBT_INFO("Counter-example depth: %zu", depth);
 }
 
@@ -242,7 +242,7 @@ std::vector<std::string> LivenessChecker::get_textual_trace() // override
     int req_num       = pair->graph_state->transition_.argument_;
     smx_simcall_t req = &pair->graph_state->executed_req_;
     if (req->call_ != simix::Simcall::NONE)
-      trace.push_back(mcapi::get().request_to_string(req, req_num, RequestType::executed));
+      trace.push_back(api::get().request_to_string(req, req_num, RequestType::executed));
   }
   return trace;
 }
@@ -261,9 +261,9 @@ std::shared_ptr<Pair> LivenessChecker::create_pair(const Pair* current_pair, xbt
   else
     next_pair->depth = 1;
   /* Get enabled actors and insert them in the interleave set of the next graph_state */
-  auto actors = mcapi::get().get_actors();
+  auto actors = api::get().get_actors();
   for (auto& actor : actors)
-    if (mcapi::get().actor_is_enabled(actor.copy.get_buffer()->get_pid()))
+    if (api::get().actor_is_enabled(actor.copy.get_buffer()->get_pid()))
       next_pair->graph_state->add_interleaving_set(actor.copy.get_buffer());
   next_pair->requests = next_pair->graph_state->interleave_size();
   /* FIXME : get search_cycle value for each accepting state */
@@ -299,10 +299,10 @@ void LivenessChecker::backtrack()
 void LivenessChecker::run()
 {
   XBT_INFO("Check the liveness property %s", _sg_mc_property_file.get().c_str());
-  mcapi::get().automaton_load(_sg_mc_property_file.get().c_str());
+  api::get().automaton_load(_sg_mc_property_file.get().c_str());
 
   XBT_DEBUG("Starting the liveness algorithm");
-  mcapi::get().session_initialize();
+  api::get().session_initialize();
 
   /* Initialize */
   this->previous_pair_ = 0;
@@ -311,7 +311,7 @@ void LivenessChecker::run()
 
   // For each initial state of the property automaton, push a
   // (application_state, automaton_state) pair to the exploration stack:
-  auto automaton_stack = mcapi::get().get_automaton_state();
+  auto automaton_stack = api::get().get_automaton_state();
   for (auto* automaton_state : automaton_stack) {
     if (automaton_state->type == -1)
       exploration_stack_.push_back(this->create_pair(nullptr, automaton_state, propos));
@@ -322,7 +322,7 @@ void LivenessChecker::run()
     std::shared_ptr<Pair> current_pair = exploration_stack_.back();
 
     /* Update current state in buchi automaton */
-    mcapi::get().set_property_automaton(current_pair->automaton_state);
+    api::get().set_property_automaton(current_pair->automaton_state);
 
     XBT_DEBUG(
         "********************* ( Depth = %d, search_cycle = %d, interleave size = %zu, pair_num = %d, requests = %d)",
@@ -359,7 +359,7 @@ void LivenessChecker::run()
       }
     }
 
-    smx_simcall_t req = mcapi::get().mc_state_choose_request(current_pair->graph_state.get());
+    smx_simcall_t req = api::get().mc_state_choose_request(current_pair->graph_state.get());
     int req_num       = current_pair->graph_state->transition_.argument_;
 
     if (dot_output != nullptr) {
@@ -369,25 +369,25 @@ void LivenessChecker::run()
         this->previous_request_.clear();
       }
       this->previous_pair_    = current_pair->num;
-      this->previous_request_ = mcapi::get().request_get_dot_output(req, req_num);
+      this->previous_request_ = api::get().request_get_dot_output(req, req_num);
       if (current_pair->search_cycle)
         fprintf(dot_output, "%d [shape=doublecircle];\n", current_pair->num);
       fflush(dot_output);
     }
 
-    XBT_DEBUG("Execute: %s", mcapi::get().request_to_string(req, req_num, RequestType::simix).c_str());
+    XBT_DEBUG("Execute: %s", api::get().request_to_string(req, req_num, RequestType::simix).c_str());
 
     /* Update stats */
-    mcapi::get().mc_inc_executed_trans();
+    api::get().mc_inc_executed_trans();
 
     if (not current_pair->exploration_started)
       visited_pairs_count_++;
 
     /* Answer the request */
-    mcapi::get().handle_simcall(current_pair->graph_state->transition_);
+    api::get().handle_simcall(current_pair->graph_state->transition_);
 
     /* Wait for requests (schedules processes) */
-    mcapi::get().mc_wait_for_requests();
+    api::get().mc_wait_for_requests();
 
     current_pair->requests--;
     current_pair->exploration_started = true;
@@ -397,16 +397,16 @@ void LivenessChecker::run()
 
     // For each enabled transition in the property automaton, push a
     // (application_state, automaton_state) pair to the exploration stack:
-    for (int i = mcapi::get().get_dynar_length(current_pair->automaton_state->out) - 1; i >= 0; i--) {
-      auto transition_succ_label = mcapi::get().get_automaton_transition_label(current_pair->automaton_state->out, i);
-      auto transition_succ_dst = mcapi::get().get_automaton_transition_dst(current_pair->automaton_state->out, i);      
+    for (int i = api::get().get_dynar_length(current_pair->automaton_state->out) - 1; i >= 0; i--) {
+      auto transition_succ_label = api::get().get_automaton_transition_label(current_pair->automaton_state->out, i);
+      auto transition_succ_dst = api::get().get_automaton_transition_dst(current_pair->automaton_state->out, i);      
       if (evaluate_label(transition_succ_label, *prop_values))
         exploration_stack_.push_back(this->create_pair(current_pair.get(), transition_succ_dst, prop_values));
     }
   }
 
   XBT_INFO("No property violation found.");
-  mcapi::get().log_state();
+  api::get().log_state();
 }
 
 Checker* createLivenessChecker()
index b280941..f74ab5f 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "src/xbt/mmalloc/mmprivate.h"
 
-using mcapi = simgrid::mc::mc_api;
+using api = simgrid::mc::Api;
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_safety, mc, "Logging specific to MC safety verification ");
 
@@ -35,17 +35,17 @@ namespace mc {
 void SafetyChecker::check_non_termination(const State* current_state)
 {
   for (auto state = stack_.rbegin(); state != stack_.rend(); ++state)
-    if (mcapi::get().snapshot_equal((*state)->system_state_.get(), current_state->system_state_.get())) {
+    if (api::get().snapshot_equal((*state)->system_state_.get(), current_state->system_state_.get())) {
       XBT_INFO("Non-progressive cycle: state %d -> state %d", (*state)->num_, current_state->num_);
       XBT_INFO("******************************************");
       XBT_INFO("*** NON-PROGRESSIVE CYCLE DETECTED ***");
       XBT_INFO("******************************************");
       XBT_INFO("Counter-example execution trace:");
-      auto checker = mcapi::get().mc_get_checker();
+      auto checker = api::get().mc_get_checker();
       for (auto const& s : checker->get_textual_trace())
         XBT_INFO("  %s", s.c_str());
-      mcapi::get().dump_record_path();
-      mcapi::get().log_state();
+      api::get().dump_record_path();
+      api::get().log_state();
 
       throw TerminationError();
     }
@@ -65,7 +65,7 @@ std::vector<std::string> SafetyChecker::get_textual_trace() // override
   for (auto const& state : stack_) {
     int value         = state->transition_.argument_;
     smx_simcall_t req = &state->executed_req_;
-    trace.push_back(mcapi::get().request_to_string(req, value, RequestType::executed));
+    trace.push_back(api::get().request_to_string(req, value, RequestType::executed));
   }
   return trace;
 }
@@ -73,8 +73,8 @@ std::vector<std::string> SafetyChecker::get_textual_trace() // override
 void SafetyChecker::log_state() // override
 {
   XBT_INFO("Expanded states = %lu", expanded_states_count_);
-  XBT_INFO("Visited states = %lu", mcapi::get().mc_get_visited_states());
-  XBT_INFO("Executed transitions = %lu", mcapi::get().mc_get_executed_trans());
+  XBT_INFO("Visited states = %lu", api::get().mc_get_visited_states());
+  XBT_INFO("Executed transitions = %lu", api::get().mc_get_executed_trans());
 }
 
 void SafetyChecker::run()
@@ -91,7 +91,7 @@ void SafetyChecker::run()
     XBT_VERB("Exploration depth=%zu (state=%p, num %d)(%zu interleave)", stack_.size(), state, state->num_,
              state->interleave_size());
 
-    mcapi::get().mc_inc_visited_states();
+    api::get().mc_inc_visited_states();
 
     // Backtrack if we reached the maximum depth
     if (stack_.size() > (std::size_t)_sg_mc_max_depth) {
@@ -112,7 +112,7 @@ void SafetyChecker::run()
 
     // Search an enabled transition in the current state; backtrack if the interleave set is empty
     // get_request also sets state.transition to be the one corresponding to the returned req
-    smx_simcall_t req = mcapi::get().mc_state_choose_request(state);
+    smx_simcall_t req = api::get().mc_state_choose_request(state);
     // req is now the transition of the process that was selected to be executed
 
     if (req == nullptr) {
@@ -124,16 +124,16 @@ void SafetyChecker::run()
 
     // If there are processes to interleave and the maximum depth has not been
     // reached then perform one step of the exploration algorithm.
-    XBT_DEBUG("Execute: %s", mcapi::get().request_to_string(req, state->transition_.argument_, RequestType::simix).c_str());
+    XBT_DEBUG("Execute: %s", api::get().request_to_string(req, state->transition_.argument_, RequestType::simix).c_str());
 
     std::string req_str;
     if (dot_output != nullptr)
-      req_str = mcapi::get().request_get_dot_output(req, state->transition_.argument_);
+      req_str = api::get().request_get_dot_output(req, state->transition_.argument_);
 
-    mcapi::get().mc_inc_executed_trans();
+    api::get().mc_inc_executed_trans();
 
     /* Actually answer the request: let execute the selected request (MCed does one step) */
-    mcapi::get().execute(state->transition_);
+    api::get().execute(state->transition_);
 
     /* Create the new expanded state (copy the state of MCed into our MCer data) */
     ++expanded_states_count_;
@@ -149,10 +149,10 @@ void SafetyChecker::run()
     /* If this is a new state (or if we don't care about state-equality reduction) */
     if (visited_state_ == nullptr) {
       /* Get an enabled process and insert it in the interleave set of the next state */
-      auto actors = mcapi::get().get_actors(); 
+      auto actors = api::get().get_actors(); 
       for (auto& remoteActor : actors) {
         auto actor = remoteActor.copy.get_buffer();
-        if (mcapi::get().actor_is_enabled(actor->get_pid())) {
+        if (api::get().actor_is_enabled(actor->get_pid())) {
           next_state->add_interleaving_set(actor);
           if (reductionMode_ == ReductionMode::dpor)
             break; // With DPOR, we take the first enabled transition
@@ -171,7 +171,7 @@ void SafetyChecker::run()
   }
 
   XBT_INFO("No property violation found.");
-  mcapi::get().log_state();
+  api::get().log_state();
 }
 
 void SafetyChecker::backtrack()
@@ -179,8 +179,8 @@ void SafetyChecker::backtrack()
   stack_.pop_back();
 
   /* Check for deadlocks */
-  if (mcapi::get().mc_check_deadlock()) {
-    mcapi::get().mc_show_deadlock();
+  if (api::get().mc_check_deadlock()) {
+    api::get().mc_show_deadlock();
     throw DeadlockError();
   }
 
@@ -197,19 +197,19 @@ void SafetyChecker::backtrack()
       if (req->call_ == simix::Simcall::MUTEX_LOCK || req->call_ == simix::Simcall::MUTEX_TRYLOCK)
         xbt_die("Mutex is currently not supported with DPOR,  use --cfg=model-check/reduction:none");
 
-      const kernel::actor::ActorImpl* issuer = mcapi::get().simcall_get_issuer(req);
+      const kernel::actor::ActorImpl* issuer = api::get().simcall_get_issuer(req);
       for (auto i = stack_.rbegin(); i != stack_.rend(); ++i) {
         State* prev_state = i->get();
-        if (mcapi::get().simcall_check_dependency(req, &prev_state->internal_req_)) {
+        if (api::get().simcall_check_dependency(req, &prev_state->internal_req_)) {
           if (XBT_LOG_ISENABLED(mc_safety, xbt_log_priority_debug)) {
             XBT_DEBUG("Dependent Transitions:");
             int value              = prev_state->transition_.argument_;
             smx_simcall_t prev_req = &prev_state->executed_req_;
-            XBT_DEBUG("%s (state=%d)", mcapi::get().request_to_string(prev_req, value, RequestType::internal).c_str(),
+            XBT_DEBUG("%s (state=%d)", api::get().request_to_string(prev_req, value, RequestType::internal).c_str(),
                       prev_state->num_);
             value    = state->transition_.argument_;
             prev_req = &state->executed_req_;
-            XBT_DEBUG("%s (state=%d)", mcapi::get().request_to_string(prev_req, value, RequestType::executed).c_str(),
+            XBT_DEBUG("%s (state=%d)", api::get().request_to_string(prev_req, value, RequestType::executed).c_str(),
                       state->num_);
           }
 
@@ -219,14 +219,14 @@ void SafetyChecker::backtrack()
             XBT_DEBUG("Process %p is in done set", req->issuer_);
           break;
         } else if (req->issuer_ == prev_state->internal_req_.issuer_) {
-          XBT_DEBUG("Simcall %s and %s with same issuer", mcapi::get().simcall_get_name(req->call_),
-                    mcapi::get().simcall_get_name(prev_state->internal_req_.call_));
+          XBT_DEBUG("Simcall %s and %s with same issuer", api::get().simcall_get_name(req->call_),
+                    api::get().simcall_get_name(prev_state->internal_req_.call_));
           break;
         } else {
-          const kernel::actor::ActorImpl* previous_issuer = mcapi::get().simcall_get_issuer(&prev_state->internal_req_);
+          const kernel::actor::ActorImpl* previous_issuer = api::get().simcall_get_issuer(&prev_state->internal_req_);
           XBT_DEBUG("Simcall %s, process %ld (state %d) and simcall %s, process %ld (state %d) are independent",
-                    mcapi::get().simcall_get_name(req->call_), issuer->get_pid(), state->num_,
-                    mcapi::get().simcall_get_name(prev_state->internal_req_.call_), previous_issuer->get_pid(), prev_state->num_);
+                    api::get().simcall_get_name(req->call_), issuer->get_pid(), state->num_,
+                    api::get().simcall_get_name(prev_state->internal_req_.call_), previous_issuer->get_pid(), prev_state->num_);
         }
       }
     }
@@ -249,21 +249,21 @@ void SafetyChecker::restore_state()
   /* Intermediate backtracking */
   const State* last_state = stack_.back().get();
   if (last_state->system_state_) {
-    mc_api::get().restore_state(last_state->system_state_);
+    Api::get().restore_state(last_state->system_state_);
     return;
   }
 
   /* Restore the initial state */
-  mcapi::get().restore_initial_state();
+  api::get().restore_initial_state();
 
   /* Traverse the stack from the state at position start and re-execute the transitions */
   for (std::unique_ptr<State> const& state : stack_) {
     if (state == stack_.back())
       break;
-    mcapi::get().execute(state->transition_);
+    api::get().execute(state->transition_);
     /* Update statistics */
-    mcapi::get().mc_inc_visited_states();
-    mcapi::get().mc_inc_executed_trans();
+    api::get().mc_inc_visited_states();
+    api::get().mc_inc_executed_trans();
   }
 }
 
@@ -282,7 +282,7 @@ SafetyChecker::SafetyChecker() : Checker()
              (reductionMode_ == ReductionMode::none ? "none"
                                                     : (reductionMode_ == ReductionMode::dpor ? "dpor" : "unknown")));
   
-  mcapi::get().session_initialize();  
+  api::get().session_initialize();  
 
   XBT_DEBUG("Starting the safety algorithm");
 
@@ -293,9 +293,9 @@ SafetyChecker::SafetyChecker() : Checker()
   XBT_DEBUG("Initial state");
 
   /* Get an enabled actor and insert it in the interleave set of the initial state */
-  auto actors = mcapi::get().get_actors();
+  auto actors = api::get().get_actors();
   for (auto& actor : actors)
-    if (mcapi::get().actor_is_enabled(actor.copy.get_buffer()->get_pid())) {
+    if (api::get().actor_is_enabled(actor.copy.get_buffer()->get_pid())) {
       initial_state->add_interleaving_set(actor.copy.get_buffer());
       if (reductionMode_ != ReductionMode::none)
         break;
index b681809..015fb3d 100644 (file)
@@ -18,7 +18,7 @@
 #include <memory>
 #include <unistd.h>
 
-using mcapi = simgrid::mc::mc_api;
+using api = simgrid::mc::Api;
 
 static inline
 char** argvdup(int argc, char** argv)
@@ -55,7 +55,7 @@ int main(int argc, char** argv)
   smpi_init_options(); // only performed once
 #endif
   sg_config_init(&argc, argv);
-  mcapi::get().initialize(argv_copy);
+  api::get().initialize(argv_copy);
   delete[] argv_copy;
 
   auto checker = create_checker();
@@ -70,6 +70,6 @@ int main(int argc, char** argv)
     res = SIMGRID_MC_EXIT_LIVENESS;
   }
   checker = nullptr;
-  mcapi::get().s_close();
+  api::get().s_close();
   return res;
 }
index 33cc692..84fa499 100644 (file)
@@ -17,7 +17,7 @@
 #include "src/smpi/include/smpi_request.hpp"
 #endif
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_api, mc, "Logging specific to MC Fasade APIs ");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(Api, mc, "Logging specific to MC Fasade APIs ");
 
 using Simcall = simgrid::simix::Simcall;
 
@@ -34,7 +34,7 @@ static inline const char* get_color(int id)
 
 static char* pointer_to_string(void* pointer)
 {
-  if (XBT_LOG_ISENABLED(mc_api, xbt_log_priority_verbose))
+  if (XBT_LOG_ISENABLED(Api, xbt_log_priority_verbose))
     return bprintf("%p", pointer);
 
   return xbt_strdup("(verbose only)");
@@ -42,7 +42,7 @@ static char* pointer_to_string(void* pointer)
 
 static char* buff_size_to_string(size_t buff_size)
 {
-  if (XBT_LOG_ISENABLED(mc_api, xbt_log_priority_verbose))
+  if (XBT_LOG_ISENABLED(Api, xbt_log_priority_verbose))
     return bprintf("%zu", buff_size);
 
   return xbt_strdup("(verbose only)");
@@ -289,7 +289,7 @@ static inline smx_simcall_t MC_state_choose_request_for_process(simgrid::mc::Sta
   return req;
 }
 
-void mc_api::initialize(char** argv) const
+void Api::initialize(char** argv) const
 {
   simgrid::mc::session = new simgrid::mc::Session([argv] {
     int i = 1;
@@ -302,51 +302,51 @@ void mc_api::initialize(char** argv) const
   });
 }
 
-std::vector<simgrid::mc::ActorInformation>& mc_api::get_actors() const
+std::vector<simgrid::mc::ActorInformation>& Api::get_actors() const
 {
   return mc_model_checker->get_remote_simulation().actors();
 }
 
-bool mc_api::actor_is_enabled(aid_t pid) const
+bool Api::actor_is_enabled(aid_t pid) const
 {
   return session->actor_is_enabled(pid);
 }
 
-unsigned long mc_api::get_maxpid() const
+unsigned long Api::get_maxpid() const
 {
   return MC_smx_get_maxpid();
 }
 
-int mc_api::get_actors_size() const
+int Api::get_actors_size() const
 {
   return mc_model_checker->get_remote_simulation().actors().size();
 }
 
-bool mc_api::comm_addr_equal(const kernel::activity::CommImpl* comm_addr1,
+bool Api::comm_addr_equal(const kernel::activity::CommImpl* comm_addr1,
                              const kernel::activity::CommImpl* comm_addr2) const
 {
   return remote(comm_addr1) == remote(comm_addr2);
 }
 
-kernel::activity::CommImpl* mc_api::get_comm_isend_raw_addr(smx_simcall_t request) const
+kernel::activity::CommImpl* Api::get_comm_isend_raw_addr(smx_simcall_t request) const
 {
   auto comm_addr = simcall_comm_isend__getraw__result(request);
   return static_cast<kernel::activity::CommImpl*>(comm_addr);
 }
 
-kernel::activity::CommImpl* mc_api::get_comm_wait_raw_addr(smx_simcall_t request) const
+kernel::activity::CommImpl* Api::get_comm_wait_raw_addr(smx_simcall_t request) const
 {
   return simcall_comm_wait__getraw__comm(request);
 }
 
-kernel::activity::CommImpl* mc_api::get_comm_waitany_raw_addr(smx_simcall_t request, int value) const
+kernel::activity::CommImpl* Api::get_comm_waitany_raw_addr(smx_simcall_t request, int value) const
 {
   auto addr =
       mc_model_checker->get_remote_simulation().read(remote(simcall_comm_waitany__getraw__comms(request) + value));
   return static_cast<simgrid::kernel::activity::CommImpl*>(addr);
 }
 
-std::string mc_api::get_pattern_comm_rdv(void* addr) const
+std::string Api::get_pattern_comm_rdv(void* addr) const
 {
   Remote<kernel::activity::CommImpl> temp_synchro;
   mc_model_checker->get_remote_simulation().read(temp_synchro, remote((simgrid::kernel::activity::CommImpl*)addr));
@@ -358,7 +358,7 @@ std::string mc_api::get_pattern_comm_rdv(void* addr) const
   return rdv;
 }
 
-unsigned long mc_api::get_pattern_comm_src_proc(void* addr) const
+unsigned long Api::get_pattern_comm_src_proc(void* addr) const
 {
   Remote<kernel::activity::CommImpl> temp_synchro;
   mc_model_checker->get_remote_simulation().read(temp_synchro, remote((simgrid::kernel::activity::CommImpl*)addr));
@@ -368,7 +368,7 @@ unsigned long mc_api::get_pattern_comm_src_proc(void* addr) const
   return src_proc;
 }
 
-unsigned long mc_api::get_pattern_comm_dst_proc(void* addr) const
+unsigned long Api::get_pattern_comm_dst_proc(void* addr) const
 {
   Remote<kernel::activity::CommImpl> temp_synchro;
   mc_model_checker->get_remote_simulation().read(temp_synchro, remote((simgrid::kernel::activity::CommImpl*)addr));
@@ -378,7 +378,7 @@ unsigned long mc_api::get_pattern_comm_dst_proc(void* addr) const
   return src_proc;
 }
 
-std::vector<char> mc_api::get_pattern_comm_data(void* addr) const
+std::vector<char> Api::get_pattern_comm_data(void* addr) const
 {
   Remote<kernel::activity::CommImpl> temp_synchro;
   mc_model_checker->get_remote_simulation().read(temp_synchro, remote((simgrid::kernel::activity::CommImpl*)addr));
@@ -392,7 +392,7 @@ std::vector<char> mc_api::get_pattern_comm_data(void* addr) const
   return buffer;
 }
 
-std::vector<char> mc_api::get_pattern_comm_data(const kernel::activity::CommImpl* comm_addr) const
+std::vector<char> Api::get_pattern_comm_data(const kernel::activity::CommImpl* comm_addr) const
 {
   simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
   mc_model_checker->get_remote_simulation().read(temp_comm, remote((kernel::activity::CommImpl*)comm_addr));
@@ -406,14 +406,14 @@ std::vector<char> mc_api::get_pattern_comm_data(const kernel::activity::CommImpl
   return buffer;
 }
 
-const char* mc_api::get_actor_host_name(smx_actor_t actor) const
+const char* Api::get_actor_host_name(smx_actor_t actor) const
 {
   const char* host_name = MC_smx_actor_get_host_name(actor);
   return host_name;
 }
 
 #if HAVE_SMPI
-bool mc_api::check_send_request_detached(smx_simcall_t const& simcall) const
+bool Api::check_send_request_detached(smx_simcall_t const& simcall) const
 {
   simgrid::smpi::Request mpi_request;
   mc_model_checker->get_remote_simulation().read(
@@ -422,7 +422,7 @@ bool mc_api::check_send_request_detached(smx_simcall_t const& simcall) const
 }
 #endif
 
-smx_actor_t mc_api::get_src_actor(const kernel::activity::CommImpl* comm_addr) const
+smx_actor_t Api::get_src_actor(const kernel::activity::CommImpl* comm_addr) const
 {
   simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
   mc_model_checker->get_remote_simulation().read(temp_comm, remote((kernel::activity::CommImpl*)comm_addr));
@@ -432,7 +432,7 @@ smx_actor_t mc_api::get_src_actor(const kernel::activity::CommImpl* comm_addr) c
   return src_proc;
 }
 
-smx_actor_t mc_api::get_dst_actor(const kernel::activity::CommImpl* comm_addr) const
+smx_actor_t Api::get_dst_actor(const kernel::activity::CommImpl* comm_addr) const
 {
   simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
   mc_model_checker->get_remote_simulation().read(temp_comm, remote((kernel::activity::CommImpl*)comm_addr));
@@ -442,117 +442,117 @@ smx_actor_t mc_api::get_dst_actor(const kernel::activity::CommImpl* comm_addr) c
   return dst_proc;
 }
 
-std::size_t mc_api::get_remote_heap_bytes() const
+std::size_t Api::get_remote_heap_bytes() const
 {
   RemoteSimulation& process = mc_model_checker->get_remote_simulation();
   auto heap_bytes_used      = mmalloc_get_bytes_used_remote(process.get_heap()->heaplimit, process.get_malloc_info());
   return heap_bytes_used;
 }
 
-void mc_api::session_initialize() const
+void Api::session_initialize() const
 {
   session->initialize();
 }
 
-void mc_api::mc_inc_visited_states() const
+void Api::mc_inc_visited_states() const
 {
   mc_model_checker->visited_states++;
 }
 
-void mc_api::mc_inc_executed_trans() const
+void Api::mc_inc_executed_trans() const
 {
   mc_model_checker->executed_transitions++;
 }
 
-unsigned long mc_api::mc_get_visited_states() const
+unsigned long Api::mc_get_visited_states() const
 {
   return mc_model_checker->visited_states;
 }
 
-unsigned long mc_api::mc_get_executed_trans() const
+unsigned long Api::mc_get_executed_trans() const
 {
   return mc_model_checker->executed_transitions;
 }
 
-bool mc_api::mc_check_deadlock() const
+bool Api::mc_check_deadlock() const
 {
   return mc_model_checker->checkDeadlock();
 }
 
-void mc_api::mc_show_deadlock() const
+void Api::mc_show_deadlock() const
 {
   MC_show_deadlock();
 }
 
-smx_actor_t mc_api::simcall_get_issuer(s_smx_simcall const* req) const
+smx_actor_t Api::simcall_get_issuer(s_smx_simcall const* req) const
 {
   return MC_smx_simcall_get_issuer(req);
 }
 
-long mc_api::simcall_get_actor_id(s_smx_simcall const* req) const
+long Api::simcall_get_actor_id(s_smx_simcall const* req) const
 {
   return MC_smx_simcall_get_issuer(req)->get_pid();
 }
 
-smx_mailbox_t mc_api::simcall_get_mbox(smx_simcall_t const req) const
+smx_mailbox_t Api::simcall_get_mbox(smx_simcall_t const req) const
 {
   return get_mbox(req);
 }
 
-simgrid::kernel::activity::CommImpl* mc_api::simcall_get_comm(smx_simcall_t const req) const
+simgrid::kernel::activity::CommImpl* Api::simcall_get_comm(smx_simcall_t const req) const
 {
   return get_comm(req);
 }
 
-bool mc_api::mc_is_null() const
+bool Api::mc_is_null() const
 {
   auto is_null = (mc_model_checker == nullptr) ? true : false;
   return is_null;
 }
 
-Checker* mc_api::mc_get_checker() const
+Checker* Api::mc_get_checker() const
 {
   return mc_model_checker->getChecker();
 }
 
-void mc_api::set_checker(Checker* const checker) const
+void Api::set_checker(Checker* const checker) const
 {
   xbt_assert(mc_model_checker);
   xbt_assert(mc_model_checker->getChecker() == nullptr);
   mc_model_checker->setChecker(checker);
 }
 
-RemoteSimulation& mc_api::mc_get_remote_simulation() const
+RemoteSimulation& Api::mc_get_remote_simulation() const
 {
   return mc_model_checker->get_remote_simulation();
 }
 
-void mc_api::handle_simcall(Transition const& transition) const
+void Api::handle_simcall(Transition const& transition) const
 {
   mc_model_checker->handle_simcall(transition);
 }
 
-void mc_api::mc_wait_for_requests() const
+void Api::mc_wait_for_requests() const
 {
   mc_model_checker->wait_for_requests();
 }
 
-void mc_api::mc_exit(int status) const
+void Api::mc_exit(int status) const
 {
   mc_model_checker->exit(status);
 }
 
-std::string const& mc_api::mc_get_host_name(std::string const& hostname) const
+std::string const& Api::mc_get_host_name(std::string const& hostname) const
 {
   return mc_model_checker->get_host_name(hostname);
 }
 
-void mc_api::dump_record_path() const
+void Api::dump_record_path() const
 {
   simgrid::mc::dumpRecordPath();
 }
 
-smx_simcall_t mc_api::mc_state_choose_request(simgrid::mc::State* state) const
+smx_simcall_t Api::mc_state_choose_request(simgrid::mc::State* state) const
 {
   for (auto& actor : mc_model_checker->get_remote_simulation().actors()) {
     /* Only consider the actors that were marked as interleaving by the checker algorithm */
@@ -566,7 +566,7 @@ smx_simcall_t mc_api::mc_state_choose_request(simgrid::mc::State* state) const
   return nullptr;
 }
 
-bool mc_api::simcall_check_dependency(smx_simcall_t const req1, smx_simcall_t const req2) const
+bool Api::simcall_check_dependency(smx_simcall_t const req1, smx_simcall_t const req2) const
 {
   if (req1->issuer_ == req2->issuer_)
     return false;
@@ -601,7 +601,7 @@ bool mc_api::simcall_check_dependency(smx_simcall_t const req1, smx_simcall_t co
   }
 }
 
-std::string mc_api::request_to_string(smx_simcall_t req, int value, RequestType request_type) const
+std::string Api::request_to_string(smx_simcall_t req, int value, RequestType request_type) const
 {
   xbt_assert(mc_model_checker != nullptr, "Must be called from MCer");
 
@@ -792,7 +792,7 @@ std::string mc_api::request_to_string(smx_simcall_t req, int value, RequestType
   return str;
 }
 
-std::string mc_api::request_get_dot_output(smx_simcall_t req, int value) const
+std::string Api::request_get_dot_output(smx_simcall_t req, int value) const
 {
   const smx_actor_t issuer = MC_smx_simcall_get_issuer(req);
   const char* color        = get_color(issuer->get_pid() - 1);
@@ -915,13 +915,13 @@ std::string mc_api::request_get_dot_output(smx_simcall_t req, int value) const
   return xbt::string_printf("label = \"%s\", color = %s, fontcolor = %s", label.c_str(), color, color);
 }
 
-const char* mc_api::simcall_get_name(simgrid::simix::Simcall kind) const
+const char* Api::simcall_get_name(simgrid::simix::Simcall kind) const
 {
   return SIMIX_simcall_name(kind);
 }
 
 #if HAVE_SMPI
-int mc_api::get_smpi_request_tag(smx_simcall_t const& simcall, simgrid::simix::Simcall type) const
+int Api::get_smpi_request_tag(smx_simcall_t const& simcall, simgrid::simix::Simcall type) const
 {
   simgrid::smpi::Request mpi_request;
   void* simcall_data = nullptr;
@@ -934,50 +934,50 @@ int mc_api::get_smpi_request_tag(smx_simcall_t const& simcall, simgrid::simix::S
 }
 #endif
 
-void mc_api::restore_state(std::shared_ptr<simgrid::mc::Snapshot> system_state) const
+void Api::restore_state(std::shared_ptr<simgrid::mc::Snapshot> system_state) const
 {
   system_state->restore(&mc_model_checker->get_remote_simulation());
 }
 
-void mc_api::log_state() const
+void Api::log_state() const
 {
   session->log_state();
 }
 
-bool mc_api::snapshot_equal(const Snapshot* s1, const Snapshot* s2) const
+bool Api::snapshot_equal(const Snapshot* s1, const Snapshot* s2) const
 {
   return simgrid::mc::snapshot_equal(s1, s2);
 }
 
-simgrid::mc::Snapshot* mc_api::take_snapshot(int num_state) const
+simgrid::mc::Snapshot* Api::take_snapshot(int num_state) const
 {
   auto snapshot = new simgrid::mc::Snapshot(num_state);
   return snapshot;
 }
 
-void mc_api::s_close() const
+void Api::s_close() const
 {
   session->close();
 }
 
-void mc_api::restore_initial_state() const
+void Api::restore_initial_state() const
 {
   session->restore_initial_state();
 }
 
-void mc_api::execute(Transition const& transition) const
+void Api::execute(Transition const& transition) const
 {
   session->execute(transition);
 }
 
 #if SIMGRID_HAVE_MC
-void mc_api::automaton_load(const char* file) const
+void Api::automaton_load(const char* file) const
 {
   MC_automaton_load(file);
 }
 #endif
 
-std::vector<int> mc_api::automaton_propositional_symbol_evaluate() const
+std::vector<int> Api::automaton_propositional_symbol_evaluate() const
 {
   unsigned int cursor = 0;
   std::vector<int> values;
@@ -987,7 +987,7 @@ std::vector<int> mc_api::automaton_propositional_symbol_evaluate() const
   return values;
 }
 
-std::vector<xbt_automaton_state_t> mc_api::get_automaton_state() const
+std::vector<xbt_automaton_state_t> Api::get_automaton_state() const
 {
   std::vector<xbt_automaton_state_t> automaton_stack;
   unsigned int cursor = 0;
@@ -998,7 +998,7 @@ std::vector<xbt_automaton_state_t> mc_api::get_automaton_state() const
   return automaton_stack;
 }
 
-int mc_api::compare_automaton_exp_label(const xbt_automaton_exp_label* l) const
+int Api::compare_automaton_exp_label(const xbt_automaton_exp_label* l) const
 {
   unsigned int cursor                    = 0;
   xbt_automaton_propositional_symbol_t p = nullptr;
@@ -1009,18 +1009,18 @@ int mc_api::compare_automaton_exp_label(const xbt_automaton_exp_label* l) const
   return -1;
 }
 
-void mc_api::set_property_automaton(xbt_automaton_state_t const& automaton_state) const
+void Api::set_property_automaton(xbt_automaton_state_t const& automaton_state) const
 {
   mc::property_automaton->current_state = automaton_state;
 }
 
-xbt_automaton_exp_label_t mc_api::get_automaton_transition_label(xbt_dynar_t const& dynar, int index) const
+xbt_automaton_exp_label_t Api::get_automaton_transition_label(xbt_dynar_t const& dynar, int index) const
 {
   const xbt_automaton_transition* transition = xbt_dynar_get_as(dynar, index, xbt_automaton_transition_t);
   return transition->label;
 }
 
-xbt_automaton_state_t mc_api::get_automaton_transition_dst(xbt_dynar_t const& dynar, int index) const
+xbt_automaton_state_t Api::get_automaton_transition_dst(xbt_dynar_t const& dynar, int index) const
 {
   const xbt_automaton_transition* transition = xbt_dynar_get_as(dynar, index, xbt_automaton_transition_t);
   return transition->dst;
index 99b51f5..73ed21f 100644 (file)
@@ -23,9 +23,9 @@ namespace mc {
 ** be capable to acquire the required information through the FACADE layer rather than the direct access to the AppSide.
 */
 
-class mc_api {
+class Api {
 private:
-  mc_api() = default;
+  Api() = default;
 
   struct DerefAndCompareByActorsCountAndUsedHeap {
     template <class X, class Y> bool operator()(X const& a, Y const& b) const
@@ -37,13 +37,13 @@ private:
 
 public:
   // No copy:
-  mc_api(mc_api const&) = delete;
-  void operator=(mc_api const&) = delete;
+  Api(Api const&) = delete;
+  void operator=(Api const&) = delete;
 
-  static mc_api& get()
+  static Api& get()
   {
-    static mc_api mcapi;
-    return mcapi;
+    static Api api;
+    return api;
   }
 
   void initialize(char** argv) const;
index 6125c5e..7121dee 100644 (file)
@@ -10,7 +10,7 @@
 #include <boost/range/algorithm.hpp>
 
 using simgrid::mc::remote;
-using mcapi = simgrid::mc::mc_api;
+using api = simgrid::mc::Api;
 
 namespace simgrid {
 namespace mc {
@@ -18,11 +18,11 @@ namespace mc {
 State::State(unsigned long state_number) : num_(state_number)
 {
   this->internal_comm_.clear();
-  auto maxpid = mcapi::get().get_maxpid();
+  auto maxpid = api::get().get_maxpid();
   actor_states_.resize(maxpid);
   /* Stateful model checking */
   if ((_sg_mc_checkpoint > 0 && (state_number % _sg_mc_checkpoint == 0)) || _sg_mc_termination) {
-    auto snapshot_ptr = mcapi::get().take_snapshot(num_);
+    auto snapshot_ptr = api::get().take_snapshot(num_);
     system_state_ = std::shared_ptr<simgrid::mc::Snapshot>(snapshot_ptr);
     if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
       copy_incomplete_comm_pattern();
@@ -44,7 +44,7 @@ Transition State::get_transition() const
 void State::copy_incomplete_comm_pattern()
 {
   incomplete_comm_pattern_.clear();
-  for (unsigned long i = 0; i < mcapi::get().get_maxpid(); i++) {
+  for (unsigned long i = 0; i < api::get().get_maxpid(); i++) {
     std::vector<simgrid::mc::PatternCommunication> res;
     for (auto const& comm : incomplete_communications_pattern[i])
       res.push_back(comm->dup());