X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ab8e2fe95944fb998edd6e95d1022a05175c4f92..67592b097ee1e3d2bc4c1e79d8401732d8d6f869:/src/mc/CommunicationDeterminismChecker.cpp diff --git a/src/mc/CommunicationDeterminismChecker.cpp b/src/mc/CommunicationDeterminismChecker.cpp index f983945862..86b26cc83a 100644 --- a/src/mc/CommunicationDeterminismChecker.cpp +++ b/src/mc/CommunicationDeterminismChecker.cpp @@ -305,13 +305,8 @@ CommunicationDeterminismChecker::~CommunicationDeterminismChecker() RecordTrace CommunicationDeterminismChecker::getRecordTrace() // override { RecordTrace res; - for (auto const& state : stack_) { - int value = 0; - smx_simcall_t saved_req = MC_state_get_executed_request(state.get(), &value); - const smx_process_t issuer = MC_smx_simcall_get_issuer(saved_req); - const int pid = issuer->pid; - res.push_back(RecordTraceElement(pid, value)); - } + for (auto const& state : stack_) + res.push_back(state->getRecordElement()); return res; } @@ -320,11 +315,10 @@ std::vector CommunicationDeterminismChecker::getTextualTrace() // o { std::vector trace; for (auto const& state : stack_) { - int value; - smx_simcall_t req = MC_state_get_executed_request(state.get(), &value); + smx_simcall_t req = &state->executed_req; if (req) trace.push_back(simgrid::mc::request_to_string( - req, value, simgrid::mc::RequestType::executed)); + req, state->req_num, simgrid::mc::RequestType::executed)); } return trace; } @@ -360,7 +354,7 @@ void CommunicationDeterminismChecker::prepare() /* Get an enabled process and insert it in the interleave set of the initial state */ for (auto& p : mc_model_checker->process().simix_processes()) if (simgrid::mc::process_is_enabled(&p.copy)) - MC_state_interleave_process(initial_state.get(), &p.copy); + initial_state->interleave(&p.copy); stack_.push_back(std::move(initial_state)); } @@ -381,7 +375,6 @@ bool all_communications_are_finished() int CommunicationDeterminismChecker::main(void) { - int value; std::unique_ptr visited_state = nullptr; smx_simcall_t req = nullptr; @@ -399,18 +392,19 @@ int CommunicationDeterminismChecker::main(void) mc_stats->visited_states++; if (stack_.size() <= (std::size_t) _sg_mc_max_depth - && (req = MC_state_get_request(state, &value)) + && (req = MC_state_get_request(state)) != nullptr && (visited_state == nullptr)) { + int req_num = state->req_num; + XBT_DEBUG("Execute: %s", simgrid::mc::request_to_string( - req, value, simgrid::mc::RequestType::simix).c_str()); + req, req_num, simgrid::mc::RequestType::simix).c_str()); std::string req_str; if (dot_output != nullptr) - req_str = simgrid::mc::request_get_dot_output(req, value); + req_str = simgrid::mc::request_get_dot_output(req, req_num); - MC_state_set_executed_request(state, req, value); mc_stats->executed_transitions++; /* TODO : handle test and testany simcalls */ @@ -419,12 +413,12 @@ int CommunicationDeterminismChecker::main(void) call = MC_get_call_type(req); /* Answer the request */ - simgrid::mc::handle_simcall(req, value); /* After this call req is no longer useful */ + simgrid::mc::handle_simcall(req, req_num); /* After this call req is no longer useful */ if(!initial_global_state->initial_communications_pattern_done) - MC_handle_comm_pattern(call, req, value, initial_communications_pattern, 0); + MC_handle_comm_pattern(call, req, req_num, initial_communications_pattern, 0); else - MC_handle_comm_pattern(call, req, value, nullptr, 0); + MC_handle_comm_pattern(call, req, req_num, nullptr, 0); /* Wait for requests (schedules processes) */ mc_model_checker->wait_for_requests(); @@ -446,7 +440,7 @@ int CommunicationDeterminismChecker::main(void) /* Get enabled processes and insert them in the interleave set of the next state */ for (auto& p : mc_model_checker->process().simix_processes()) if (simgrid::mc::process_is_enabled(&p.copy)) - MC_state_interleave_process(next_state.get(), &p.copy); + next_state->interleave(&p.copy); if (dot_output != nullptr) fprintf(dot_output, "\"%d\" -> \"%d\" [%s];\n",