Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
implement the DVFS functions in Java
[simgrid.git] / src / mc / mc_state.cpp
index 5033b70..3e211de 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2008-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2008-2017. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 using simgrid::mc::remote;
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_state, mc,
-                                "Logging specific to MC (state)");
-
-/**
- * \brief Creates a state data structure used by the exploration algorithm
- */
-simgrid::mc::State* MC_state_new(unsigned long state_number)
-{
-  simgrid::mc::State* state = new simgrid::mc::State();
-  state->processStates.resize(MC_smx_get_maxpid());
-  state->num = state_number;
-  /* Stateful model checking */
-  if((_sg_mc_checkpoint > 0 && (state_number % _sg_mc_checkpoint == 0)) ||  _sg_mc_termination){
-    state->system_state = simgrid::mc::take_snapshot(state->num);
-    if(_sg_mc_comms_determinism || _sg_mc_send_determinism){
-      MC_state_copy_incomplete_communications_pattern(state);
-      MC_state_copy_index_communications_pattern(state);
-    }
-  }
-  return state;
-}
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_state, mc, "Logging specific to MC (state)");
 
 namespace simgrid {
 namespace mc {
 
-State::State()
+State::State(unsigned long state_number)
 {
   this->internal_comm.clear();
   std::memset(&this->internal_req, 0, sizeof(this->internal_req));
   std::memset(&this->executed_req, 0, sizeof(this->executed_req));
+
+  processStates.resize(MC_smx_get_maxpid());
+  num = state_number;
+  /* Stateful model checking */
+  if ((_sg_mc_checkpoint > 0 && (state_number % _sg_mc_checkpoint == 0)) || _sg_mc_termination) {
+    system_state = simgrid::mc::take_snapshot(num);
+    if (_sg_mc_comms_determinism || _sg_mc_send_determinism) {
+      MC_state_copy_incomplete_communications_pattern(this);
+      MC_state_copy_index_communications_pattern(this);
+    }
+  }
 }
 
 std::size_t State::interleaveSize() const
@@ -77,7 +67,7 @@ static inline smx_simcall_t MC_state_get_request_for_process(
 
   if (!procstate->isToInterleave())
     return nullptr;
-  if (!simgrid::mc::process_is_enabled(process))
+  if (!simgrid::mc::actor_is_enabled(process))
     return nullptr;
 
   smx_simcall_t req = nullptr;
@@ -225,7 +215,7 @@ static inline smx_simcall_t MC_state_get_request_for_process(
 
 smx_simcall_t MC_state_get_request(simgrid::mc::State* state)
 {
-  for (auto& p : mc_model_checker->process().simix_processes()) {
+  for (auto& p : mc_model_checker->process().actors()) {
     smx_simcall_t res = MC_state_get_request_for_process(state, p.copy.getBuffer());
     if (res)
       return res;