top_profile
Run a live sampling profiler on a Python process for a few seconds and return a summary of the most time-consuming functions.
Instructions
Run a live py-spy top view for a few seconds and return the summary.
On Windows, py-spy top cannot be captured through a pipe, so this tool
falls back to a short record --format raw sample and returns the hottest
frames instead of raw top output.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| gil | No | Only show traces holding the GIL. | |
| pid | No | Process ID. Use this OR command. | |
| idle | No | Include idle threads. | |
| rate | No | Samples per second (default 100). | |
| native | No | Include native frames if supported. | |
| command | No | Command to run and monitor. Use this OR pid. | |
| duration | No | How many seconds to run top (default 5, recommended 5-60). | |
| subprocesses | No | Include child processes. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |