|
threadman 0.1.0
Header-only C++23 managed threads, dynamic pools, futures, and executors
|
Functions | |
| std::shared_ptr< prom::Scope > & | scope () |
The shared threadman scope; applies the tm_ prefix to every metric. | |
| prom::Counter & | pool_tasks_submitted () |
| Tasks submitted to a thread pool (all submit variants). | |
| prom::Counter & | pool_tasks_completed () |
| Tasks that ran to completion on a pool worker. | |
| prom::Counter & | pool_tasks_failed () |
| Tasks whose body threw an exception. | |
| prom::Counter & | pool_tasks_cancelled () |
Tasks cancelled before running (drained by shutdown_now). | |
| prom::Counter & | pool_queue_rejected () |
| Submissions rejected because a bounded queue was full. | |
| prom::Counter & | pool_submit_rejected () |
| Submissions rejected because the pool was shutting down or terminated. | |
| prom::Counter & | pool_scale_ups () |
| Non-core workers spawned by a scale-up decision. | |
| prom::Counter & | pool_scale_downs () |
| Non-core workers retired after idling out. | |
| prom::Gauge & | pool_queue_depth () |
| Tasks currently waiting in a pool's queue (set from the summary tick). | |
| prom::Gauge & | pool_workers () |
| Live workers in a pool (set from the summary tick). | |
| prom::Gauge & | pool_workers_active () |
| Workers currently executing a task (set from the summary tick). | |
| prom::Gauge & | pool_workers_idle () |
| Workers currently idle on the queue (set from the summary tick). | |
| prom::Histogram & | pool_task_execution_seconds () |
| Wall-clock seconds a task body spent executing. | |
| prom::Histogram & | pool_task_queue_wait_seconds () |
| Seconds a task waited in the queue before a worker picked it up. | |
| prom::Counter & | threads_created () |
| ManagedThread bodies that entered (started running). | |
| prom::Counter & | threads_completed () |
| ManagedThread bodies that returned normally. | |
| prom::Counter & | threads_failed () |
| ManagedThread bodies that exited by throwing. | |
| prom::Gauge & | threads_live () |
| ManagedThread bodies currently running (inc on enter, dec on exit). | |
| prom::Counter & | manager_threads_registered () |
| Thread control blocks registered with the manager. | |
| prom::Counter & | manager_summaries_published () |
| Periodic ManagerSummary payloads published to listeners. | |
| prom::Gauge & | manager_pools_live () |
| Pools currently registered with the manager (set from the summary tick). | |
| prom::Counter & | tasks_stuck_detected () |
| Distinct tasks newly detected as stuck (running past the threshold). | |
| prom::Gauge & | tasks_stuck_current () |
| Tasks currently flagged as stuck (set from the housekeeper tick). | |
| prom::Counter & | futures_created () |
| Promise/Future pairs created. | |
| prom::Counter & | futures_satisfied_value () |
| Futures satisfied with a value. | |
| prom::Counter & | futures_satisfied_exception () |
| Futures satisfied with an exception. | |
| prom::Counter & | future_continuations_registered () |
.then/.on_error continuations registered against a future. | |
| prom::Counter & | future_continuations_dispatched () |
| Continuations dispatched through an executor. | |
| void | warm_up () |
| Eagerly construct the scope and every metric handle (and, transitively, prom's process-wide adapter cell / NullAdapter). | |
|
inline |
Continuations dispatched through an executor.
|
inline |
.then/.on_error continuations registered against a future.
|
inline |
Promise/Future pairs created.
|
inline |
Futures satisfied with an exception.
|
inline |
Futures satisfied with a value.
|
inline |
Pools currently registered with the manager (set from the summary tick).
|
inline |
Periodic ManagerSummary payloads published to listeners.
|
inline |
Thread control blocks registered with the manager.
|
inline |
Tasks currently waiting in a pool's queue (set from the summary tick).
|
inline |
Submissions rejected because a bounded queue was full.
|
inline |
Non-core workers retired after idling out.
|
inline |
Non-core workers spawned by a scale-up decision.
|
inline |
Submissions rejected because the pool was shutting down or terminated.
|
inline |
Wall-clock seconds a task body spent executing.
|
inline |
Seconds a task waited in the queue before a worker picked it up.
|
inline |
Tasks cancelled before running (drained by shutdown_now).
|
inline |
Tasks that ran to completion on a pool worker.
|
inline |
Tasks whose body threw an exception.
|
inline |
Tasks submitted to a thread pool (all submit variants).
|
inline |
Live workers in a pool (set from the summary tick).
|
inline |
Workers currently executing a task (set from the summary tick).
|
inline |
Workers currently idle on the queue (set from the summary tick).
|
inline |
The shared threadman scope; applies the tm_ prefix to every metric.
|
inline |
Tasks currently flagged as stuck (set from the housekeeper tick).
|
inline |
Distinct tasks newly detected as stuck (running past the threshold).
|
inline |
ManagedThread bodies that returned normally.
|
inline |
ManagedThread bodies that entered (started running).
|
inline |
ManagedThread bodies that exited by throwing.
|
inline |
ManagedThread bodies currently running (inc on enter, dec on exit).
|
inline |
Eagerly construct the scope and every metric handle (and, transitively, prom's process-wide adapter cell / NullAdapter).
Idempotent and cheap after the first call.
Why this matters: the process-wide ThreadManager singleton runs a housekeeper thread that publishes metrics on every tick until process exit. Function-local statics are destroyed in reverse order of construction, so touching these accessors before the singleton is constructed guarantees they (and the prom infrastructure) outlive it — the singleton's destructor stops and joins the housekeeper while every metric it might touch is still alive. ThreadManager::instance() calls this before creating the singleton.