Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Remove pointless #includes
[simgrid.git] / src / mc / mc_global.cpp
index 898da3f..e92fcaf 100644 (file)
 #include <sys/time.h>
 #endif
 
-#include <xbt/fifo.h>
-#include <xbt/automaton.h>
-
 #include "src/simix/smx_process_private.h"
 
-#ifdef HAVE_MC
+#if HAVE_MC
 #include <libunwind.h>
 #include "src/mc/mc_comm_pattern.h"
 #include "src/mc/mc_request.h"
 
 #include "src/mc/mc_record.h"
 #include "src/mc/mc_protocol.h"
-#include "src/mc/mc_client.h"
-
-extern "C" {
+#include "src/mc/Client.hpp"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_global, mc,
-                                "Logging specific to MC (global)");
-
-}
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_global, mc, "Logging specific to MC (global)");
 
 e_mc_mode_t mc_mode;
 
@@ -59,12 +51,12 @@ std::vector<double> processes_time;
 }
 }
 
-#ifdef HAVE_MC
+#if HAVE_MC
 int user_max_depth_reached = 0;
 
 /* MC global data structures */
 mc_state_t mc_current_state = nullptr;
-char mc_replay_mode = FALSE;
+char mc_replay_mode = false;
 
 mc_stats_t mc_stats = nullptr;
 mc_global_t initial_global_state = nullptr;
@@ -82,29 +74,13 @@ xbt_automaton_t property_automaton = nullptr;
 
 /* Dot output */
 FILE *dot_output = nullptr;
-const char *colors[13];
 
 
 /*******************************  Initialisation of MC *******************************/
 /*********************************************************************************/
 
 void MC_init_dot_output()
-{                               /* FIXME : more colors */
-
-  colors[0] = "blue";
-  colors[1] = "red";
-  colors[2] = "green3";
-  colors[3] = "goldenrod";
-  colors[4] = "brown";
-  colors[5] = "purple";
-  colors[6] = "magenta";
-  colors[7] = "turquoise4";
-  colors[8] = "gray25";
-  colors[9] = "forestgreen";
-  colors[10] = "hotpink";
-  colors[11] = "lightblue";
-  colors[12] = "tan";
-
+{
   dot_output = fopen(_sg_mc_dot_output_file, "w");
 
   if (dot_output == nullptr) {
@@ -117,7 +93,7 @@ void MC_init_dot_output()
 
 }
 
-#ifdef HAVE_MC
+#if HAVE_MC
 void MC_init()
 {
   simgrid::mc::processes_time.resize(simix_process_maxpid);
@@ -144,7 +120,7 @@ void MC_run()
 {
   mc_mode = MC_MODE_CLIENT;
   MC_init();
-  MC_client_main_loop();
+  simgrid::mc::Client::get()->mainLoop();
 }
 
 void MC_exit(void)
@@ -154,41 +130,6 @@ void MC_exit(void)
   //xbt_abort();
 }
 
-#ifdef HAVE_MC
-int MC_deadlock_check()
-{
-  if (mc_mode == MC_MODE_SERVER) {
-    int res;
-    if ((res = mc_model_checker->process().send_message(MC_MESSAGE_DEADLOCK_CHECK)))
-      xbt_die("Could not check deadlock state");
-    s_mc_int_message_t message;
-    ssize_t s = mc_model_checker->process().receive_message(message);
-    if (s == -1)
-      xbt_die("Could not receive message");
-    if (s != sizeof(message) || message.type != MC_MESSAGE_DEADLOCK_CHECK_REPLY)
-      xbt_die("%s received unexpected message %s (%i, size=%i) "
-        "expected MC_MESSAGE_DEADLOCK_CHECK_REPLY (%i, size=%i)",
-        MC_mode_name(mc_mode),
-        MC_message_type_name(message.type), (int) message.type, (int) s,
-        (int) MC_MESSAGE_DEADLOCK_CHECK_REPLY, (int) sizeof(message)
-        );
-    return message.value;
-  }
-
-  int deadlock = FALSE;
-  smx_process_t process;
-  if (xbt_swag_size(simix_global->process_list)) {
-    deadlock = TRUE;
-    xbt_swag_foreach(process, simix_global->process_list)
-      if (simgrid::mc::process_is_enabled(process)) {
-        deadlock = FALSE;
-        break;
-      }
-  }
-  return deadlock;
-}
-#endif
-
 /**
  * \brief Re-executes from the state at position start all the transitions indicated by
  *        a given model-checker stack.
@@ -538,7 +479,7 @@ void MC_process_clock_add(smx_process_t process, double amount)
   simgrid::mc::processes_time[process->pid] += amount;
 }
 
-#ifdef HAVE_MC
+#if HAVE_MC
 void MC_report_assertion_error(void)
 {
   XBT_INFO("**************************");