#!/bin/bash # 苹果 Instruments 命令行录制 + 导出:真机上把 App 拉进营地 / 野外,预热后用 xctrace 挂上进程录一段,再把 .trace 里每张表导出成 XML。 # 以后量「时间花在哪」先用它,不先造开关。模板:Game Performance / Game Performance Overview / Metal System Trace / Power Profiler / CPU Counters / System Trace / Time Profiler。 # 用法(真机):XT_TREE=<已构建的树(有 .iosdd)> xtrace.sh <模板名> [录制秒=30] [预热秒=30] # menu = 停在主菜单(触摸覆盖层隐藏)、blank = 纯 Metal 空白页(-mode blank,零子视图):给「系统合成器走不走直接上屏」做对照(看 displayed-surfaces-interval 的 direct-to-display 列) # 用法(本机 / mini,带窗口宿主):XT_OWNER=<线名+在量什么> XT_TREE=<树> XT_OUT=<产物> xtrace.sh mac camp <模板名> [录制秒=30] [预热秒=60] 可调 XT_RES / XT_3D / XT_ENV / XT_DIR;进门取 mini 测量锁(mlock.sh) # XT_INSTALL=1 先装机(装的就是 XT_TREE 的包);XT_ENV="DM_X=1 DM_Y=2" 追加 App 环境;XT_EXPORT=0 只录不导出(之后可 xtrace.sh export ) # 单独导出:xtrace.sh export → 同目录 toc.xml + tables/.xml # 产物:$DM_ROOT/run/ios/xtrace/<时刻>_<场景>_<模板>/{t.trace, toc.xml, tables/*.xml, launch.log, record.log}。走设备锁(测量类),单段占机 = 预热 + 录制 + 约 20 s。 # Apple Instruments command-line recording + export: on the real device, bring the App into the camp / wilderness, after warm-up attach xctrace to the process and record a stretch, then export every table in the .trace as XML. # From now on, to measure 'where the time goes' use this first instead of building switches first. Templates: Game Performance / Game Performance Overview / Metal System Trace / Power Profiler / CPU Counters / System Trace / Time Profiler. # Usage (real device): XT_TREE= xtrace.sh