From 594ad1786d40a72983594effd4f9d2d23f764c72 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Mon, 5 Dec 2022 00:22:29 -0500 Subject: [PATCH] context: dump current load tracking stats Dump the instantaneous load (last 5 seconds, extracted from load average) and the computed target worker count (before rounding and truncation) on the same status line as the task and worker thread count. This should give better visibility into Task's thread count calculation algorithm. Signed-off-by: Zygo Blaxell --- src/bees-context.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bees-context.cc b/src/bees-context.cc index 66e2d99..da1e27c 100644 --- a/src/bees-context.cc +++ b/src/bees-context.cc @@ -84,7 +84,8 @@ BeesContext::dump_status() ofs << "RATES:\n"; ofs << "\t" << avg_rates << "\n"; - ofs << "THREADS (work queue " << TaskMaster::get_queue_count() << " of " << Task::instance_count() << " tasks, " << TaskMaster::get_thread_count() << " workers):\n"; + const auto load_stats = TaskMaster::get_current_load(); + ofs << "THREADS (work queue " << TaskMaster::get_queue_count() << " of " << Task::instance_count() << " tasks, " << TaskMaster::get_thread_count() << " workers, load: current " << load_stats.current_load << " target " << load_stats.thread_target << " average " << load_stats.loadavg << "):\n"; for (auto t : BeesNote::get_status()) { ofs << "\ttid " << t.first << ": " << t.second << "\n"; } @@ -152,8 +153,8 @@ BeesContext::show_progress() BEESLOGINFO("\t" << deltaRates); BEESNOTE("logging current thread status"); - BEESLOGINFO("THREADS:"); - + const auto load_stats = TaskMaster::get_current_load(); + BEESLOGINFO("THREADS (work queue " << TaskMaster::get_queue_count() << " of " << Task::instance_count() << " tasks, " << TaskMaster::get_thread_count() << " workers, load: current " << load_stats.current_load << " target " << load_stats.thread_target << " average " << load_stats.loadavg << "):"); for (auto t : BeesNote::get_status()) { BEESLOGINFO("\ttid " << t.first << ": " << t.second); }