X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5a006fa396cfcc8a91a8284f0d625b2a9a2565c9..d8646277c6b3e1e80c499bc2d73938a0a4f555a8:/src/mc/explo/DFSExplorer.hpp diff --git a/src/mc/explo/DFSExplorer.hpp b/src/mc/explo/DFSExplorer.hpp index 924484270a..27194a8b46 100644 --- a/src/mc/explo/DFSExplorer.hpp +++ b/src/mc/explo/DFSExplorer.hpp @@ -6,21 +6,29 @@ #ifndef SIMGRID_MC_SAFETY_CHECKER_HPP #define SIMGRID_MC_SAFETY_CHECKER_HPP -#include "src/mc/VisitedState.hpp" +#include "src/mc/api/State.hpp" #include "src/mc/explo/Exploration.hpp" +#if SIMGRID_HAVE_STATEFUL_MC +#include "src/mc/VisitedState.hpp" +#endif + #include #include +#include #include #include namespace simgrid::mc { +using stack_t = std::list>; + class XBT_PRIVATE DFSExplorer : public Exploration { XBT_DECLARE_ENUM_CLASS(ReductionMode, none, dpor); ReductionMode reduction_mode_; - long backtrack_count_ = 0; + unsigned long backtrack_count_ = 0; // for statistics + unsigned long visited_states_count_ = 0; // for statistics static xbt::signal on_exploration_start_signal; static xbt::signal on_backtracking_signal; @@ -35,10 +43,9 @@ class XBT_PRIVATE DFSExplorer : public Exploration { static xbt::signal on_log_state_signal; public: - explicit DFSExplorer(const std::vector& args, bool with_dpor); + explicit DFSExplorer(const std::vector& args, bool with_dpor, bool need_memory_info = false); void run() override; RecordTrace get_record_trace() override; - std::vector get_textual_trace() override; void log_state() override; /** Called once when the exploration starts */ @@ -83,12 +90,27 @@ public: private: void check_non_termination(const State* current_state); void backtrack(); - bool sleep_set_reduction_ = true; /** Stack representing the position in the exploration graph */ - std::list> stack_; + stack_t stack_; +#if SIMGRID_HAVE_STATEFUL_MC VisitedStates visited_states_; std::unique_ptr visited_state_; +#else + void* visited_state_ = nullptr; /* The code uses it to detect whether we are doing stateful MC */ +#endif + + /** Opened states are states that still contains todo actors. + * When backtracking, we pick a state from it*/ + std::vector> opened_states_; + std::shared_ptr best_opened_state(); + + /** Change current stack_ value to correspond to the one we would have + * had if we executed transition to get to state. This is required when + * backtracking, and achieved thanks to the fact states save their parent.*/ + void restore_stack(std::shared_ptr state); + + RecordTrace get_record_trace_of_stack(stack_t stack); }; } // namespace simgrid::mc