1 /* Copyright (c) 2016-2023. The SimGrid Team. All rights reserved. */
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. */
6 #include "src/mc/explo/Exploration.hpp"
7 #include "src/mc/mc_config.hpp"
8 #include "src/mc/mc_private.hpp"
10 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_explo, mc, "Generic exploration algorithm of the model-checker");
12 namespace simgrid::mc {
14 static simgrid::config::Flag<std::string> cfg_dot_output_file{
15 "model-check/dot-output", "Name of dot output file corresponding to graph state", ""};
17 Exploration::Exploration(const std::vector<char*>& args) : remote_app_(std::make_unique<RemoteApp>(args))
19 mc_model_checker->set_exploration(this);
21 if (not cfg_dot_output_file.get().empty()) {
22 dot_output_ = fopen(cfg_dot_output_file.get().c_str(), "w");
23 xbt_assert(dot_output_ != nullptr, "Error open dot output file: %s", strerror(errno));
25 fprintf(dot_output_, "digraph graphname{\n fixedsize=true; rankdir=TB; ranksep=.25; edge [fontsize=12]; node "
26 "[fontsize=10, shape=circle,width=.5 ]; graph [resolution=20, fontsize=10];\n");
30 Exploration::~Exploration()
32 if (dot_output_ != nullptr)
36 void Exploration::dot_output(const char* fmt, ...)
38 if (dot_output_ != nullptr) {
41 vfprintf(dot_output_, fmt, ap);
47 void Exploration::log_state()
49 if (not cfg_dot_output_file.get().empty()) {
53 if (getenv("SIMGRID_MC_SYSTEM_STATISTICS")) {
54 int ret = system("free");
56 XBT_WARN("Call to system(free) did not return 0, but %d", ret);
60 }; // namespace simgrid::mc