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 Transition::~Transition() {
25 } // Make sure that we have a vtable for Transition by putting this virtual function out of the header
27 std::string Transition::to_string(bool verbose)
31 const char* Transition::to_cstring(bool verbose)
34 return textual_.c_str();
36 void Transition::replay() const
38 replayed_transitions_++;
41 mc_model_checker->handle_simcall(aid_, times_considered_, false);
42 mc_model_checker->wait_for_requests();
45 std::string RandomTransition::to_string(bool verbose)
47 return xbt::string_printf("Random([%d;%d] ~> %d)", min_, max_, times_considered_);
50 RandomTransition::RandomTransition(aid_t issuer, int times_considered, char* buffer)
51 : Transition(issuer, times_considered)
53 std::stringstream stream(buffer);
54 stream >> min_ >> max_;
58 } // namespace simgrid