1 /* Copyright (c) 2015-2022. 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/api/Transition.hpp"
7 #include "xbt/asserts.h"
8 #include "xbt/string.hpp"
9 #include <simgrid/config.h>
12 #include "src/mc/ModelChecker.hpp"
17 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_transition, mc, "Logging specific to MC transitions");
21 unsigned long Transition::executed_transitions_ = 0;
22 unsigned long Transition::replayed_transitions_ = 0;
24 // Do not move this to the header, to ensure that we have a vtable for Transition
25 Transition::~Transition() = default;
27 std::string Transition::to_string(bool) const
31 std::string Transition::dot_label() const
33 return xbt::string_printf("[(%ld)] %s", aid_, Transition::to_c_str(type_));
35 void Transition::replay() const
37 replayed_transitions_++;
40 mc_model_checker->handle_simcall(aid_, times_considered_, false);
41 mc_model_checker->wait_for_requests();
44 std::string RandomTransition::to_string(bool verbose) const
46 return xbt::string_printf("Random([%d;%d] ~> %d)", min_, max_, times_considered_);
49 RandomTransition::RandomTransition(aid_t issuer, int times_considered, std::stringstream& stream)
50 : Transition(Type::RANDOM, issuer, times_considered)
52 stream >> min_ >> max_;
54 std::string RandomTransition::dot_label() const
56 return Transition::dot_label() + to_c_str(type_);
60 } // namespace simgrid