Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc_api::get_automaton_state() defined. It is called in LivenessChecker::run()
[simgrid.git] / src / mc / mc_api.hpp
1 #ifndef SIMGRID_MC_API_HPP
2 #define SIMGRID_MC_API_HPP
3
4 #include <memory>
5 #include <vector>
6
7 #include "simgrid/forward.h"
8 #include "src/mc/mc_forward.hpp"
9 #include "src/mc/mc_request.hpp"
10 #include "src/mc/mc_state.hpp"
11 #include "xbt/automaton.hpp"
12 #include "xbt/base.h"
13
14 namespace simgrid {
15 namespace mc {
16
17 /*
18 ** This class aimes to implement FACADE APIs for simgrid. The FACADE layer sits between the CheckerSide
19 ** (Unfolding_Checker, DPOR, ...) layer and the
20 ** AppSide layer. The goal is to drill down into the entagled details in the CheckerSide layer and break down the
21 ** detailes in a way that the CheckerSide eventually
22 ** be capable to acquire the required information through the FACADE layer rather than the direct access to the AppSide.
23 */
24
25 class mc_api {
26 private:
27   mc_api() = default;
28
29 public:
30   // No copy:
31   mc_api(mc_api const&) = delete;
32   void operator=(mc_api const&) = delete;
33
34   static mc_api& get()
35   {
36     static mc_api mcapi;
37     return mcapi;
38   }
39
40   void initialize(char** argv);
41
42   // ACTOR APIs  
43   std::vector<simgrid::mc::ActorInformation>& get_actors() const;
44   bool actor_is_enabled(aid_t pid) const;
45   unsigned long get_maxpid() const;
46   int get_actors_size() const;
47
48   // COMMUNICATION APIs
49   bool comm_addr_equal(const kernel::activity::CommImpl* comm_addr1, const kernel::activity::CommImpl* comm_addr2) const;
50   kernel::activity::CommImpl* get_comm_isend_raw_addr(smx_simcall_t request) const;
51   kernel::activity::CommImpl* get_comm_wait_raw_addr(smx_simcall_t request) const;
52   kernel::activity::CommImpl* get_comm_waitany_raw_addr(smx_simcall_t request, int value) const;
53   std::string get_pattern_comm_rdv(void* addr) const;
54   unsigned long get_pattern_comm_src_proc(void* addr) const;
55   unsigned long get_pattern_comm_dst_proc(void* addr) const;
56   std::vector<char> get_pattern_comm_data(void* addr) const;
57   std::vector<char> get_pattern_comm_data(const kernel::activity::CommImpl* comm_addr) const;
58   const char* get_actor_host_name(smx_actor_t actor) const;
59 #if HAVE_SMPI
60   bool check_send_request_detached(smx_simcall_t const& simcall) const;
61 #endif
62   smx_actor_t get_src_actor(const kernel::activity::CommImpl* comm_addr) const;
63   smx_actor_t get_dst_actor(const kernel::activity::CommImpl* comm_addr) const;
64
65   // REMOTE APIs
66   std::size_t get_remote_heap_bytes() const;
67
68   // MODEL CHECKER APIs
69   ModelChecker* get_model_checker() const;
70   void mc_inc_visited_states() const;
71   void mc_inc_executed_trans() const;
72   unsigned long mc_get_visited_states() const;
73   unsigned long mc_get_executed_trans() const;
74   bool mc_check_deadlock() const;
75   void mc_show_deadlock() const;
76   bool mc_is_null() const;
77   Checker* mc_get_checker() const;
78   RemoteSimulation& mc_get_remote_simulation() const;
79   void handle_simcall(Transition const& transition) const;
80   void mc_wait_for_requests() const;
81   XBT_ATTRIB_NORETURN void mc_exit(int status) const;
82   std::string const& mc_get_host_name(std::string const& hostname) const;
83   void dump_record_path() const;
84   smx_simcall_t mc_state_choose_request(simgrid::mc::State* state) const;
85
86   // SIMCALL APIs
87   bool request_depend(smx_simcall_t req1, smx_simcall_t req2) const;
88   std::string request_to_string(smx_simcall_t req, int value, RequestType request_type) const;
89   std::string request_get_dot_output(smx_simcall_t req, int value) const;
90   const char *simcall_get_name(simgrid::simix::Simcall kind) const;
91   smx_actor_t simcall_get_issuer(s_smx_simcall const* req) const;
92 #if HAVE_SMPI
93   int get_smpi_request_tag(smx_simcall_t const& simcall, simgrid::simix::Simcall type) const;
94 #endif
95
96   // STATE APIs
97   void restore_state(std::shared_ptr<simgrid::mc::Snapshot> system_state) const;
98   void log_state() const;
99   void restore_initial_state() const;
100
101   // SNAPSHOT APIs
102   bool snapshot_equal(const Snapshot* s1, const Snapshot* s2) const;
103   simgrid::mc::Snapshot* take_snapshot(int num_state) const;
104
105   // SESSION APIs
106   void session_initialize() const;
107   void s_close() const;
108   void execute(Transition const& transition) const;
109
110   // AUTOMATION APIs
111   #if SIMGRID_HAVE_MC
112   void automaton_load(const char *file) const;
113   #endif
114   std::vector<int> automaton_propositional_symbol_evaluate() const;
115   std::vector<xbt_automaton_state_t> get_automaton_state() const;
116 };
117
118 } // namespace mc
119 } // namespace simgrid
120
121 #endif