Record a Time Profiler trace
recordTimeProfileRecord a time profile trace of an iOS app on a device or simulator to analyze performance and identify bottlenecks.
Instructions
[mg.trace] Wrapper around xcrun xctrace record. Capture a .trace bundle from a running app on a device or simulator. Required: exactly 1 of deviceId/simulatorId, exactly 1 of attachAppName/attachPid/launchBundleId, an output path ending in .trace. Defaults: template = "Time Profiler", durationSec = 90.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| template | No | xctrace template name (e.g. "Time Profiler", "Animation Hitches", "Allocations"). Default "Time Profiler". | Time Profiler |
| deviceId | No | UDID of a physical device. Mutually exclusive with `simulatorId`. | |
| simulatorId | No | UDID of a simulator. Mutually exclusive with `deviceId`. Use `listTraceDevices` to find UDIDs. | |
| attachAppName | No | Attach to a running app by name (e.g. "DemoApp"). Mutually exclusive with `attachPid` and `launchBundleId`. | |
| attachPid | No | Attach by PID. Mutually exclusive with `attachAppName` and `launchBundleId`. | |
| launchBundleId | No | Launch app by bundle id and start recording at launch. Mutually exclusive with `attachAppName` and `attachPid`. | |
| durationSec | No | Recording duration in seconds (default 90, max 600). | |
| output | Yes | Absolute path where the resulting `.trace` bundle should be written. Must end in `.trace`. |