⚡
简介
CLI-only native app performance profiling via xctrace/Time Profiler—record, extract, symbolicate, and rank hotspots without Instruments UI, ideal for CI/CD automation.
原始描述
Native macOS/iOS app performance profiling via xctrace/Time Profiler and CLI-only analysis of Instruments traces. Use when asked to profile, attach, record, or analyze Instruments .trace files, find hotspots, or optimize native app performance without opening Instruments UI.
通过你的 Agent 添加
点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。
或者手动安装
Claude Codeunzip -o skill.zip -d ~/.claude/skills/native-app-performance/
其它 Agent解压到它自己的 skills 目录,目录名用 native-app-performance
包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。
技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。
技能正文
核心用法
Native App Performance skill 提供完整的命令行性能分析工作流,无需打开 Instruments UI。核心能力包括:
- 录制 Trace:通过
xcrun xctrace record附加到运行进程(--attach <pid>)或直接启动应用(--launch -- /path/to/binary),使用 Time Profiler 模板采集 90 秒样本 - 提取样本:使用
extract_time_samples.py从.trace包中导出结构化 XML 数据 - 符号化与热点分析:结合
vmmap获取运行时__TEXT段加载地址(处理 ASLR),通过top_hotspots.py调用atos符号化并排序 Top 30 热点
显著优点
- CI/CD 友好:纯 CLI 流程,可无缝集成自动化构建与性能回归测试
- 精确符号化:通过运行时 load address 解决 ASLR 问题,确保符号准确解析
- 灵活触发:支持 attach 已运行进程或 launch 新实例,覆盖调试与生产场景
- 低开销:Time Profiler 采样频率对应用性能影响极小
潜在局限
- 仅限 Apple 生态:依赖
xcrun xctrace、vmmap、atos等 macOS/iOS 专属工具链 - 符号匹配敏感:必须使用录制时的精确二进制版本,重建后需重新采集
- 手动地址处理:需手动通过
vmmap获取 load address,无法自动解析 - 模板固定:当前仅支持 Time Profiler,未覆盖 Allocations、System Trace 等模板
适合人群
- macOS/iOS 原生应用开发者与性能工程师
- 需要自动化性能测试的 DevOps/CI 工程师
- 习惯终端工作流、追求高效分析的技术团队
常规风险
- ASLR 计算错误:误用编译时地址而非运行时 load address 会导致符号化失败或错误归因
- 版本不匹配:二进制更新后未同步 trace 路径,产生无效符号输出
- 采样偏差:Time Profiler 基于中断采样,可能遗漏短时高频调用;捕获时长不足或触发路径不当会导致热点遗漏
- 权限问题:
xctrace附加进程可能需要系统完整性保护(SIP)配置或开发者工具授权