xcode capture得到的时间与 stat unit 中的时间对不上

ue426 中 stat unit中显示的gpu time 我看源码是直接统计的 Metal command buffer的时间。我们游戏经常显示的是17ms,当我把物体隐藏 或者降低分辨率 时间是可以降到 5ms或者6ms。但是我直接用xcode capture 这一帧的话,显示的时长只有8ms。截图中是xcode profile界面。我看也并没有buddle。按理说就算xcode的是回拨 时间也不能差这么多吧。这样也给我们的性能优化造成了困惑,请问xcode profile的时间是只能参考百分比吗 还是因为其他问题。感谢感谢。

[Attachment Removed]

重现步骤
xcode上 capture一帧,看他提供的时间总长

[Attachment Removed]

您好,感谢提供截图,信息很有帮助。

我感觉差异最可能来自 GPU 频率状态(DVFS)

截图右上角显示 Performance State: Medium,也就是说 8.33ms 是在 A14 中档频率下测的。iOS 会按负载动态调整 GPU 频率。游戏锁 60 帧、GPU 又没有跑满的时候,系统会把频率压到较低档位,让每帧的工作"刚好"在一个 vsync 周期内完成。所以实际运行时 stat unit 的 GPU 时间会趋近 16.7ms

可以在 Xcode → Window → Devices and Simulators → 选中设备 → Device Conditions → GPU Performance State,分别设成 Minimum / Medium / Maximum,每种状态下观察 stat unit 的 GPU 时间。如果 Medium 下约 8-9ms、Minimum 下接近 17ms,就能确认差异来自频率状态。

[Attachment Removed]