From ba7f00d8169448e065b99f6acd43bf3747bf101a Mon Sep 17 00:00:00 2001 From: pgm1207 <104554896+pgm1207@users.noreply.github.com> Date: Fri, 20 Nov 2026 13:04:55 +0100 Subject: [PATCH] report: p95 and p99 per stage The latency log is read for the tail ("is the 30-39 fps CEF cadence in the frame interval tail, or in one stage?"), but the table stopped at p90 and printed max: on a 31-frame run p90 says nothing about the one frame that took 300 ms, and a 300-frame Steam session has no usable 1% low at all. Stages.rows() now carries p95_ms and p99_ms and the table prints both, so a before/after reading of the same log gives the p95/p99 pair directly instead of a median and an outlier. No other behaviour changes; the --json keys are additive. latency_test.sh step 7 on this branch: 31 frames, 16 ms apart, one held 300 ms -> stage n median ms p90 ms p95 ms p99 ms min max server -> GPU done 31 0.44 0.58 0.83 210.74 0.07 300.61 (p99 210.74 ms is the held frame; p90 0.58 ms hid it.) --- tools/latency_report.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/latency_report.py b/tools/latency_report.py index 4da88b9..8d56ac4 100644 --- a/tools/latency_report.py +++ b/tools/latency_report.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-3.0-or-later -"""Latency per stage, median and p90, from the latency logs (VKBRIDGE_LATLOG). +"""Latency per stage, median, p90, p95 and p99, from the latency logs (VKBRIDGE_LATLOG). tools/latency_report.py [--presses] [--json] [--comm NAME] LOG... @@ -63,6 +63,7 @@ def rows(self): for n in self.order: v = self.vals[n] out.append({'stage': n, 'n': len(v), 'median_ms': pct(v, 0.5) / 1e6, 'p90_ms': pct(v, 0.9) / 1e6, + 'p95_ms': pct(v, 0.95) / 1e6, 'p99_ms': pct(v, 0.99) / 1e6, 'min_ms': min(v) / 1e6, 'max_ms': max(v) / 1e6}) return out @@ -72,9 +73,10 @@ def table(title, rows, out): return out.write('\n%s\n' % title) w = max(40, max(len(r['stage']) for r in rows) + 2) - out.write(' %-*s %6s %10s %8s %8s %8s\n' % (w, 'stage', 'n', 'median ms', 'p90 ms', 'min', 'max')) + out.write(' %-*s %6s %10s %8s %8s %8s %8s %8s\n' % (w, 'stage', 'n', 'median ms', 'p90 ms', 'p95 ms', 'p99 ms', 'min', 'max')) for r in rows: - out.write(' %-*s %6d %10.2f %8.2f %8.2f %8.2f\n' % (w, r['stage'], r['n'], r['median_ms'], r['p90_ms'], r['min_ms'], r['max_ms'])) + out.write(' %-*s %6d %10.2f %8.2f %8.2f %8.2f %8.2f %8.2f\n' % (w, r['stage'], r['n'], r['median_ms'], r['p90_ms'], + r['p95_ms'], r['p99_ms'], r['min_ms'], r['max_ms'])) def ints(parts):