SimGrid (3.24.1) NOT RELEASED YET (v3.25 expected December 22. 2029, 04:19 UTC)
+S4U:
+- Actor: Merge signals on_migration_start/end into on_host_change
+
Kernel:
- In simgrid::kernel::resource::Model, the methods next_occuring_event*() have
been renamed to fix a spelling error. As usual, the previous definitions are
static xbt::signal<void(Actor const&)> on_sleep;
/** Signal to others that an actor wakes up for a sleep **/
static xbt::signal<void(Actor const&)> on_wake_up;
- /** Signal to others that an actor is going to migrated to another host**/
- static xbt::signal<void(Actor const&)> on_migration_start;
/** Signal to others that an actor is has been migrated to another host **/
- static xbt::signal<void(Actor const&)> on_migration_end;
+ static xbt::signal<void(Actor const&, Host const& previous_location)> on_host_change;
+#ifndef DOXYGEN
+ static xbt::signal<void(Actor const&)> on_migration_start; // XBT_ATTRIB_DEPRECATED_v329
+ static xbt::signal<void(Actor const&)> on_migration_end; // XBT_ATTRIB_DEPRECATED_v329
+#endif
+
/** Signal indicating that an actor terminated its code.
* The actor may continue to exist if it is still referenced in the simulation, but it's not active anymore.
* If you want to free extra data when the actor's destructor is called, use Actor::on_destruction.
});
}
-static long long int counter = 0;
-
-static void instr_actor_on_migration_start(simgrid::s4u::Actor const& actor)
+static void instr_actor_on_host_change(simgrid::s4u::Actor const& actor,
+ simgrid::s4u::Host const& /*previous_location*/)
{
+ static long long int counter = 0;
// start link
container_t container = simgrid::instr::Container::by_name(instr_pid(actor));
simgrid::instr::Container::get_root()->get_link("ACTOR_LINK")->start_event(container, "M", std::to_string(counter));
// destroy existing container of this process
container->remove_from_parent();
-}
-
-static void instr_actor_on_migration_end(simgrid::s4u::Actor const& actor)
-{
// create new container on the new_host location
simgrid::instr::Container::by_name(actor.get_host()->get_name())->create_child(instr_pid(actor), "ACTOR");
// end link
simgrid::s4u::Comm::on_completion.connect([](simgrid::s4u::Actor const& actor) {
simgrid::instr::Container::by_name(instr_pid(actor))->get_state("ACTOR_STATE")->pop_event();
});
- simgrid::s4u::Actor::on_migration_start.connect(instr_actor_on_migration_start);
- simgrid::s4u::Actor::on_migration_end.connect(instr_actor_on_migration_end);
+ simgrid::s4u::Actor::on_host_change.connect(instr_actor_on_host_change);
}
if (TRACE_vm_is_enabled()) {
xbt::signal<void(Actor const&)> s4u::Actor::on_resume;
xbt::signal<void(Actor const&)> s4u::Actor::on_sleep;
xbt::signal<void(Actor const&)> s4u::Actor::on_wake_up;
-xbt::signal<void(Actor const&)> s4u::Actor::on_migration_start;
-xbt::signal<void(Actor const&)> s4u::Actor::on_migration_end;
+xbt::signal<void(Actor const&)> s4u::Actor::on_migration_start; // deprecated
+xbt::signal<void(Actor const&)> s4u::Actor::on_migration_end; // deprecated
+xbt::signal<void(Actor const&, Host const& previous_location)> s4u::Actor::on_host_change;
xbt::signal<void(Actor const&)> s4u::Actor::on_termination;
xbt::signal<void(Actor const&)> s4u::Actor::on_destruction;
void Actor::migrate(Host* new_host)
{
- s4u::Actor::on_migration_start(*this);
+ if (s4u::Actor::on_migration_start.get_slot_count() > 0) { // XBT_ATTRIB_DEPRECATED_v329
+ static bool already_warned = false;
+ if (not already_warned) {
+ XBT_INFO("Please use s4u::Actor::on_host_change instead of s4u::Actor::on_migration_start. This will be removed "
+ "in v3.29");
+ already_warned = true;
+ }
+ s4u::Actor::on_migration_start(*this);
+ }
+
+ auto* previous_location = get_host();
kernel::actor::simcall([this, new_host]() {
if (pimpl_->waiting_synchro != nullptr) {
this->pimpl_->set_host(new_host);
});
- s4u::Actor::on_migration_end(*this);
+ if (s4u::Actor::on_migration_end.get_slot_count() > 0) { // XBT_ATTRIB_DEPRECATED_v329
+ static bool already_warned = false;
+ if (not already_warned) {
+ XBT_INFO("Please use s4u::Actor::on_host_change instead of s4u::Actor::on_migration_end. This will be removed in "
+ "v3.29");
+ already_warned = true;
+ }
+ s4u::Actor::on_migration_end(*this);
+ }
+
+ s4u::Actor::on_host_change(*this, *previous_location);
}
s4u::Host* Actor::get_host() const