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 Struct Reference

Thread-safe statistics for backpressure operations. More...

#include <backpressure_config.h>

Collaboration diagram for kcenon::thread::backpressure_stats:
Collaboration graph

Public Member Functions

auto reset () -> void
 Resets all statistics to zero.
 
auto snapshot () const -> backpressure_stats_snapshot
 Creates a copyable snapshot of current statistics.
 

Public Attributes

std::atomic< std::uint64_t > jobs_accepted {0}
 Total jobs accepted into the queue.
 
std::atomic< std::uint64_t > jobs_rejected {0}
 Total jobs rejected due to backpressure.
 
std::atomic< std::uint64_t > jobs_dropped {0}
 Total jobs dropped (oldest dropped for new).
 
std::atomic< std::uint64_t > rate_limit_waits {0}
 Number of times rate limiting caused a wait.
 
std::atomic< std::uint64_t > pressure_events {0}
 Number of times high watermark was crossed.
 
std::atomic< std::uint64_t > total_block_time_ns {0}
 Total time spent blocking in nanoseconds.
 

Detailed Description

Thread-safe statistics for backpressure operations.

Tracks various counters and timing information about backpressure events for monitoring and debugging. Uses atomics for thread-safety.

Definition at line 395 of file backpressure_config.h.

Member Function Documentation

◆ reset()

auto kcenon::thread::backpressure_stats::reset ( ) -> void
inline

Resets all statistics to zero.

Definition at line 430 of file backpressure_config.h.

431 {
432 jobs_accepted.store(0, std::memory_order_relaxed);
433 jobs_rejected.store(0, std::memory_order_relaxed);
434 jobs_dropped.store(0, std::memory_order_relaxed);
435 rate_limit_waits.store(0, std::memory_order_relaxed);
436 pressure_events.store(0, std::memory_order_relaxed);
437 total_block_time_ns.store(0, std::memory_order_relaxed);
438 }
std::atomic< std::uint64_t > jobs_accepted
Total jobs accepted into the queue.
std::atomic< std::uint64_t > jobs_dropped
Total jobs dropped (oldest dropped for new).
std::atomic< std::uint64_t > rate_limit_waits
Number of times rate limiting caused a wait.
std::atomic< std::uint64_t > pressure_events
Number of times high watermark was crossed.
std::atomic< std::uint64_t > jobs_rejected
Total jobs rejected due to backpressure.
std::atomic< std::uint64_t > total_block_time_ns
Total time spent blocking in nanoseconds.

References jobs_accepted, jobs_dropped, jobs_rejected, pressure_events, rate_limit_waits, and total_block_time_ns.

◆ snapshot()

auto kcenon::thread::backpressure_stats::snapshot ( ) const -> backpressure_stats_snapshot
inlinenodiscard

Creates a copyable snapshot of current statistics.

Returns
Snapshot with current values.

Definition at line 444 of file backpressure_config.h.

445 {
446 backpressure_stats_snapshot snap;
447 snap.jobs_accepted = jobs_accepted.load(std::memory_order_relaxed);
448 snap.jobs_rejected = jobs_rejected.load(std::memory_order_relaxed);
449 snap.jobs_dropped = jobs_dropped.load(std::memory_order_relaxed);
450 snap.rate_limit_waits = rate_limit_waits.load(std::memory_order_relaxed);
451 snap.pressure_events = pressure_events.load(std::memory_order_relaxed);
452 snap.total_block_time_ns = total_block_time_ns.load(std::memory_order_relaxed);
453 return snap;
454 }

References jobs_accepted, kcenon::thread::backpressure_stats_snapshot::jobs_accepted, jobs_dropped, kcenon::thread::backpressure_stats_snapshot::jobs_dropped, jobs_rejected, kcenon::thread::backpressure_stats_snapshot::jobs_rejected, pressure_events, kcenon::thread::backpressure_stats_snapshot::pressure_events, rate_limit_waits, kcenon::thread::backpressure_stats_snapshot::rate_limit_waits, total_block_time_ns, and kcenon::thread::backpressure_stats_snapshot::total_block_time_ns.

Referenced by kcenon::thread::backpressure_job_queue::get_backpressure_stats().

Here is the caller graph for this function:

Member Data Documentation

◆ jobs_accepted

std::atomic<std::uint64_t> kcenon::thread::backpressure_stats::jobs_accepted {0}

Total jobs accepted into the queue.

Definition at line 400 of file backpressure_config.h.

400{0};

Referenced by reset(), and snapshot().

◆ jobs_dropped

std::atomic<std::uint64_t> kcenon::thread::backpressure_stats::jobs_dropped {0}

Total jobs dropped (oldest dropped for new).

Definition at line 410 of file backpressure_config.h.

410{0};

Referenced by reset(), and snapshot().

◆ jobs_rejected

std::atomic<std::uint64_t> kcenon::thread::backpressure_stats::jobs_rejected {0}

Total jobs rejected due to backpressure.

Definition at line 405 of file backpressure_config.h.

405{0};

Referenced by reset(), and snapshot().

◆ pressure_events

std::atomic<std::uint64_t> kcenon::thread::backpressure_stats::pressure_events {0}

Number of times high watermark was crossed.

Definition at line 420 of file backpressure_config.h.

420{0};

Referenced by reset(), and snapshot().

◆ rate_limit_waits

std::atomic<std::uint64_t> kcenon::thread::backpressure_stats::rate_limit_waits {0}

Number of times rate limiting caused a wait.

Definition at line 415 of file backpressure_config.h.

415{0};

Referenced by reset(), and snapshot().

◆ total_block_time_ns

std::atomic<std::uint64_t> kcenon::thread::backpressure_stats::total_block_time_ns {0}

Total time spent blocking in nanoseconds.

Definition at line 425 of file backpressure_config.h.

425{0};

Referenced by reset(), and snapshot().


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