1
0
mirror of https://github.com/Zygo/bees.git synced 2025-06-15 17:26:15 +02:00

task: export load tracking statistics

Provide an interface so that programs can monitor the Task load
average calculations.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell
2022-12-05 00:10:10 -05:00
parent 46a38fe016
commit a85ada3a49
2 changed files with 28 additions and 1 deletions

View File

@ -93,6 +93,17 @@ namespace crucible {
/// Gets the current number of active workers
static size_t get_thread_count();
/// Gets the current load tracking statistics
struct LoadStats {
/// Current load extracted from last two 5-second load average samples
double current_load;
/// Target thread count computed from previous thread count and current load
double thread_target;
/// Load average for last 60 seconds
double loadavg;
};
static LoadStats get_current_load();
/// Drop the current queue and discard new Tasks without
/// running them. Currently executing tasks are not
/// affected (use set_thread_count(0) to wait for those