ClawdHub技能管理
CLI工具管理技能包
该技能用于对原生macOS或iOS应用进行性能剖析与堆栈分析,基于Xcode Instruments工具链,支持xctrace命令行与图形界面两种工作模式。
安装前提:需安装Xcode及命令行工具,确保xcrun可用。
步骤1:列出可用模板
xcrun xctrace list templates
步骤2:录制性能追踪(启动模式)
xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --launch -- /path/To/App.app
步骤3:录制性能追踪(附加模式)
先启动应用获取PID,然后执行:
xcrun xctrace record --template 'Time Profiler' --time-limit 60s --output /tmp/App.trace --attach <pid>
步骤4:打开追踪文件
open -a Instruments /tmp/App.trace
关键提示:为避免LaunchServices解析到错误应用,建议直接使用二进制路径:/path/App.app/Contents/MacOS/App
见下方输入与输出表格。
| 项目 | 内容 |
|---|---|
| 输入 | 目标应用路径/PID、模板名称、采集时长、输出路径、设备UDID |
| 输出 | .trace追踪文件、XML堆栈数据、TOC导出信息 |
| 适用人群 | macOS/iOS开发者、性能优化工程师、自动化测试人员 |
| 不包含 | 内存泄漏分析、网络性能监控、SwiftUI预览调试 |
原始链接:https://github.com/openclaw/skills/tree/main/skills/steipete/instruments-profiling/SKILL.md
来源类型:GitHub仓库