X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/989e6d7e4cb105760aff9acce9ac2d26de2f793d..7e625e5e848a284b522d69ec28cb111f1f88515b:/src/mc/transition/TransitionComm.cpp diff --git a/src/mc/transition/TransitionComm.cpp b/src/mc/transition/TransitionComm.cpp index 01cf287c88..19d8ebfde9 100644 --- a/src/mc/transition/TransitionComm.cpp +++ b/src/mc/transition/TransitionComm.cpp @@ -32,8 +32,8 @@ CommWaitTransition::CommWaitTransition(aid_t issuer, int times_considered, std:: : Transition(Type::COMM_WAIT, issuer, times_considered) { xbt_assert(stream >> timeout_ >> comm_ >> sender_ >> receiver_ >> mbox_ >> call_location_); - XBT_DEBUG("CommWaitTransition %s comm:%u, sender:%ld receiver:%ld mbox:%u", (timeout_ ? "timeout" : "no-timeout"), - comm_, sender_, receiver_, mbox_); + XBT_DEBUG("CommWaitTransition %s comm:%u, sender:%ld receiver:%ld mbox:%u call_loc:%s", + (timeout_ ? "timeout" : "no-timeout"), comm_, sender_, receiver_, mbox_, call_location_.c_str()); } std::string CommWaitTransition::to_string(bool verbose) const { @@ -56,6 +56,18 @@ bool CommWaitTransition::depends(const Transition* other) const return false; // Comm transitions are INDEP with non-comm transitions } + +bool CommWaitTransition::reversible_race(const Transition* other) const +{ + switch (type_) { + case Type::COMM_WAIT: + // If the other event is a communication event, then we are not reversible; otherwise we are reversible. + return other->type_ != Transition::Type::COMM_ASYNC_SEND && other->type_ != Transition::Type::COMM_ASYNC_RECV; + default: + xbt_die("Unexpected transition type %s", to_c_str(type_)); + } +} + CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, unsigned comm_, aid_t sender_, aid_t receiver_, unsigned mbox_) : Transition(Type::COMM_TEST, issuer, times_considered) @@ -69,12 +81,14 @@ CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, std:: : Transition(Type::COMM_TEST, issuer, times_considered) { xbt_assert(stream >> comm_ >> sender_ >> receiver_ >> mbox_ >> call_location_); - XBT_DEBUG("CommTestTransition comm:%u, sender:%ld receiver:%ld mbox:%u", comm_, sender_, receiver_, mbox_); + XBT_DEBUG("CommTestTransition comm:%u, sender:%ld receiver:%ld mbox:%u call_loc:%s", comm_, sender_, receiver_, mbox_, + call_location_.c_str()); } std::string CommTestTransition::to_string(bool verbose) const { return xbt::string_printf("TestComm(from %ld to %ld, mbox=%u)", sender_, receiver_, mbox_); } + bool CommTestTransition::depends(const Transition* other) const { if (other->type_ < type_) @@ -98,6 +112,16 @@ bool CommTestTransition::depends(const Transition* other) const return false; // Comm transitions are INDEP with non-comm transitions } +bool CommTestTransition::reversible_race(const Transition* other) const +{ + switch (type_) { + case Type::COMM_TEST: + return true; // CommTest is always enabled + default: + xbt_die("Unexpected transition type %s", to_c_str(type_)); + } +} + CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_, int tag_) : Transition(Type::COMM_ASYNC_RECV, issuer, times_considered), comm_(comm_), mbox_(mbox_), tag_(tag_) { @@ -106,6 +130,7 @@ CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, std:: : Transition(Type::COMM_ASYNC_RECV, issuer, times_considered) { xbt_assert(stream >> comm_ >> mbox_ >> tag_ >> call_location_); + XBT_DEBUG("CommRecvTransition comm:%u, mbox:%u tag:%d call_loc:%s", comm_, mbox_, tag_, call_location_.c_str()); } std::string CommRecvTransition::to_string(bool verbose) const { @@ -162,6 +187,16 @@ bool CommRecvTransition::depends(const Transition* other) const return false; // Comm transitions are INDEP with non-comm transitions } +bool CommRecvTransition::reversible_race(const Transition* other) const +{ + switch (type_) { + case Type::COMM_ASYNC_RECV: + return true; // CommRecv is always enabled + default: + xbt_die("Unexpected transition type %s", to_c_str(type_)); + } +} + CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, unsigned comm_, unsigned mbox_, int tag_) : Transition(Type::COMM_ASYNC_SEND, issuer, times_considered), comm_(comm_), mbox_(mbox_), tag_(tag_) { @@ -170,7 +205,7 @@ CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, std:: : Transition(Type::COMM_ASYNC_SEND, issuer, times_considered) { xbt_assert(stream >> comm_ >> mbox_ >> tag_ >> call_location_); - XBT_DEBUG("SendTransition comm:%u mbox:%u", comm_, mbox_); + XBT_DEBUG("SendTransition comm:%u mbox:%u tag:%d call_loc:%s", comm_, mbox_, tag_, call_location_.c_str()); } std::string CommSendTransition::to_string(bool verbose = false) const { @@ -228,4 +263,14 @@ bool CommSendTransition::depends(const Transition* other) const return false; // Comm transitions are INDEP with non-comm transitions } +bool CommSendTransition::reversible_race(const Transition* other) const +{ + switch (type_) { + case Type::COMM_ASYNC_SEND: + return true; // CommSend is always enabled + default: + xbt_die("Unexpected transition type %s", to_c_str(type_)); + } +} + } // namespace simgrid::mc