Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
61623be629955df0d4d0d8899f8d4f2774652aa8
[simgrid.git] / src / mc / Transition.cpp
1 /* Copyright (c) 2015-2022. 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/Transition.hpp"
7 #include "src/mc/ModelChecker.hpp"
8 #include "src/mc/Session.hpp"
9 #include "src/mc/mc_state.hpp"
10 #include "src/mc/remote/RemoteProcess.hpp"
11 #include "xbt/asserts.h"
12
13 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_transition, mc, "Logging specific to MC transitions");
14
15 namespace simgrid {
16 namespace mc {
17 unsigned long Transition::executed_transitions_ = 0;
18
19 std::string Transition::to_string() const
20 {
21   xbt_assert(mc_model_checker != nullptr, "Must be called from MCer");
22
23   return textual_;
24 }
25 const char* Transition::to_cstring() const
26 {
27   xbt_assert(mc_model_checker != nullptr, "Must be called from MCer");
28
29   return textual_.c_str();
30 }
31 void Transition::init(aid_t aid, int times_considered)
32 {
33   aid_              = aid;
34   times_considered_ = times_considered;
35   textual_ = mc_model_checker->simcall_to_string(aid_, times_considered_);
36 }
37 RemotePtr<simgrid::kernel::actor::SimcallObserver> Transition::replay() const
38 {
39   executed_transitions_++;
40
41   simgrid::mc::RemotePtr<simgrid::kernel::actor::SimcallObserver> res = mc_model_checker->handle_simcall(*this);
42   mc_model_checker->wait_for_requests();
43
44   return res;
45 }
46
47 } // namespace mc
48 } // namespace simgrid