-bool ActivityWaitSimcall::depends(SimcallObserver* other)
-{
- if (get_issuer() == other->get_issuer())
- return false;
-
- if (auto* isend = dynamic_cast<CommIsendSimcall*>(other))
- return isend->depends(this);
-
- if (auto* irecv = dynamic_cast<CommIrecvSimcall*>(other))
- return irecv->depends(this);
-
- /* Timeouts in wait transitions are not considered by the independence theorem, thus assumed dependent */
- if (const auto* wait = dynamic_cast<ActivityWaitSimcall*>(other)) {
- if (timeout_ > 0 || wait->get_timeout() > 0)
- return true;
- const auto* comm1 = dynamic_cast<activity::CommImpl*>(activity_);
- const auto* comm2 = dynamic_cast<activity::CommImpl*>(wait->get_activity());
-
- if (comm1 == nullptr || comm2 == nullptr) // One wait at least in not on a Comm
- return true;
-
- if (comm1->src_buff_ == comm2->src_buff_ && comm1->dst_buff_ == comm2->dst_buff_)
- return false;
- if (comm1->src_buff_ != nullptr && comm1->dst_buff_ != nullptr && comm2->src_buff_ != nullptr &&
- comm2->dst_buff_ != nullptr && comm1->dst_buff_ != comm2->src_buff_ && comm1->dst_buff_ != comm2->dst_buff_ &&
- comm2->dst_buff_ != comm1->src_buff_)
- return false;
- }
-
- return true;
-}
-
-std::string ActivityWaitSimcall::to_string(int times_considered) const
-{
- std::string res = SimcallObserver::to_string(times_considered);
- auto* comm = dynamic_cast<activity::CommImpl*>(activity_);
- if (comm == nullptr) {
- res += "ActivityWait on non-Comm (FIXME)"; // FIXME
- return res;
- }
-
- if (times_considered == -1) {
- res += "WaitTimeout(comm=" + (XBT_LOG_ISENABLED(mc_observer, xbt_log_priority_verbose)
- ? xbt::string_printf("%p)", comm)
- : "(verbose only))");
- } else {
- res += "Wait(comm=";
-
- auto src = comm->src_actor_;
- auto dst = comm->dst_actor_;
- res +=
- XBT_LOG_ISENABLED(mc_observer, xbt_log_priority_verbose) ? xbt::string_printf("%p", comm) : "(verbose only) ";
- res += xbt::string_printf("[(%ld)%s (%s) ", src->get_pid(), src->get_host()->get_cname(), src->get_cname()) +
- "-> " + xbt::string_printf("(%ld)%s (%s)])", dst->get_pid(), dst->get_host()->get_cname(), dst->get_cname());
- }
- return res;
-}
-