Skip to content

feat: Adding a new Client CPU Profiler tab and visualization #369

Merged
codyward-skybox merged 4 commits intomainfrom
cody.ward/whisker_scopes
May 1, 2026
Merged

feat: Adding a new Client CPU Profiler tab and visualization #369
codyward-skybox merged 4 commits intomainfrom
cody.ward/whisker_scopes

Conversation

@codyward-skybox
Copy link
Copy Markdown
Contributor

This change adds a new Client CPU Profiler tab which displays our internal CPU Profiler data (driven by the internal whisker profiler).

To visualize the data a new MinecraftProfilerFlameStreamChart control was created. This displays each scope in a hierarchal list, where each scope has an incoming lane of timing data. This data can be represented as normalized per lane, or absolute relative to the global timings.

Each lane has a midline, and a high/low value. By default we display the midline, but you can enable visualizing each lane as a band.

Additional controls exist for setting the timing window, the timing display units (nano/micro/milliseconds) as well as reducing the scope depth if you'd prefer keeping an eye on the higher parent scopes.

whisker_cpu.mp4

Quick implementation of profiler scopes

flame stream test

flame stream relative

current iteration, needs some cleanup

various cleanup

cleanup and visual tweaks

midline options

Adjustments to normalization

pin the lane timings

Rename to ClientCPUProfiler

minor cleanup

detangling changes

detangling changes
@codyward-skybox codyward-skybox marked this pull request as ready for review April 28, 2026 17:39
Copy link
Copy Markdown
Contributor

@anthonywongskyboxlabs anthonywongskyboxlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall makes sense to me, the charts look awesome!

It could probably use a cleanup pass, but not too big of a deal since this is contained to one tab.

const effectiveDepthLimit = useMemo(() => {
if (maxVisibleDepth === MAX_DEPTH_ALL) {
return maxDepth;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Is this check necessary? If true, the Math.min call below would also return maxDepth

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used when in the All Depths mode to force using the maxDepth, in that case maxVisibleDepth is effectively invalid and so it fallbacks to maxDepth

z: 'pathKey',
fill: (point: FlameChartPoint) => point.laneFill,
fillOpacity: (point: FlameChartPoint) => 0.1 + Math.sqrt(point.laneRelativeRatio) * 0.5,
}),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting some eslint warnings from this call being indented twice.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen this in other files, I think there's a conflict between eslint and the autoformatting on save

Comment thread webview-ui/src/diagnostics_panel/controls/MinecraftProfilerFlameStreamChart.tsx Outdated
@codyward-skybox codyward-skybox merged commit 00ccd26 into main May 1, 2026
2 checks passed
@codyward-skybox codyward-skybox deleted the cody.ward/whisker_scopes branch May 1, 2026 21:46
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