include src/mc/sosp/Snapshot_test.cpp
include src/mc/transition/Transition.cpp
include src/mc/transition/Transition.hpp
-include src/mc/transition/TransitionActorJoin.cpp
-include src/mc/transition/TransitionActorJoin.hpp
+include src/mc/transition/TransitionActor.cpp
+include src/mc/transition/TransitionActor.hpp
include src/mc/transition/TransitionAny.cpp
include src/mc/transition/TransitionAny.hpp
include src/mc/transition/TransitionComm.cpp
{
return "ActorJoin(pid:" + std::to_string(other_->get_pid()) + ")";
}
+void ActorSleepSimcall::serialize(std::stringstream& stream) const
+{
+ stream << (short)mc::Transition::Type::ACTOR_SLEEP;
+}
+
+std::string ActorSleepSimcall::to_string() const
+{
+ return "ActorSleep()";
+}
void ObjectAccessSimcallObserver::serialize(std::stringstream& stream) const
{
double get_timeout() const { return timeout_; }
};
+class ActorSleepSimcall final : public SimcallObserver {
+
+public:
+ ActorSleepSimcall(ActorImpl* actor) : SimcallObserver(actor) {}
+ void serialize(std::stringstream& stream) const override;
+ std::string to_string() const override;
+};
+
class ObjectAccessSimcallObserver final : public SimcallObserver {
ObjectAccessSimcallItem* const object_;
#include "src/mc/explo/odpor/Execution.hpp"
#include "src/mc/explo/odpor/odpor_forward.hpp"
#include "src/mc/transition/Transition.hpp"
-#include "src/mc/transition/TransitionActorJoin.hpp"
+#include "src/mc/transition/TransitionActor.hpp"
#include "src/mc/transition/TransitionAny.hpp"
#include "src/mc/transition/TransitionComm.hpp"
#include "src/mc/transition/TransitionObjectAccess.hpp"
std::vector<s_mc_message_actors_status_one_t> status;
for (auto const& [aid, actor] : actor_list) {
+ xbt_assert(actor);
+ xbt_assert(actor->simcall_.observer_, "simcall %s in actor %s has no observer.", actor->simcall_.get_cname(),
+ actor->get_cname());
s_mc_message_actors_status_one_t one = {};
one.type = MessageType::ACTORS_STATUS_REPLY_TRANSITION;
one.aid = aid;
#if SIMGRID_HAVE_MC
#include "src/mc/explo/Exploration.hpp"
-#include "src/mc/transition/TransitionActorJoin.hpp"
+#include "src/mc/transition/TransitionActor.hpp"
#include "src/mc/transition/TransitionAny.hpp"
#include "src/mc/transition/TransitionComm.hpp"
#include "src/mc/transition/TransitionObjectAccess.hpp"
case Transition::Type::ACTOR_JOIN:
return new ActorJoinTransition(issuer, times_considered, stream);
+ case Transition::Type::ACTOR_SLEEP:
+ return new ActorSleepTransition(issuer, times_considered, stream);
case Transition::Type::OBJECT_ACCESS:
return new ObjectAccessTransition(issuer, times_considered, stream);
public:
/* Ordering is important here. depends() implementations only consider subsequent types in this ordering */
- XBT_DECLARE_ENUM_CLASS(Type, RANDOM, ACTOR_JOIN, /* First because indep with anybody including themselves */
- OBJECT_ACCESS, /* high priority because indep with almost everybody */
- TESTANY, WAITANY, /* high priority because they can rewrite themselves to *_WAIT */
- BARRIER_ASYNC_LOCK, BARRIER_WAIT, /* BARRIER transitions sorted alphabetically */
- COMM_ASYNC_RECV, COMM_ASYNC_SEND, COMM_TEST, COMM_WAIT, /* Alphabetical ordering of COMM_* */
- MUTEX_ASYNC_LOCK, MUTEX_TEST, MUTEX_TRYLOCK, MUTEX_UNLOCK, MUTEX_WAIT, /* alphabetical */
- SEM_ASYNC_LOCK, SEM_UNLOCK, SEM_WAIT, /* alphabetical ordering of SEM transitions */
- /* UNKNOWN must be last */ UNKNOWN);
+ XBT_DECLARE_ENUM_CLASS(Type,
+ /* First because indep with anybody including themselves */
+ RANDOM, ACTOR_JOIN, ACTOR_SLEEP,
+ /* high priority because indep with almost everybody */
+ OBJECT_ACCESS,
+ /* high priority because they can rewrite themselves to *_WAIT */
+ TESTANY, WAITANY,
+ /* BARRIER transitions sorted alphabetically */
+ BARRIER_ASYNC_LOCK, BARRIER_WAIT,
+ /* Alphabetical ordering of COMM_* */
+ COMM_ASYNC_RECV, COMM_ASYNC_SEND, COMM_TEST, COMM_WAIT,
+ /* alphabetical */
+ MUTEX_ASYNC_LOCK, MUTEX_TEST, MUTEX_TRYLOCK, MUTEX_UNLOCK, MUTEX_WAIT,
+ /* alphabetical ordering of SEM transitions */
+ SEM_ASYNC_LOCK, SEM_UNLOCK, SEM_WAIT,
+ /* UNKNOWN must be last */
+ UNKNOWN);
Type type_ = Type::UNKNOWN;
aid_t aid_ = 0;
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include "src/mc/transition/TransitionActorJoin.hpp"
+#include "src/mc/transition/TransitionActor.hpp"
#include "simgrid/config.h"
#include "xbt/asserts.h"
#include "xbt/string.hpp"
return false;
}
+ActorSleepTransition::ActorSleepTransition(aid_t issuer, int times_considered, std::stringstream& stream)
+ : Transition(Type::ACTOR_SLEEP, issuer, times_considered)
+{
+ XBT_DEBUG("ActorSleepTransition()");
+}
+std::string ActorSleepTransition::to_string(bool verbose) const
+{
+ return xbt::string_printf("ActorSleep()");
+}
+bool ActorSleepTransition::depends(const Transition* other) const
+{
+ // Sleeping is indep with any other transitions: always enabled, not impacted by any transition
+ return false;
+}
+
} // namespace simgrid::mc
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#ifndef SIMGRID_MC_TRANSITION_ACTOR_JOIN_HPP
-#define SIMGRID_MC_TRANSITION_ACTOR_JOIN_HPP
+#ifndef SIMGRID_MC_TRANSITION_ACTOR_HPP
+#define SIMGRID_MC_TRANSITION_ACTOR_HPP
#include "src/kernel/actor/SimcallObserver.hpp"
#include "src/mc/transition/Transition.hpp"
aid_t get_target() const { return target_; }
};
+class ActorSleepTransition : public Transition {
+ bool timeout_;
+ aid_t target_;
+
+public:
+ ActorSleepTransition(aid_t issuer, int times_considered, std::stringstream& stream);
+ std::string to_string(bool verbose) const override;
+ bool depends(const Transition* other) const override;
+};
+
} // namespace simgrid::mc
#endif
}
kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
+ kernel::actor::ActorSleepSimcall observer(issuer);
+
Actor::on_sleep(*issuer->get_ciface());
issuer->get_ciface()->on_this_sleep(*issuer->get_ciface());
- kernel::actor::simcall_blocking([issuer, duration]() {
- if (MC_is_active() || MC_record_replay_is_active()) {
- MC_process_clock_add(issuer, duration);
- issuer->simcall_answer();
- return;
- }
- kernel::activity::ActivityImplPtr sync = issuer->sleep(duration);
- sync->register_simcall(&issuer->simcall_);
- });
+ kernel::actor::simcall_blocking(
+ [issuer, duration]() {
+ if (MC_is_active() || MC_record_replay_is_active()) {
+ MC_process_clock_add(issuer, duration);
+ issuer->simcall_answer();
+ return;
+ }
+ kernel::activity::ActivityImplPtr sync = issuer->sleep(duration);
+ sync->register_simcall(&issuer->simcall_);
+ },
+ &observer);
Actor::on_wake_up(*issuer->get_ciface());
issuer->get_ciface()->on_this_wake_up(*issuer->get_ciface());
src/mc/remote/mc_protocol.h
src/mc/transition/Transition.hpp
- src/mc/transition/TransitionActorJoin.cpp
- src/mc/transition/TransitionActorJoin.hpp
+ src/mc/transition/TransitionActor.cpp
+ src/mc/transition/TransitionActor.hpp
src/mc/transition/TransitionAny.cpp
src/mc/transition/TransitionAny.hpp
src/mc/transition/TransitionComm.cpp