DevTools
Debug builds of every PAM Native app include an on-device performance overlay. Use it while you interact with a screen to see what a tap, a scroll or a reload costs: how long PHP’s frame took to decode and mount, how many native nodes changed, and whether the commit was a small patch or a full tree. It is the quickest way to find an expensive path before you measure it properly.
The overlay and its receiver are not registered in release builds.
Toggle the overlay
Section titled “Toggle the overlay”Start the app with pam dev, then toggle the overlay from another terminal:
pam devtoolspam ios:devtoolsRun the same command again to hide it. The app must be running; otherwise the command tells you to start it first.
What it shows
Section titled “What it shows”| Metric | What to look for |
|---|---|
| Frame rate (smoothed) | Drops while scrolling or animating point to work on the UI thread. |
| Decode and mount time | The cost of applying PHP’s frame natively. Large values mean large patches. |
| Nodes and batches | How many native nodes the last commit touched. A small state change should touch few nodes. |
| Patch vs. full commits | Full commits after every change mean component identity is unstable (check keys in lists). |
| Native heap | Memory held by the renderer. It should return to its baseline after you leave a screen. |
| Capability timeline | The last eight events: module latency and failures, lifecycle changes, runtime errors and HTTP method, status and byte counts. |
On iOS the overlay reports the same metrics, with retained renderer memory in place of the Android native heap.
Profiling workflow
Section titled “Profiling workflow”-
Find it. Toggle the overlay and repeat the slow interaction. Note the frame rate and which metric jumps.
-
Capture it. Take a diagnostics snapshot while the app is in that state and turn it into a trace:
Terminal window pam diagnostics > artifacts/snapshot.jsonpam timeline artifacts/snapshot.json --output artifacts/timeline.json -
Measure it. Run the repeatable Android suites on a real device:
Terminal window pam benchmark # macrobenchmark of a separate, release-optimized buildpam profile # generates a baseline profile for faster startuppam benchmarkinstalls a minified benchmark build and its instrumentation, so it never measures the.debugapp thatpam devinstalled. -
Fix and compare. Apply the change and run the same suite again on the same device.
Common fixes: give list rows stable keys, virtualize long lists, size images to
their display size, and move work that does not need to run per render out of
render(). See Performance.
Raw Android broadcast
Section titled “Raw Android broadcast”Integrations can toggle the overlay without the CLI:
adb shell am broadcast \ -a dev.pam.nativeapp.action.TOGGLE_DEVTOOLS \ -p com.example.acme.debugThe debug package normally ends in .debug. When Firebase is enabled with a
google-services.json that has no debug client, debug builds keep the base
application id; pam devtools resolves the right package for you.
Custom iOS hosts
Section titled “Custom iOS hosts”If you embed PAM Native in your own UIKit app, install the reusable
PamDevToolsOverlay over the PAM host view and forward the runtime callbacks. The
generated host already does this.
let devTools = PamDevToolsOverlay()let runtime = PamRuntime( hostView: hostView, reportError: reportError, onFrameCommitted: { [weak devTools] metrics in devTools?.update(metrics) }, onDiagnostic: { [weak devTools] diagnostic in devTools?.record(diagnostic) },)
devTools.toggle()Keep it out of the release view hierarchy.
Next steps
Section titled “Next steps”- Debugging: logs, the error overlay and diagnostics snapshots.
- Performance: the rules that keep frames smooth.
- DevTools package: an optional in-app inspector plugin.