feat: --latency-window sliding-window tail latency for --realtime-latencies#386
Open
fcostaoliveira wants to merge 2 commits into
Open
feat: --latency-window sliding-window tail latency for --realtime-latencies#386fcostaoliveira wants to merge 2 commits into
fcostaoliveira wants to merge 2 commits into
Conversation
…encies Adds a load1/5/15-style sliding window to the live latency block. The per-tick output now emits three labeled rows per configured percentile: inst — last tick win<N>s — sliding window (default 60s, configurable, 0 disables) overall — full run The window is implemented as a ring of cloned hdr_histograms (one per second); each tick we materialize the windowed percentile by hdr_add-ing every live slot into a reused scratch histogram. Empty ticks consume a slot so the window measures wall-clock seconds rather than seconds-with-traffic. Long --print-percentiles lists wrap to multiple lines per row with deterministic line count, preserving the TTY cursor-up redraw. Adds three RLTests: three-row layout assertion, --latency-window=0 suppression, and ring-populated sanity. Existing --realtime-latencies tests updated for the new label-row layout. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
The macOS openssl-1.0.2 / 1.1 CI jobs don't pick up -std=c++11 and parse 'vector<vector<string>>' as the >> shift operator, breaking those builds. Use a typedef so the closing token sequence never appears. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Adds a load1/5/15-style sliding window to the live latency block under
--realtime-latencies. The per-tick output now emits three labeled rows per configured percentile:--latency-window=SECS, set to 0 to disable, max 3600)Example with
--latency-window=60 --print-percentiles=50,99,99.9:Implementation
hdr_histogramsnapshots, one per second (memtier_benchmark.cpp:2125-2143).inst_hist_agginto the next slot, freeing the displaced snapshot. O(W) per tick (microseconds for W ≤ 3600).hdr_reseta reused scratch histogram,hdr_addevery live slot, thenhdr_value_at_percentile.--print-percentileslists wrap to multiple lines per row with deterministic line count, so the TTY cursor-up redraw stays stable.Memory / CPU
hdr_histogram(~tens of KB at default precision). Default 60s window ≈ 1-2 MB; capped at 3600s.hdr_addper tick, once per second. Negligible.--realtime-latenciesis off or--latency-window=0.Test plan
make format-checkclean--enable-sanitizers)test_realtime_latencies.py: 5/5 PASS (incl. 2 new tests:test_latency_window_zero_drops_window_row,test_latency_window_ring_smooths_spikes)--realtime-latenciestests updated for new label-row layout and still pass--helpand man page show--latency-window--latency-windowunderoptions_no_comp🤖 Generated with Claude Code
Note
Medium Risk
Changes
--realtime-latenciesprogress output format and adds a per-second histogram ring buffer, which could affect log parsers and introduce memory/CPU overhead if misconfigured (bounded to 3600s).Overview
Adds a new
--latency-window=SECSoption that computes sliding-window tail latency for--realtime-latenciesby keeping a ring of per-second HDR histogram snapshots (default 60s,0disables, max 3600).Updates the live progress block to emit labeled latency rows per tick (always
inst+overall, pluswin<N>swhen enabled) and adjusts TTY redraw/wrapping logic accordingly.Wires the flag through CLI parsing/help/man page and bash completion, extends
benchmark_configwithlatency_window_secs, and updates/adds RLTest coverage to validate the new rows, wrapping behavior, and the--latency-window=0disable contract.Reviewed by Cursor Bugbot for commit 10285ab. Bugbot is set up for automated code reviews on this repo. Configure here.