Skip to content

Profiler cli screenshots pr - #6278

Open
fqueze wants to merge 2 commits into
firefox-devtools:mainfrom
fqueze:profiler-cli-screenshots-pr
Open

Profiler cli screenshots pr#6278
fqueze wants to merge 2 commits into
firefox-devtools:mainfrom
fqueze:profiler-cli-screenshots-pr

Conversation

@fqueze

@fqueze fqueze commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Main | Deploy preview

Makes CompositorScreenshot images reachable from the CLI. They're in the profile,
but nothing could get at them, so sessions resorted to ~30 lines of Python over the
gzipped JSON.

Two commits:

  1. query layer — these markers have no schema (Make CompositorScreenshot markers schema-based #5303), so the image, a data URL
    stored as a string table index, was unreachable. Adds lookup by instant or range.
  2. marker screenshot and screenshots — write one image, or one per window at
    a time / over a range. Both require -o; --json honours it and elides the
    base64 like thread markers --list --json.

A profile normally has several windows (harness + browser at minimum), so an instant
resolves each window separately and --at returns one image per window, with a
win N column to tell them apart:

  m-19  t=3,485s  win 2  800px × 600px   3 685B  image/jpeg
  m-39  t=3,995s  win 1  1280px × 951px  5 367B  image/jpeg

A window whose frames all precede the instant is labelled stale rather than passed
off as current.

src/profile-query/ is shared with profiler.firefox.com; the additions there are new
exports, no existing path changes behaviour.

…ry layer

Screenshot markers have no marker schema (firefox-devtools#5303), so collectMarkerInfo produced
no fields for them at all, and the image -- a data URL stored as a string table
index in payload.url -- was unreachable from the query layer.

Adds src/profile-query/screenshot.ts, which resolves that index through the
string table and looks screenshots up by instant or range. An instant resolves
each window separately, since several are captured concurrently and one
window's frame says nothing about another's: a window whose frames all precede
the instant reports its latest one as isFallback/staleByMs rather than as the
frame at that time, and one already destroyed is dropped. Payloads also appear
as rawFields on MarkerInfoResult, elided to a stand-in for --json.
@fqueze
fqueze requested a review from canova August 20, 2026 19:27
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.18605% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.80%. Comparing base (9203f11) to head (76fa311).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-query/screenshot.ts 84.66% 23 Missing ⚠️
src/profile-query/formatters/marker-info.ts 82.35% 6 Missing ⚠️
src/profile-query/index.ts 83.87% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6278      +/-   ##
==========================================
+ Coverage   83.79%   83.80%   +0.01%     
==========================================
  Files         350      351       +1     
  Lines       37583    37798     +215     
  Branches    10459    10630     +171     
==========================================
+ Hits        31492    31676     +184     
- Misses       5664     5695      +31     
  Partials      427      427              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

'screenshots --at T -o dir/' answers "show me the screen at t=T", writing one
image per window on screen at that instant, since several windows are captured
concurrently; '--range A,B -o dir/' writes every frame in a range. Frames that
only precede the instant are labelled stale, so a window that painted nothing
recently is never passed off as current. 'marker screenshot m-N -o shot.jpg'
extracts one window's image from a single marker.

Both require -o rather than defaulting to a name in the current directory, so
neither drops a binary somewhere the caller did not ask for. --json honours -o
too, reporting each written path, and elides the base64 image the way
'thread markers --list --json' does rather than inlining megabytes into a
payload meant to be piped into jq.
@fqueze
fqueze force-pushed the profiler-cli-screenshots-pr branch from 4d9fa71 to 76fa311 Compare August 20, 2026 19:38
@canova

canova commented Aug 21, 2026

Copy link
Copy Markdown
Member

I haven't checked the code yet, but have you looked at #6261? (also I think Markus had a WIP branch somewhere) I think it would be good to land that one first so we can build on top of it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants