Skip to content

About

Frame-time analysis for PC gamers and reviewers: PresentMon, FrameView, CapFrameX, MangoHud and OCAT captures, in your browser.

Topics

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

stutterscope

Frame-time analysis for PC gamers and hardware reviewers. Drop in a capture, see the stutter.

npm License: MIT Live demo

Stutterscope compares selected intervals from two recorded browser captures, retaining original frame numbers and measured slow-frame counts

The app's Open recorded comparison loads two controlled browser captures with four measured scene hitches in A and none in B. This is a local animation experiment, not a game benchmark. Walkthrough and selection rules.

Why this exists

Average FPS is the number every benchmark chart leads with, and it's the number that hides stutter. A GPU can average 90 fps while dropping to a choppy 30 for two seconds every time the game streams in a new area — the average barely moves, but the frame feels wrong the whole time. That information lives in the frame-time trace, not the mean.

Frame-time capture tools (PresentMon, FrameView, CapFrameX, MangoHud, OCAT) already record frame timings when configured for per-frame capture. The gap is in the analysis: it's mostly Windows desktop apps, "1% low" means two different things depending which tool computed it and nobody tells you which, and there's no fast way to drop two runs side by side and see what actually changed. stutterscope is a single-page, in-browser analyzer that reads capture-tool CSV formats, native CapFrameX JSON sessions and generic CSV, computes stutter/1%-low/pacing metrics with documented formulas, and never uploads the file anywhere. Parsing and metrics run in a Web Worker; charts render locally in your browser.

Quickstart

git clone https://github.com/antonsoo/stutterscope.git
cd stutterscope
npm install && npm run dev

Open the printed local URL, click one of the "load a synthetic sample" links, and you're looking at a real (synthetic, clearly labelled) capture. The live demo provides browser interval analysis. Both process captures locally; no capture is uploaded.

Prefer the terminal? npx runs the published CLI (@anthonymercer/stutterscope on npm; the command it installs is stutterscope), with no separate install:

npx @anthonymercer/stutterscope summary your-capture.csv

