Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
further tidy the includes in MC
[simgrid.git] / src / mc / checker / CommunicationDeterminismChecker.hpp
1 /* Copyright (c) 2016-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "src/mc/VisitedState.hpp"
7 #include "src/mc/checker/Checker.hpp"
8 #include "src/mc/mc_comm_pattern.hpp"
9
10 #include <string>
11 #include <vector>
12
13 #ifndef SIMGRID_MC_COMMUNICATION_DETERMINISM_CHECKER_HPP
14 #define SIMGRID_MC_COMMUNICATION_DETERMINISM_CHECKER_HPP
15
16 namespace simgrid {
17 namespace mc {
18
19 class XBT_PRIVATE CommunicationDeterminismChecker : public Checker {
20 public:
21   explicit CommunicationDeterminismChecker(Session& session);
22   ~CommunicationDeterminismChecker();
23   void run() override;
24   RecordTrace getRecordTrace() override;
25   std::vector<std::string> getTextualTrace() override;
26 private:
27   void prepare();
28   void real_run();
29   void logState() override;
30   void deterministic_comm_pattern(int process, simgrid::mc::PatternCommunication* comm, int backtracking);
31   void restoreState();
32 public:
33   // These are used by functions which should be moved in CommunicationDeterminismChecker:
34   void get_comm_pattern(smx_simcall_t request, e_mc_call_type_t call_type, int backtracking);
35   void complete_comm_pattern(simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr, unsigned int issuer,
36                              int backtracking);
37
38 private:
39   /** Stack representing the position in the exploration graph */
40   std::list<std::unique_ptr<simgrid::mc::State>> stack_;
41   simgrid::mc::VisitedStates visitedStates_;
42   unsigned long expandedStatesCount_ = 0;
43
44   bool initial_communications_pattern_done = false;
45   bool recv_deterministic                  = true;
46   bool send_deterministic                  = true;
47   char *send_diff = nullptr;
48   char *recv_diff = nullptr;
49 };
50
51 #endif
52
53 }
54 }