#include <functional>
+#include <xbt/log.h>
#include <xbt/system_error.hpp>
#include <simgrid/sg_config.h>
#include <simgrid/modelchecker.h>
+#include <mc/mc.h>
#include "src/mc/Session.hpp"
+#include "src/mc/mc_state.h"
+#include "src/mc/mc_private.h"
+#include "src/mc/Checker.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_Session, mc, "Model-checker session");
this->close();
}
+void Session::initialize()
+{
+ xbt_assert(initialSnapshot_ == nullptr);
+ mc_model_checker->wait_for_requests();
+ initialSnapshot_ = simgrid::mc::take_snapshot(0);
+}
+
void Session::execute(Transition const& transition)
{
modelChecker_->handle_simcall(transition);
modelChecker_->wait_for_requests();
}
+void Session::restoreInitialState()
+{
+ simgrid::mc::restore_snapshot(this->initialSnapshot_);
+}
+
+void Session::logState()
+{
+ mc_model_checker->getChecker()->logState();
+
+ if ((_sg_mc_dot_output_file != nullptr) && (_sg_mc_dot_output_file[0] != '\0')) {
+ fprintf(dot_output, "}\n");
+ fclose(dot_output);
+ }
+ if (getenv("SIMGRID_MC_SYSTEM_STATISTICS")){
+ int ret=system("free");
+ if(ret!=0)XBT_WARN("system call did not return 0, but %d",ret);
+ }
+}
+
// static
Session* Session::fork(std::function<void(void)> code)
{
void Session::close()
{
+ initialSnapshot_ = nullptr;
if (modelChecker_) {
modelChecker_->shutdown();
modelChecker_ = nullptr;