Features

  • PresentMon 2.6.0 default CSV: recover CPU/GPU busy readings and present-to-display latency that previously disappeared under OCAT detection. Native millisecond clocks expose filtered-frame gaps without confusing present intervals with CPU-start intervals. An official executable replay and an independent record-order oracle check 16 inputs. Before/after evidence and format boundaries. Open the native 2.6 replay from a direct link or the landing page. The original 175-frame gold example remains separate from this 174-frame executable replay. Publication checks are retained.

  • Native CapFrameX JSON: open saved recordings directly, select one run without concatenating captures, and follow slow frames to their original array indices. Five unchanged public game captures now import with independent metric checks; JSON/Markdown exports retain the selected recording. Reproduction, source schema and limits.

  • Interval analysis and slow-frame inspection: independently select the part of A and B to measure, keep original frame/CSV-line references, and inspect the neighboring evidence around each slow-frame episode. Detection retains full-stream context across interval boundaries. Browser comparison exports include both runs and their applied intervals; the source CLI adds compare, --start / --end, and per-run bounds. See the captured experiment and walkthrough.

  • Parsers for PresentMon's current default and legacy v1/v2 layouts, NVIDIA FrameView, CapFrameX, MangoHud, and OCAT CSVs, auto-detected from the file's header. Any other CSV (an engine's frame log, a FRAPS-style frametimes.csv, a spreadsheet) is read by the column its header points to (frame_time_ms, FrameTime, Time (ms), fps), with the guess shown and changeable. Every format is verified against upstream source/docs or a real captured sample; see docs/formats.md. A capture that recorded several processes (the game plus dwm.exe, an overlay, a browser) is split into per-process streams, and one is analysed, with a picker for the others. A capture that was re-saved on the way still reads: UTF-16 with a byte-order mark (what > writes in Windows PowerShell) and LF, CRLF or CR-only line endings. A file with no frames in it (empty, a header with no rows, a workbook, every frame time missing) is refused with the reason, not answered with a report of dashes.

  • Metrics, each with a documented formula in docs/metrics.md: average FPS computed correctly (frames ÷ total time, not a mean of per-frame FPS), frame-time percentiles (P50/P90/P95/P99/P99.9), 1% and 0.1% lows under two common definitions (three since 0.3.0), configurable stutter-event and hitch detection, frame-pacing variability (MASD), dropped frames, CPU-/GPU-bound share and display latency where the format supports it.

  • Visuals: a frame-time trace with stutter markers (drag to zoom, shift-drag to pan, wheel to zoom, double-click to reset), FPS over time, a frame-time histogram, and a percentile curve — plus a second-run overlay with a metric-by-metric delta table. The trace defaults to a robust y-range (max(50ms, 1.5 × P99.9)) so ordinary pacing and moderate stutter stay visible instead of being flattened by a rare severe hitch; hitches beyond that range are still drawn, clamped to the top with their real value labeled, and a "Full range" toggle shows the true scale on demand. Dark only, deliberately: the whole visual idea is an oscilloscope screen reading a live trace, and a light variant would work against that rather than with it.

  • Sharing: export a PNG report card, a Markdown table (paste into a forum post or PR description), or a JSON evidence report. In this source checkout, JSON and Markdown exports include both loaded runs; PNG remains a card for run A. Web reports retain the applied detection settings and skipped-row counts. JSON and Markdown include warning details, the selected process, and generic-column interpretation; JSON schema version 5 also records observed and unknown telemetry counts, observed pacing pairs and source-gap boundaries, alongside analyzed intervals, complete slow-frame episode evidence, source columns, and the count of warning details omitted by the parser's retention limit. Nothing is uploaded at any point, and the page's Content-Security-Policy (connect-src 'self') has the browser enforce that.

  • Fast on real-sized CSV captures: parsing streams off the file in a Web Worker with a hand-rolled incremental line scanner (no split() on a 430k-line file, no per-row object allocation) — see How it works.

  • A small Node CLI (stutterscope summary <file>) sharing the exact same core library as the browser app. Its source runs directly under Node from a git clone, but an installed copy (npx/npm i -g) lives under node_modules, where Node's native TypeScript support refuses to run — so the published package ships plain JS, compiled by a prepare script; see How it works.

Capture studies

Local MangoHud clock gaps. Removing whole records could leave a long capture's clock totals close enough to pass, while pacing and episode grouping joined frames across the omitted interval. The source now interrupts those connections at large local clock disagreements, retaining source-line witnesses and the recorded frame durations. In the controlled case, two separated slow-frame episodes no longer become one. Reproduction, intact public control and limits.

Missing telemetry is not a measured outcome (source and live demo). A blank DisplayedTime cell no longer counts as a dropped frame; a missing Dropped column no longer means zero drops. Optional metrics show how many frames actually supplied an observation, including after selecting a process or time interval. A four-frame control with one displayed, one explicitly not displayed and two unknown outcomes now reports 1 drop / 2 observed, with two unknowns. Six unmodified upstream capture files also stop reporting an invented zero. Rules, pinned-capture replay and actual exports.

  • Native clock continuity: filtered presents can leave valid CSV rows that are no longer adjacent observations. Compare their native clocks, split pacing/rolling context and keep unknown durations unknown. The built-in Inspect filtered presents example uses attributed Intel test data; a separate untouched public FrameView capture exposes the same issue. Concrete counterexamples and limits.
  • PresentMon 2.x CPU-start continuity: use millisecond CPU-start clocks with the earlier row's forward-looking FrameTime. A native filtered stream previously reported 173 adjacent pairs; the original records establish 90 pairs and 83 interruptions. CPU-only captures are also recognized when GPU tracking is disabled, preserving process/swap-chain selection instead of combining unrelated processes. Native executable replay and limits.
  • Shifted CSV records: a row with more cells than its header cannot establish column alignment. It is now skipped with a source-line warning and a continuity gap, including clock-anchor reset for cumulative timestamps. In a retained public FrameView test asset, the old reader treated a process ID as a 7,820 ms frame. Reproduction and compatibility limits include OCAT's valid shortened telemetry tails.
  • Correct grouping after removing process IDs: application names and swap-chain addresses stay together. A controlled five-row export previously labeled two applications as one game at 45.5 FPS with two false stutters; the game alone now reports its actual 100 FPS and no stutter. Blank declared identity cells produce skipped-row warnings and continuity breaks. Reproduction, public-capture controls and limits.

What "1% low" means in other tools, measured on public captures. On 8 public captures of 907 to 117,569 frames, four implementations of the percentile "1% low" (MangoHud, mangoplot, CapFrameX, stutterscope) agree to a median 0.13% and at most 3.7%, while the mean-of-slowest and time-weighted definitions sit a median 17% and 10% lower, and on a capture with a 5-second stall up to 85% and 99.7% lower. stutterscope matched MangoHud's own summary of a 117,569-frame log to 0.03% (1% low) and 0.21% (0.1% low). Against two real FrameView summaries, release 0.2.5 was 1.9% to 28.6% low on the slowest-mean figure because it rounded the bucket size instead of rounding up; fixed in 0.3.0, which also adds the time-weighted figure. 34 files were found, with no systematic search, and 18 of them are PresentMon test fixtures: this is not a census. Study, sources and numbers.

Usage

Imports show progress and can be cancelled. Choosing another file or starting a new session stops the previous import; errors offer a retry. Run A and run B keep independent captures and process selections. Native CapFrameX JSON shows a saved-recording picker for each slot. Its first recording is selected by default; changing it resets that slot's interval. JSON is limited to 64 MiB and recordings stay separate. The CLI supports the same selection (0.3.0 and later):

npx @anthonymercer/stutterscope summary saved-capture.json --capture-run 2 --events
npx @anthonymercer/stutterscope compare saved-capture.json saved-capture.json --a-capture-run 1 --b-capture-run 2 --json

Edit the detection controls, then choose Apply settings (or press Enter). Both loaded reports update together after successful calculation. Invalid values or a worker failure leave the last applied results and exports intact. Changing the viewport resizes the charts; on phones, the comparison table scrolls horizontally within its own keyboard-accessible region.

Drop a file on the page (or click one of the "load a synthetic sample" links to try it with no file of your own) and you get a tile grid plus four charts. Load a second run to compare:

$ npx @anthonymercer/stutterscope summary examples/samples/presentmon2-synthetic-demo.csv

presentmon2-synthetic-demo.csv  PresentMon 2.x
7,969 frames, 119.9s

  Average FPS            66.5
  1% low (percentile)    29.6 fps
  1% low (slowest-mean)  21.3 fps
  0.1% low (percentile)  29.2 fps
  P99 frame time         33.81 ms
  P99.9 frame time       34.22 ms
  Stutter events         28  (1.55% of capture time)
  Hitches (>50ms)        2
  Pacing (MASD)          5.29 ms
  Dropped frames         4 (0.05%)
  CPU- / GPU-bound       25% / 75%
  Display latency P99    68.33 ms

That output is real, from the synthetic PresentMon 2.x sample committed in examples/samples/. The repository's eight CSV sample files encode the same underlying scenario — a vsync-locked menu, a shader-compile hitch, a VRR-style traversal section with periodic streaming stutter, a bigger hitch, a CPU-bound section, a stutter cluster, and a GPU-bound vsync sawtooth. Shared frame-time metrics agree within each format's written precision. Optional telemetry varies: MangoHud has no busy-time pair, and the current PresentMon default does not provide a categorical drop outcome.

Missing cumulative timestamps now break frame adjacency instead of creating a false hitch. The retained capture replay compares the CLI and browser exports with adjacent-row arithmetic.

How it works

Parsing. Each format has its own sniff()/parser pair in src/core/parsers/. Detection reads the first chunk of the file and scores every format by header fingerprint (src/core/parsers/index.ts); the highest-confidence match wins, and generic CSV is the always-available fallback. CSV parsing never materializes the file as an array of line strings: src/core/stream.ts reads the File in chunks via file.stream(), decodes incrementally, and a small LineScanner (src/core/csv.ts) buffers partial lines across chunk boundaries. Each numeric channel accumulates into a growable typed-array builder (src/core/buffer.ts) that doubles capacity like a Vec, so a 430k-row capture ends up as a handful of Float64Arrays, not 430k small objects. One 2026-10-07 measurement on Node 24.21.0 (14 vCPU WSL2 Linux, about 47 GiB RAM): a synthetic 430,000-row / 66.7 MiB PresentMon 2.x CSV parsed in 782 ms and computed its full metrics summary in 130 ms. This excludes CSV generation and browser rendering; timings vary with machine load. The verification record gives the command and a second, busier observation (tests/core/performance.test.ts).

Native CapFrameX JSON uses the same file decoder and worker, but buffers the complete document with a 64 MiB input limit. It validates parallel sample arrays and retains one saved recording; CSV remains streamed. See the format contract.

Off the main thread. src/worker/parse.worker.ts owns parsing and metrics; the UI (src/ui/) only ever talks to it through a small promise-based client (src/ui/workerClient.ts) and renders whatever comes back. Large results come back as structured-cloned typed arrays; only the worker's own cached copy of a run is kept around so applying detection settings can recompute without re-parsing. Each slot has its own worker; replacing a capture terminates that worker. If it fails, a retry reloads the same file, column mapping, process selection, and analysis interval before recomputing.

The source and live demo bundle the parser with the initial page, so the first local-file import, comparison, replacement and downloads work after disconnecting. This requires an already loaded production page: it is not an offline page installer. Unloaded examples still need the network, and lazy font subsets may fall back to system fonts. Reproduction and scope.

Charts. The frame-time trace, FPS-over-time, and percentile-curve charts use uPlot, which renders directly from typed arrays on a single canvas — the reason this stays smooth at hundreds of thousands of points without any bundled charting framework. The histogram is a ~30-line canvas draw. The 2026-10-11 source build includes the worker in 143,286 bytes of app JavaScript (49,942 bytes with Python's default gzip compression). These numbers exclude source maps, CSS, local fonts and example captures; they are sizes, not a loading-time benchmark. Before/after bundle receipt.

Metrics. Every formula is written out in docs/metrics.md and mirrored exactly in src/core/metrics.ts — including why two tools can report different "1% lows" for the same capture (they're answering different questions; both are computed and shown).

The CLI's two run modes. npm run cli runs src/cli/index.ts directly from source — fine, since Node's native TypeScript support can strip types from any file outside node_modules. An installed copy can't take that path: npx/npm i -g place the package under node_modules, and Node explicitly refuses to strip types there (ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING, verified by installing a packed tarball and running the symlinked bin against a real capture). tsconfig.cli.json compiles src/core and src/cli to plain JS in dist-cli/ (TypeScript 5.7+'s rewriteRelativeImportExtensions rewrites the .ts import specifiers the source needs for the first path into .js as it emits); a prepare script runs that build when the package is published (and whenever npm installs it from git), so nothing has to be pre-built or committed.

Accuracy and limitations

Imports require valid UTF-8 or BOM-marked UTF-16. Invalid byte sequences are rejected, including damage beyond the browser's format preview. Replacing them with a placeholder could merge distinct application names and fabricate pacing metrics. Byte-level counterexamples and unchanged public captures document this correction.

CSV imports reject duplicate named headers and malformed quotes before reporting metrics. A retained two-frame counterexample previously reported 100 FPS by silently choosing one of two FrameTime columns; it now identifies the ambiguity. Counterexamples, unchanged capture replay, and browser evidence.

  • MangoHud requires log_interval=0. Periodic logging records snapshots, which cannot reconstruct a per-frame stutter report. The CSV omits that setting. stutterscope cross-checks its elapsed clock against frame durations, refuses large contradictions, and preserves the assumption in reports. A compatible clock does not prove complete coverage; short or incomplete clocks remain unverified. See the upstream evidence and check limits.
  • Native clock checks cannot prove complete recording. PresentMon 1.x, OCAT/CapFrameX CSV and FrameView clocks can expose discontinuities, allowing for their written precision. stutterscope also checks PresentMon 2.x CPUStartTime and CPUStartQPCTime (milliseconds), using the earlier row's duration. The current default's explicit millisecond clocks use their matching present or CPU interval; see the native format contract. Raw CPUStartQPC ticks and CPUStartDateTime remain unsupported for this check. Coarse/missing clocks, tiny gaps and unsupported clock columns can conceal missing observations. Frame counts, FPS and distributions still describe retained durations; missing frame counts, duration and cause are not reconstructed. Evidence contract.
  • Format verification is source/sample-based, not device-tested. Parsers are checked against upstream source code, official docs, or a real captured file from each project's own repository (all cited in docs/formats.md) — this project doesn't own a PresentMon/FrameView/CapFrameX/MangoHud/OCAT license or the hardware to generate a fresh capture with each tool. If you hit a real capture that doesn't parse, please open an issue with a redacted sample.
  • NVIDIA FrameView's schema isn't officially published column-by-column (it's closed-source); the parser is verified against one real captured log redistributed by a third-party viewer, and FrameView's own telemetry-column set is known to vary by GPU/driver — see docs/formats.md for exactly what's read vs. ignored.
  • One stream at a time. A PresentMon/OCAT/CapFrameX/FrameView capture taken without a process filter holds every process that presented (the game, dwm.exe, a browser on the other monitor), interleaved. stutterscope analyses one stream (process + swap chain): the busiest one that isn't the compositor, unless you pick another in the web app or pass --stream to the CLI. Mixing them would double-count time. See docs/formats.md.
  • CapFrameX and OCAT CSVs can be indistinguishable. When CapFrameX exports without its metadata comment block, its CSV is byte-identical in schema to OCAT's. Detection picks CapFrameX only when that block is present; otherwise it's labelled OCAT. The metrics are the same either way, since both share the same underlying present-hook data.
  • Dropped-frame and latency definitions differ across formats by construction (each tool defines them differently); stutterscope doesn't normalize them into one made-up cross-tool number, and says which column each figure comes from in docs/formats.md/docs/metrics.md.
  • Everything is held in memory. There's no out-of-core / paged parsing — a capture has to fit in the browser tab's available memory. This is comfortable well past the 430k-row/240fps/30-minute case the brief for this project called out, but an hours-long capture at very high sample rates could exhaust it.
  • The stutter-detection defaults (k = 2.0, window radius = 10 frames, hitch = 50 ms) are reasonable starting points, not a standard. They're configurable in the UI and CLI precisely because "what counts as a stutter" is a judgment call; see docs/metrics.md for the exact definitions so you can decide if the defaults fit your use case.
  • Samples are synthetic, generated deterministically by scripts/generate-samples.ts and labelled as such everywhere they appear (filenames, the in-app sample picker, examples/samples/manifest.json). They're built to exercise realistic patterns, not to imitate a specific game.

Development

npm run dev        # local dev server
npm test           # vitest — parsers, metrics, and a numpy-oracle cross-check
npm run typecheck  # tsc --noEmit, strict
npm run lint       # eslint
npm run build      # production build to dist/
npm run test:browser # production build + Chromium/Firefox workflows
npm run samples    # regenerate examples/samples/ from scripts/generate-samples.ts
npm run cli -- summary <file>  # run the CLI from source
npm run build:cli  # compile the CLI to dist-cli/ (also runs automatically on `npm install`)

Tests cross-check the metrics library against numpy on a committed synthetic frame-time trace (scripts/oracle.py is the oracle; tests/core/oracle.test.ts does the comparison) and check every parser against a small, hand-computable fixture built from that format's real column headers. See CONTRIBUTING.md for how to add a format or a metric.

Browser tests exercise interrupted imports, worker and network failures, atomic settings updates, exported evidence, keyboard controls, resource cleanup, and viewport resizing. Both Chromium and Firefox check WCAG 2.1 A/AA and axe best-practice rules at desktop and phone widths. Install the test engines with npx playwright install chromium firefox before the first browser run; CI also installs their system dependencies.

The 2026-10-07 verification record includes the retained raw capture, independent NumPy results, clean-install checks, and installed-package/browser report agreement. Use Node 24 for source development; the compiled CLI also supports Node 22.6 and later.

To refresh the interval screenshots, serve npm run build with npm run preview -- --port 4194, then run node scripts/capture-intervals.mjs. It uses the retained measured capture, checks browser/CLI report agreement, and saves the phone layout, frame evidence, and PNG report card. The existing node scripts/capture-screenshots.js recreates the older synthetic examples.

Contributing

Issues and PRs welcome — see CONTRIBUTING.md. Please run npm run lint && npm run typecheck && npm test before opening a PR.

License

MIT © 2026 Anthony Mercer


Part of Officina, a set of small open-source tools by Anthony Mercer.

About

Frame-time analysis for PC gamers and reviewers: PresentMon, FrameView, CapFrameX, MangoHud and OCAT captures, in your browser.

Topics

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages