Repository navigation
fix(run_stats): normalize through int64_t microseconds in timeval_factorial_average (#463) - #465
Merged
Merged
Conversation
…torial_average (#463) run_stats::timeval_factorial_average averaged tv_sec and tv_usec independently with double->time_t/suseconds_t truncation. For aggregate durations < ~1ms across multiple clients, the diff could round to 0 us, causing run_stats::summarize() to emit Ops/sec = 0 (and Hits/sec, KB/sec, ...) even when Count > 0 and Avg Latency > 0. Normalize both timevals to int64_t microseconds, average via integer math, then split back. No precision loss for any aggregate duration > 0 us. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
fcostaoliveira
added a commit
that referenced
this pull request
Jul 1, 2026
…torial_average (#463) (#465) (#503) run_stats::timeval_factorial_average averaged tv_sec and tv_usec independently with double->time_t/suseconds_t truncation. For aggregate durations < ~1ms across multiple clients, the diff could round to 0 us, causing run_stats::summarize() to emit Ops/sec = 0 (and Hits/sec, KB/sec, ...) even when Count > 0 and Avg Latency > 0. Normalize both timevals to int64_t microseconds, average via integer math, then split back. No precision loss for any aggregate duration > 0 us. (cherry picked from commit b4b18c0) Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #463.
run_stats::timeval_factorial_averageaveragedtv_secandtv_usecindependently with double→time_t/suseconds_ttruncation. For aggregate durations < ~1ms across multiple clients, the diff could round to 0 µs, causingrun_stats::summarize()to emitOps/sec = 0(andHits/sec,KB/sec, …) even whenCount > 0andAvg Latency > 0.This regression surfaced in two CI tests:
test_monitor_cluster_backpressure:test_monitor_cluster_completes_and_routes(worked around in commit 1033e0d by bumping requests)test_miss_rate_tracking:test_json_totals_hits_sec_consistent(coverage-ubuntu fail on master 36f878e)Fix: normalize both timevals to int64_t microseconds, average via integer math, then split back. No precision loss for any aggregate duration > 0 µs.
The round-40 test workaround (requests=4000) can be reverted in a follow-up once this lands.
🤖 Generated with Claude Code
Note
Low Risk
Single helper used when merging run timings; localized stats math fix with no auth or I/O behavior changes.
Overview
Fixes #463 by changing how merged benchmark runs compute averaged start/end times when multiple clients’
run_statsare combined.timeval_factorial_averageno longer averagestv_secandtv_usecseparately with doubles and truncation. It now converts eachtimevalto total microseconds (int64_t), applies the weighted average in integer math, then splits back intotv_sec/tv_usec. That avoids sub‑millisecond merged durations rounding to 0 µs, which maderun_stats::summarize()report Ops/sec, Hits/sec, and KB/sec as 0 despite Count > 0 and positive average latency (notably in multi-client / CI scenarios).Reviewed by Cursor Bugbot for commit afb1485. Bugbot is set up for automated code reviews on this repo. Configure here.