Add profiler plugin for each platform#15
Merged
Merged
Conversation
tmarmer
commented
May 8, 2026
Comment on lines
+1
to
+3
| export const getNowTime = globalThis.performance | ||
| ? () => globalThis.performance.now() | ||
| : () => Date.now(); |
Contributor
Author
There was a problem hiding this comment.
performance isn't available on the ios and kotlin integrations, so it's preferred for accuracy but Date.now still works.
| "id": "Profile-main", | ||
| "type": "flame-graph", | ||
| "binding": "rootNode", | ||
| "width": "@[{{rootNode.value}} / 200]@", |
Contributor
Author
There was a problem hiding this comment.
This looks weird but it helps normalize the width of each bar on the graph to be 5px per millisecond. Since flame-graph doesn't show times this helps with at least seeing how long everything takes.
sugarmanz
reviewed
Jun 10, 2026
5030079 to
9c0658c
Compare
The ios and swiftui BUILD files referenced PlayerUIDevtoolsPlugins and PlayerUIDevtoolsSwiftUIPlugins (trailing 's'), which don't exist. Point them at the real PlayerUIDevtoolsPlugin / PlayerUIDevtoolsSwiftUIPlugin targets so the iOS dependency graph resolves.
Mirror the basic plugin: move the profiler flow out of the hand-written core/src/plugin-flow.json and into a new @player-devtools/profiler-plugin-content DSL package (flow.tsx + views/navigation/schema/common), compiled via dsl_compile. core now imports ProfilerPluginData + INTERACTIONS from the content package, so the flow and runtime share one source of truth. Fixes drift the static JSON had accumulated: - flow id now matches PLUGIN_ID (was player-ui-profiler-devtools-plugin) - Raw tab reset now publishes reset-profiling (was clear-profiling, which had no handler, so the button was dead) - view ids match VIEWS_IDS Also add the missing ProfilerDevtoolsPlugin.produceState helper that plugin.ts already called but was never defined.
Mirror basic/android: ProfilerAndroidDevtoolsPlugin wrapping the profiler jvm plugin, with BUILD (kt_android), AndroidManifest, and overlay style.
9c0658c to
9d4d682
Compare
The profiler Swift sources imported PlayerUIDevtoolsPlugins / PlayerUIDevtoolsSwiftUIPlugins (trailing 's'), which aren't real module names, causing 'no such module' build failures. Corrected to the singular PlayerUIDevtoolsPlugin / PlayerUIDevtoolsSwiftUIPlugin. Package.swift had a single, mis-named profiler target (pointing only at the ios sources with minimal deps). Split it into two targets mirroring the basic plugin so the swiftui wrapper is built/published and the ios target has the deps its sources import: - PlayerUIDevtoolsBaseProfilerDevtoolsPlugin (profiler/ios) - PlayerUIDevtoolsProfilerPlugin (profiler/swiftui) These names now match the Bazel targets and the @testable imports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds the ProfilerDevtoolsPlugin, available at the core layer with wrappers on each platform.
ProfileNodewhich will have the start and end times, using theperformanceAPI when avialable, but defaulting toDate.nowotherwise.valueof each node is the total duration and is used by theflame-graphasset to determine the width of the bars it displaysnameis displayed on the graph andtooltipis displayed on hoverchildrenstructure is inferred by when hooks are called, and is only needed for theflame-graphasset to render correctly.flame-graphwith something that can better show the timings.flame-graphasset by inserting spacers and removing anything with avalueof 0(work)spacers provide a way to show the reelative timing with which a hook started relative to the its parentvalueof 0 doesn't render anyway so removing those helps group a few spacers to clean up the ui.rawDatatab to show the profiling information without the transformation step.Flame Graph:

Raw Data:

Change Type (required)
Indicate the type of change your pull request is:
patchminormajor