From c287f02e9a284720e413650a1a5031c4240a6a5f Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 1 Feb 2024 16:00:38 +0300 Subject: [PATCH] Fix logging of migrating actors. --- tdactor/td/actor/impl/Scheduler.cpp | 8 +++++--- tdactor/td/actor/impl/Scheduler.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tdactor/td/actor/impl/Scheduler.cpp b/tdactor/td/actor/impl/Scheduler.cpp index 8cd6aba9a..46c436c22 100644 --- a/tdactor/td/actor/impl/Scheduler.cpp +++ b/tdactor/td/actor/impl/Scheduler.cpp @@ -300,8 +300,7 @@ void Scheduler::do_event(ActorInfo *actor_info, Event &&event) { } void Scheduler::register_migrated_actor(ActorInfo *actor_info) { - VLOG(actor) << "Register migrated actor: " << tag("name", *actor_info) << tag("ptr", actor_info) - << tag("actor_count", actor_count_); + VLOG(actor) << "Register migrated actor " << *actor_info << ", " << tag("actor_count", actor_count_); actor_count_++; LOG_CHECK(actor_info->is_migrating()) << *actor_info << ' ' << actor_count_ << ' ' << sched_id_ << ' ' << actor_info->migrate_dest() << ' ' << actor_info->is_running() << ' ' @@ -389,6 +388,7 @@ void Scheduler::add_to_mailbox(ActorInfo *actor_info, Event &&event) { void Scheduler::do_stop_actor(Actor *actor) { return do_stop_actor(actor->get_info()); } + void Scheduler::do_stop_actor(ActorInfo *actor_info) { CHECK(!actor_info->is_migrating()); LOG_CHECK(actor_info->migrate_dest() == sched_id_) << actor_info->migrate_dest() << " " << sched_id_; @@ -410,6 +410,7 @@ void Scheduler::do_stop_actor(ActorInfo *actor_info) { void Scheduler::migrate_actor(Actor *actor, int32 dest_sched_id) { migrate_actor(actor->get_info(), dest_sched_id); } + void Scheduler::migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) { CHECK(event_context_ptr_->actor_info == actor_info); if (sched_id_ == dest_sched_id) { @@ -422,6 +423,7 @@ void Scheduler::migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) { void Scheduler::do_migrate_actor(Actor *actor, int32 dest_sched_id) { do_migrate_actor(actor->get_info(), dest_sched_id); } + void Scheduler::do_migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) { #if TD_THREAD_UNSUPPORTED || TD_EVENTFD_UNSUPPORTED dest_sched_id = 0; @@ -438,7 +440,7 @@ void Scheduler::start_migrate_actor(Actor *actor, int32 dest_sched_id) { } void Scheduler::start_migrate_actor(ActorInfo *actor_info, int32 dest_sched_id) { - VLOG(actor) << "Start migrate actor: " << tag("name", actor_info) << tag("ptr", actor_info) + VLOG(actor) << "Start migrate actor " << *actor_info << " to scheduler " << dest_sched_id << ", " << tag("actor_count", actor_count_); actor_count_--; CHECK(actor_count_ >= 0); diff --git a/tdactor/td/actor/impl/Scheduler.h b/tdactor/td/actor/impl/Scheduler.h index ba4e0be86..b027aaf2f 100644 --- a/tdactor/td/actor/impl/Scheduler.h +++ b/tdactor/td/actor/impl/Scheduler.h @@ -54,6 +54,7 @@ class EventGuard { inline SchedulerGuard Scheduler::get_guard() { return SchedulerGuard(this); } + inline SchedulerGuard Scheduler::get_const_guard() { return SchedulerGuard(this, false); } @@ -61,6 +62,7 @@ inline SchedulerGuard Scheduler::get_const_guard() { inline int32 Scheduler::sched_id() const { return sched_id_; } + inline int32 Scheduler::sched_count() const { return sched_n_; }