Skip to content

native: count frames on the pprof server - #1010

Merged
omartelo merged 1 commit into
mainfrom
perf/native-frame-counter
Nov 1, 2026
Merged

omartelo merged 1 commit into
mainfrom
perf/native-frame-counter

Conversation

@omartelo

@omartelo omartelo commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Why

Measuring the window's GPU and CPU cost this week, the one number a profile never gave was the frame rate: a CPU profile says where a frame's time goes, nvidia-smi says what the process costs, and neither says how many frames per second the window is drawing. Every rig run needed a throwaway counter patched into main.go; the real window could not be measured at all.

What

/debug/vars on the LICH_NATIVE_PPROF address serves frames, an expvar counting the frames drawn since the window opened. Two reads a few seconds apart give the rate:

curl -s http://127.0.0.1:6060/debug/vars | jq .frames; sleep 10; curl -s http://127.0.0.1:6060/debug/vars | jq .frames

Nothing listens unless LICH_NATIVE_PPROF is set, as before. docs/native-window.md names it.

Test plan

  • TestPprofServesTheFrameCount
  • native/: gofmt, go vet ./..., go test ./...

A CPU profile of a real window shows where a frame's time goes, never how
many frames there are, and the window's cost is frames times that.
/debug/vars on the LICH_NATIVE_PPROF address now carries the frames drawn
since the window opened; two reads apart give the rate.
@omartelo
omartelo merged commit e9583c4 into main Nov 1, 2026
7 checks passed
@omartelo
omartelo deleted the perf/native-frame-counter branch November 1, 2026 21:32
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.

1 participant