Class DetectionRateTracker#
Defined in File realtime_metrics.hpp
Nested Relationships#
Nested Types#
Class Documentation#
-
class DetectionRateTracker
Buckets a stream of detected/not-detected observations into fixed time windows for a live sparkline — the “avoid a wall of tiny per-frame
dots” aggregation the Real-time tab’s tile footer uses instead of raw per-frame data.
Buckets roll forward as push() is called with newer timestamps; once bucketCount buckets exist, the oldest is evicted. A bucket with zero observations is never fabricated — bucket_rates() only ever reports buckets that actually received at least one push().
Public Functions
-
explicit DetectionRateTracker(int bucketCount = 24, int64_t bucketDurationMs = 5000)
-
void push(bool detected, int64_t timestampMs)
Records one detection observation (true = a subject/keypoint set was present this frame) at the given monotonic timestamp.
-
std::optional<double> rate() const
Overall detection rate across every currently-held bucket, in [0,1]. Empty if push() has never been called.
-
QVector<double> bucket_rates() const
Per-bucket rates, oldest first, for sparkline rendering.
-
inline int bucket_count() const
-
explicit DetectionRateTracker(int bucketCount = 24, int64_t bucketDurationMs = 5000)