profiler-cpu-query
Investigate JavaScript CPU hotspots and component CPU cost by querying Hermes profile data with targeted modes: global hotspots, time windows, call trees, or per-component breakdowns.
Instructions
Query Hermes CPU profile data with targeted modes for iterative investigation. Requires react-profiler-stop (and ideally react-profiler-analyze) to have been called first. Modes:
top_functions: Global CPU hotspots ranked by self-time. Optional time_window_ms to filter.
time_window: CPU breakdown for a specific time range (e.g. during a slow commit or hang).
call_tree: For a given function_name, show its callees and optionally callers.
component_cpu: For a given component_name, aggregate CPU activity across all its commits. Use when investigating JS CPU hotspots or correlating CPU cost with specific components. Returns a markdown table of CPU hotspots, call tree, or per-component CPU breakdown. Fails if no CPU profile is stored — run react-profiler-stop first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | Query mode: top_functions (global hotspots), time_window (CPU in a time range), call_tree (callers/callees of a function), component_cpu (CPU during a component's commits) | |
| port | No | Metro server port | |
| top_n | No | Number of results to return (default 15) | |
| device_id | Yes | Device logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId). | |
| function_name | No | Function name for call_tree mode | |
| component_name | No | Component name for component_cpu mode | |
| time_window_ms | No | Time window filter for time_window mode (ms, performance.now clock) | |
| include_callers | No | For call_tree mode: also show callers of the function |