auto base = new DFSExplorer(remote_app);
auto extension = new CommDetExtension(*base);
- DFSExplorer::on_exploration_start([extension]() {
+ DFSExplorer::on_exploration_start([extension](RemoteApp&) {
XBT_INFO("Check communication determinism");
extension->exploration_start();
});
- DFSExplorer::on_backtracking([extension]() { extension->initial_communications_pattern_done = true; });
- DFSExplorer::on_state_creation(
- [extension, &remote_app](State* state) { state->extension_set(new StateCommDet(*extension, remote_app)); });
+ DFSExplorer::on_backtracking([extension](RemoteApp&) { extension->initial_communications_pattern_done = true; });
+ DFSExplorer::on_state_creation([extension](State* state, RemoteApp& remote_app) {
+ state->extension_set(new StateCommDet(*extension, remote_app));
+ });
- DFSExplorer::on_restore_system_state(
- [extension, &remote_app](State* state) { extension->restore_communications_pattern(state, remote_app); });
+ DFSExplorer::on_restore_system_state([extension](State* state, RemoteApp& remote_app) {
+ extension->restore_communications_pattern(state, remote_app);
+ });
- DFSExplorer::on_restore_initial_state([extension, &remote_app]() {
+ DFSExplorer::on_restore_initial_state([extension](RemoteApp& remote_app) {
const unsigned long maxpid = remote_app.get_maxpid();
assert(maxpid == extension->incomplete_communications_pattern.size());
assert(maxpid == extension->initial_communications_pattern.size());
}
});
- DFSExplorer::on_transition_replay([extension](Transition* t) { extension->handle_comm_pattern(t); });
- DFSExplorer::on_transition_execute([extension](Transition* t) { extension->handle_comm_pattern(t); });
+ DFSExplorer::on_transition_replay([extension](Transition* t, RemoteApp&) { extension->handle_comm_pattern(t); });
+ DFSExplorer::on_transition_execute([extension](Transition* t, RemoteApp&) { extension->handle_comm_pattern(t); });
- DFSExplorer::on_log_state([extension]() {
+ DFSExplorer::on_log_state([extension](RemoteApp&) {
if (_sg_mc_comms_determinism) {
if (extension->send_deterministic && not extension->recv_deterministic) {
XBT_INFO("*******************************************************");
namespace simgrid::mc {
-xbt::signal<void()> DFSExplorer::on_exploration_start_signal;
-xbt::signal<void()> DFSExplorer::on_backtracking_signal;
+xbt::signal<void(RemoteApp&)> DFSExplorer::on_exploration_start_signal;
+xbt::signal<void(RemoteApp&)> DFSExplorer::on_backtracking_signal;
-xbt::signal<void(State*)> DFSExplorer::on_state_creation_signal;
+xbt::signal<void(State*, RemoteApp&)> DFSExplorer::on_state_creation_signal;
-xbt::signal<void(State*)> DFSExplorer::on_restore_system_state_signal;
-xbt::signal<void()> DFSExplorer::on_restore_initial_state_signal;
-xbt::signal<void(Transition*)> DFSExplorer::on_transition_replay_signal;
-xbt::signal<void(Transition*)> DFSExplorer::on_transition_execute_signal;
+xbt::signal<void(State*, RemoteApp&)> DFSExplorer::on_restore_system_state_signal;
+xbt::signal<void(RemoteApp&)> DFSExplorer::on_restore_initial_state_signal;
+xbt::signal<void(Transition*, RemoteApp&)> DFSExplorer::on_transition_replay_signal;
+xbt::signal<void(Transition*, RemoteApp&)> DFSExplorer::on_transition_execute_signal;
-xbt::signal<void()> DFSExplorer::on_log_state_signal;
+xbt::signal<void(RemoteApp&)> DFSExplorer::on_log_state_signal;
void DFSExplorer::check_non_termination(const State* current_state)
{
void DFSExplorer::log_state() // override
{
- on_log_state_signal();
+ on_log_state_signal(get_remote_app());
XBT_INFO("DFS exploration ended. %ld unique states visited; %ld backtracks (%lu transition replays, %lu states "
"visited overall)",
State::get_expanded_states(), backtrack_count_, mc_model_checker->get_visited_states(),
void DFSExplorer::run()
{
- on_exploration_start_signal();
+ on_exploration_start_signal(get_remote_app());
/* This function runs the DFS algorithm the state space.
* We do so iteratively instead of recursively, dealing with the call stack manually.
* This allows one to explore the call stack at will. */
/* Actually answer the request: let's execute the selected request (MCed does one step) */
state->execute_next(next);
- on_transition_execute_signal(state->get_transition());
+ on_transition_execute_signal(state->get_transition(), get_remote_app());
// If there are processes to interleave and the maximum depth has not been
// reached then perform one step of the exploration algorithm.
/* Create the new expanded state (copy the state of MCed into our MCer data) */
auto next_state = std::make_unique<State>(get_remote_app());
- on_state_creation_signal(next_state.get());
+ on_state_creation_signal(next_state.get(), get_remote_app());
if (_sg_mc_termination)
this->check_non_termination(next_state.get());
{
backtrack_count_++;
XBT_VERB("Backtracking from %s", get_record_trace().to_string().c_str());
- on_backtracking_signal();
+ on_backtracking_signal(get_remote_app());
stack_.pop_back();
get_remote_app().check_deadlock();
State* last_state = stack_.back().get();
if (const auto* system_state = last_state->get_system_state()) {
Api::get().restore_state(system_state);
- on_restore_system_state_signal(last_state);
+ on_restore_system_state_signal(last_state, get_remote_app());
return;
}
/* if no snapshot, we need to restore the initial state and replay the transitions */
get_remote_app().restore_initial_state();
- on_restore_initial_state_signal();
+ on_restore_initial_state_signal(get_remote_app());
/* Traverse the stack from the state at position start and re-execute the transitions */
for (std::unique_ptr<State> const& state : stack_) {
if (state == stack_.back()) /* If we are arrived on the target state, don't replay the outgoing transition */
break;
state->get_transition()->replay();
- on_transition_replay_signal(state->get_transition());
+ on_transition_replay_signal(state->get_transition(), get_remote_app());
/* Update statistics */
mc_model_checker->inc_visited_states();
}
ReductionMode reductionMode_ = ReductionMode::unset;
long backtrack_count_ = 0;
- static xbt::signal<void()> on_exploration_start_signal;
- static xbt::signal<void()> on_backtracking_signal;
+ static xbt::signal<void(RemoteApp&)> on_exploration_start_signal;
+ static xbt::signal<void(RemoteApp&)> on_backtracking_signal;
- static xbt::signal<void(State*)> on_state_creation_signal;
+ static xbt::signal<void(State*, RemoteApp&)> on_state_creation_signal;
- static xbt::signal<void(State*)> on_restore_system_state_signal;
- static xbt::signal<void()> on_restore_initial_state_signal;
- static xbt::signal<void(Transition*)> on_transition_replay_signal;
- static xbt::signal<void(Transition*)> on_transition_execute_signal;
+ static xbt::signal<void(State*, RemoteApp&)> on_restore_system_state_signal;
+ static xbt::signal<void(RemoteApp&)> on_restore_initial_state_signal;
+ static xbt::signal<void(Transition*, RemoteApp&)> on_transition_replay_signal;
+ static xbt::signal<void(Transition*, RemoteApp&)> on_transition_execute_signal;
- static xbt::signal<void()> on_log_state_signal;
+ static xbt::signal<void(RemoteApp&)> on_log_state_signal;
public:
explicit DFSExplorer(RemoteApp& remote_app);
void log_state() override;
/** Called once when the exploration starts */
- static void on_exploration_start(std::function<void()> const& f) { on_exploration_start_signal.connect(f); }
+ static void on_exploration_start(std::function<void(RemoteApp& remote_app)> const& f)
+ {
+ on_exploration_start_signal.connect(f);
+ }
/** Called each time that the exploration backtracks from a exploration end */
- static void on_backtracking(std::function<void()> const& f) { on_backtracking_signal.connect(f); }
+ static void on_backtracking(std::function<void(RemoteApp& remote_app)> const& f)
+ {
+ on_backtracking_signal.connect(f);
+ }
/** Called each time that a new state is create */
- static void on_state_creation(std::function<void(State*)> const& f) { on_state_creation_signal.connect(f); }
+ static void on_state_creation(std::function<void(State*, RemoteApp& remote_app)> const& f)
+ {
+ on_state_creation_signal.connect(f);
+ }
/** Called when rollbacking directly onto a previously checkpointed state */
- static void on_restore_system_state(std::function<void(State*)> const& f)
+ static void on_restore_system_state(std::function<void(State*, RemoteApp& remote_app)> const& f)
{
on_restore_system_state_signal.connect(f);
}
/** Called when the state to which we backtrack was not checkpointed state, forcing us to restore the initial state
* before replaying some transitions */
- static void on_restore_initial_state(std::function<void()> const& f) { on_restore_initial_state_signal.connect(f); }
+ static void on_restore_initial_state(std::function<void(RemoteApp& remote_app)> const& f)
+ {
+ on_restore_initial_state_signal.connect(f);
+ }
/** Called when replaying a transition that was previously executed, to reach a backtracked state */
- static void on_transition_replay(std::function<void(Transition*)> const& f)
+ static void on_transition_replay(std::function<void(Transition*, RemoteApp& remote_app)> const& f)
{
on_transition_replay_signal.connect(f);
}
/** Called when executing a new transition */
- static void on_transition_execute(std::function<void(Transition*)> const& f)
+ static void on_transition_execute(std::function<void(Transition*, RemoteApp& remote_app)> const& f)
{
on_transition_execute_signal.connect(f);
}
/** Called when displaying the statistics at the end of the exploration */
- static void on_log_state(std::function<void()> const& f) { on_log_state_signal.connect(f); }
+ static void on_log_state(std::function<void(RemoteApp&)> const& f) { on_log_state_signal.connect(f); }
private:
void check_non_termination(const State* current_state);