X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b8df87e176f27b25534f27d7e240defa32ca35bc..62c07d4306a42be1ed34494a37603bb6dd27a98b:/src/mc/checker/LivenessChecker.hpp diff --git a/src/mc/checker/LivenessChecker.hpp b/src/mc/checker/LivenessChecker.hpp index 25517a02ed..39f899fdb0 100644 --- a/src/mc/checker/LivenessChecker.hpp +++ b/src/mc/checker/LivenessChecker.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2019. The SimGrid Team. +/* Copyright (c) 2007-2021. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -7,19 +7,14 @@ #ifndef SIMGRID_MC_LIVENESS_CHECKER_HPP #define SIMGRID_MC_LIVENESS_CHECKER_HPP -#include +#include "src/mc/checker/Checker.hpp" +#include "src/mc/mc_state.hpp" +#include "xbt/automaton.hpp" -#include #include #include #include -#include "src/mc/checker/Checker.hpp" -#include "src/mc/mc_state.hpp" -#include -#include -#include - namespace simgrid { namespace mc { @@ -27,7 +22,7 @@ class XBT_PRIVATE Pair { public: int num = 0; bool search_cycle = false; - std::shared_ptr graph_state = nullptr; /* System state included */ + std::shared_ptr graph_state = nullptr; /* System state included */ xbt_automaton_state_t automaton_state = nullptr; std::shared_ptr> atomic_propositions; int requests = 0; @@ -35,7 +30,6 @@ public: bool exploration_started = false; explicit Pair(unsigned long expanded_pairs); - ~Pair() = default; Pair(Pair const&) = delete; Pair& operator=(Pair const&) = delete; @@ -45,51 +39,48 @@ class XBT_PRIVATE VisitedPair { public: int num; int other_num = 0; /* Dot output for */ - std::shared_ptr graph_state = nullptr; /* System state included */ + std::shared_ptr graph_state = nullptr; /* System state included */ xbt_automaton_state_t automaton_state; std::shared_ptr> atomic_propositions; std::size_t heap_bytes_used = 0; int actors_count = 0; - VisitedPair( - int pair_num, xbt_automaton_state_t automaton_state, - std::shared_ptr> atomic_propositions, - std::shared_ptr graph_state); - ~VisitedPair() = default; + VisitedPair(int pair_num, xbt_automaton_state_t automaton_state, + std::shared_ptr> atomic_propositions, std::shared_ptr graph_state); }; class XBT_PRIVATE LivenessChecker : public Checker { public: - explicit LivenessChecker(Session& session); - ~LivenessChecker() = default; + explicit LivenessChecker(); void run() override; - RecordTrace getRecordTrace() override; - std::vector getTextualTrace() override; - void logState() override; + RecordTrace get_record_trace() override; + std::vector get_textual_trace() override; + void log_state() override; + private: - int compare(simgrid::mc::VisitedPair* state1, simgrid::mc::VisitedPair* state2); - std::shared_ptr> getPropositionValues(); - std::shared_ptr insertAcceptancePair(simgrid::mc::Pair* pair); - int insertVisitedPair(std::shared_ptr visited_pair, simgrid::mc::Pair* pair); - void showAcceptanceCycle(std::size_t depth); + std::shared_ptr> get_proposition_values() const; + std::shared_ptr insert_acceptance_pair(Pair* pair); + int insert_visited_pair(std::shared_ptr visited_pair, Pair* pair); + void show_acceptance_cycle(std::size_t depth); void replay(); - void removeAcceptancePair(int pair_num); - void purgeVisitedPairs(); + void remove_acceptance_pair(int pair_num); + void purge_visited_pairs(); void backtrack(); - std::shared_ptr newPair(Pair* pair, xbt_automaton_state_t state, std::shared_ptr> propositions); + std::shared_ptr create_pair(const Pair* pair, xbt_automaton_state_t state, + std::shared_ptr> propositions); // A stack of (application_state, automaton_state) pairs for DFS exploration: - std::list> explorationStack_; - std::list> acceptancePairs_; - std::list> visitedPairs_; - unsigned long visitedPairsCount_ = 0; - unsigned long expandedPairsCount_ = 0; - unsigned long expandedStatesCount_ = 0; - int previousPair_ = 0; - std::string previousRequest_; + std::list> exploration_stack_; + std::list> acceptance_pairs_; + std::list> visited_pairs_; + unsigned long visited_pairs_count_ = 0; + unsigned long expanded_pairs_count_ = 0; + unsigned long expanded_states_count_ = 0; + int previous_pair_ = 0; + std::string previous_request_; }; -} -} +} // namespace mc +} // namespace simgrid #endif