X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c312320c2e43da49b536c51a9d19b6ad6d66e489..cef6554994ae17d8f56c9245ad2c10c7cf39af8c:/src/mc/transition/TransitionAny.cpp diff --git a/src/mc/transition/TransitionAny.cpp b/src/mc/transition/TransitionAny.cpp index f532369d28..580fb44389 100644 --- a/src/mc/transition/TransitionAny.cpp +++ b/src/mc/transition/TransitionAny.cpp @@ -21,15 +21,17 @@ TestAnyTransition::TestAnyTransition(aid_t issuer, int times_considered, std::st xbt_assert(stream >> size); for (int i = 0; i < size; i++) { Transition* t = deserialize_transition(issuer, 0, stream); - XBT_DEBUG("TestAny received a transition %s", t->to_string(true).c_str()); + XBT_INFO("TestAny received a transition %s", t->to_string(true).c_str()); transitions_.push_back(t); } } std::string TestAnyTransition::to_string(bool verbose) const { - auto res = xbt::string_printf("TestAny{ "); - for (auto const* t : transitions_) + auto res = xbt::string_printf("TestAny(%s){ ", this->result() ? "TRUE" : "FALSE"); + for (auto const* t : transitions_) { res += t->to_string(verbose); + res += "; "; + } res += " }"; return res; } @@ -41,6 +43,16 @@ bool TestAnyTransition::depends(const Transition* other) const return transitions_[times_considered_]->depends(other); } +bool TestAnyTransition::reversible_race(const Transition* other) const +{ + switch (type_) { + case Type::TESTANY: + return true; // TestAny is always enabled + default: + xbt_die("Unexpected transition type %s", to_c_str(type_)); + } +} + WaitAnyTransition::WaitAnyTransition(aid_t issuer, int times_considered, std::stringstream& stream) : Transition(Type::WAITANY, issuer, times_considered) { @@ -48,6 +60,7 @@ WaitAnyTransition::WaitAnyTransition(aid_t issuer, int times_considered, std::st xbt_assert(stream >> size); for (int i = 0; i < size; i++) { Transition* t = deserialize_transition(issuer, 0, stream); + XBT_INFO("WaitAny received transition %d/%d %s", (i + 1), size, t->to_string(true).c_str()); transitions_.push_back(t); } } @@ -56,7 +69,7 @@ std::string WaitAnyTransition::to_string(bool verbose) const auto res = xbt::string_printf("WaitAny{ "); for (auto const* t : transitions_) res += t->to_string(verbose); - res += " }"; + res += " } (times considered = " + std::to_string(times_considered_) + ")"; return res; } bool WaitAnyTransition::depends(const Transition* other) const @@ -66,5 +79,15 @@ bool WaitAnyTransition::depends(const Transition* other) const return true; return transitions_[times_considered_]->depends(other); } +bool WaitAnyTransition::reversible_race(const Transition* other) const +{ + switch (type_) { + case Type::WAITANY: + // TODO: We need to check if any of the transitions waited on occurred before `e1` + return true; // Let's overapproximate to not miss branches + default: + xbt_die("Unexpected transition type %s", to_c_str(type_)); + } +} } // namespace simgrid::mc