profiler-cpu-query
Queries stored CPU profiles by top functions, time window, call tree, or component to diagnose JavaScript hotspots and correlate CPU cost with specific commits.
Instructions
Query Hermes CPU profile data with targeted modes for iterative investigation. Modes:
top_functions: Global CPU hotspots ranked by self-time. Optional time_window_ms to filter.
time_window: CPU breakdown for time_window_ms (e.g. during a slow commit or hang).
call_tree: For a given function_name, show its callees, and its callers with include_callers.
component_cpu: For a given component_name, aggregate CPU activity across its stored commits. In top_functions and time_window, self-times are the summed sampling intervals of the samples that landed in the window, so they measure sampled coverage rather than the window's width and do not change if you widen the query. Their tables state how many samples they cover and how much was idle. Each row is one call path, so a function can have several rows and top_n counts rows. 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 (and ideally react-profiler-analyze) first.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"device_id": "<device_id>",
"mode": "<mode>"
},
"name": "profiler-cpu-query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | Query mode; see Modes in the tool description. | |
| port | No | Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. Range: 1 to 65535. | |
| top_n | No | Number of results to return. Default: 15. Must be greater than 0. | |
| device_id | Yes | Device ID used to record or load the React profile. | |
| react_only | No | top_functions and time_window: list only React component functions (PascalCase names). Default: false. | |
| function_name | No | Function name | |
| component_name | No | Component name | |
| time_window_ms | No | Time window in ms since profiling started, the same clock profiler-commit-query prints | |
| include_callers | No | Also show callers of the function. Default: false. |