Visitar URL original
Chart the app's counters, the batching and lightmap bakes on the Performance tab by mvaligursky · Pull Request #19 · playcanvas/inspector · GitHub
Skip to content

Chart the app's counters, the batching and lightmap bakes on the Performance tab - #19

Merged
mvaligursky merged 1 commit into
mainfrom
claude/extra-stats
Oct 28, 2026
Merged

mvaligursky merged 1 commit into
mainfrom
claude/extra-stats

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

Adds what the Editor's launch profiler shows that the Performance tab did not: the app's own counters, the batcher's time and lightmap bakes.

Changes:

  • Counters section: charts the counters the app keeps in app.stats.user, as each frame ended. Each counter is a line with a scale of its own, as their units are the app's; hover shows each value and its change since the frame before. The frame details list their values, frames selected together their averages, 95th percentiles and largest, and copies include them, with a Counters series to copy as JSON or CSV. Without counters, the section says how to add one. It collapses like the other sections.
  • Batching: the batcher's work at the start of the render, updating the dynamic batches and creating the batches of groups that changed, is a phase of the render on the frame timeline and in the frame details, with the time creating batches apart. Timed by the profiler and debug engines, for an app with a batcher.
  • Lightmap bakes: a Lightmaps row of the events marks the frames that baked lightmaps, for an app with a lightmapper. On the frame timeline a bake is drawn on the CPU line where it ran, as in the app's update event, or under the part of the frame it ran inside, as the engine's first bake in the render. Its hover and the details give how long it took, the lightmaps and passes, and the render targets and shaders it made; the Startup entry counts the bakes before the first frame. Reported by the profiler and debug engines. The lightmapper's own shadow map and render times are left out, as they count earlier passes again after each one.
  • Fix: the first frame after the Startup entry no longer compares its figures with it, which has none, so it no longer shows NaN changes or a false resources event.

Examples:

// counted afresh each frame
app.on('frameupdate', () => app.stats.user.set('enemies', 0));

// wherever the app counts them
app.stats.user.set('enemies', app.stats.user.get('enemies') + 1);

…e Performance tab

- A Counters section charts the counters the app keeps in app.stats.user as each frame ended,
  a line each on a scale of its own, with their values in the frame details, averages over
  frames selected together, and copies.
- The batcher's work is a phase of the render, with the batches it created apart, timed by
  the profiler and debug engines.
- Lightmap bakes are marked on a Lightmaps row of the events, for an app with a lightmapper,
  and drawn on the frame timeline's CPU line where they ran, with the lightmaps, passes,
  render targets and shaders of each.
- The first frame after the Startup entry no longer compares its figures with it, which showed
  NaN changes and false resource events.
@mvaligursky mvaligursky self-assigned this Oct 28, 2026
@mvaligursky
mvaligursky merged commit 364a880 into main Oct 28, 2026
3 checks passed
@mvaligursky
mvaligursky deleted the claude/extra-stats branch October 28, 2026 15:12
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