Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::backpressure_stats_snapshot Struct Reference

Snapshot of backpressure statistics (copyable). More...

#include <backpressure_config.h>

Collaboration diagram for kcenon::thread::backpressure_stats_snapshot:
Collaboration graph

Public Member Functions

auto acceptance_rate () const -> double
 Returns acceptance rate (accepted / total attempts).
 
auto avg_block_time_ms () const -> double
 Returns average block time per blocked operation.
 

Public Attributes

std::uint64_t jobs_accepted {0}
 
std::uint64_t jobs_rejected {0}
 
std::uint64_t jobs_dropped {0}
 
std::uint64_t rate_limit_waits {0}
 
std::uint64_t pressure_events {0}
 
std::uint64_t total_block_time_ns {0}
 

Detailed Description

Snapshot of backpressure statistics (copyable).

This is a copyable snapshot of statistics, suitable for returning from getter methods.

Definition at line 348 of file backpressure_config.h.

Member Function Documentation

◆ acceptance_rate()

auto kcenon::thread::backpressure_stats_snapshot::acceptance_rate ( ) const -> double
inlinenodiscard

Returns acceptance rate (accepted / total attempts).

Returns
Acceptance ratio (0.0 to 1.0), or 1.0 if no attempts.

Definition at line 361 of file backpressure_config.h.

362 {
363 auto total = jobs_accepted + jobs_rejected;
364 if (total == 0)
365 {
366 return 1.0;
367 }
368 return static_cast<double>(jobs_accepted) / static_cast<double>(total);
369 }

References jobs_accepted, and jobs_rejected.

◆ avg_block_time_ms()

auto kcenon::thread::backpressure_stats_snapshot::avg_block_time_ms ( ) const -> double
inlinenodiscard

Returns average block time per blocked operation.

Returns
Average block time in milliseconds.

Definition at line 375 of file backpressure_config.h.

376 {
377 if (rate_limit_waits == 0)
378 {
379 return 0.0;
380 }
381 return static_cast<double>(total_block_time_ns) /
382 static_cast<double>(rate_limit_waits) / 1e6;
383 }

References rate_limit_waits, and total_block_time_ns.

Member Data Documentation

◆ jobs_accepted

std::uint64_t kcenon::thread::backpressure_stats_snapshot::jobs_accepted {0}

Definition at line 350 of file backpressure_config.h.

350{0};

Referenced by acceptance_rate(), and kcenon::thread::backpressure_stats::snapshot().

◆ jobs_dropped

std::uint64_t kcenon::thread::backpressure_stats_snapshot::jobs_dropped {0}

Definition at line 352 of file backpressure_config.h.

352{0};

Referenced by kcenon::thread::backpressure_stats::snapshot().

◆ jobs_rejected

std::uint64_t kcenon::thread::backpressure_stats_snapshot::jobs_rejected {0}

Definition at line 351 of file backpressure_config.h.

351{0};

Referenced by acceptance_rate(), and kcenon::thread::backpressure_stats::snapshot().

◆ pressure_events

std::uint64_t kcenon::thread::backpressure_stats_snapshot::pressure_events {0}

Definition at line 354 of file backpressure_config.h.

354{0};

Referenced by kcenon::thread::backpressure_stats::snapshot().

◆ rate_limit_waits

std::uint64_t kcenon::thread::backpressure_stats_snapshot::rate_limit_waits {0}

Definition at line 353 of file backpressure_config.h.

353{0};

Referenced by avg_block_time_ms(), and kcenon::thread::backpressure_stats::snapshot().

◆ total_block_time_ns

std::uint64_t kcenon::thread::backpressure_stats_snapshot::total_block_time_ns {0}

Definition at line 355 of file backpressure_config.h.

355{0};

Referenced by avg_block_time_ms(), and kcenon::thread::backpressure_stats::snapshot().


The documentation for this struct was generated from the following file: