如何衡量OpenGL ES的真正FPS性能? [英] How to measure true FPS performance of OpenGL ES?

查看:216
本文介绍了如何衡量OpenGL ES的真正FPS性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我意识到这些是两件不同的事情:

I realized that these are two different things:

绘图,并将其显示在屏幕上。

Drawing, and getting it on screen.

因此,虽然您可以以60 FPS的速度从CADisplayLink中获取每次调用,但如果您的绘图操作花费的时间略长于1/60秒,理论上最终会得到30 FPS,因为您错过了其他所有获得机会的机会通过渲染管道。

So while you may draw in every single call from CADisplayLink at a rate of 60 FPS, if your drawing operations take slightly longer than 1/60 seconds you end up with 30 FPS in theory, because you're missing out every other chance to get through the render pipeline.

确定;知道这一点,记住启动NSTimeInterval并在运行循环中递增一个帧计数器,然后在结束时检查是否已经过了一秒并计算最后一次传递的秒的FPS似乎是无稽之谈。

OK; Knowing this, it seems nonsense to remember the start NSTimeInterval and incrementing a frame counter in the run loop, then checking at the end if a second has passed and calculate the FPS for the last passed second.

我想要一种在屏幕上实际从OpenGL ES获取真实FPS值的方法。我查看了Xcode 3.2.6中的乐器,但找不到一个。但我记得有一种方法可以获得FPS值。真实的。

I want a way to actually get the true FPS value from OpenGL ES on screen. I looked into instruments in Xcode 3.2.6 but couldn't find one for this. But I remember there was a way to get that FPS value. The real one.

如何?

推荐答案

测量OpenGL ES性能按帧率可能不是最好的方法。我自己开始记录帧时间,这似乎可以更准确地评估我的整体渲染性能。将渲染封装在类似的内容中是微不足道的。

Measuring OpenGL ES performance by framerate may not be the best approach. I've taken to recording frame time myself, which seems to provide a more accurate assessment of my overall rendering performance. It's trivial to encapsulate your rendering in something like

CFTimeInterval previousTimestamp = CFAbsoluteTimeGetCurrent();

// Do your OpenGL ES frame rendering here, as well as presenting the onscreen render buffer

CFTimeInterval frameDuration = CFAbsoluteTimeGetCurrent() - previousTimestamp;
NSLog(@"Frame duration: %f ms", frameDuration * 1000.0);

获取渲染时间。如果你需要它,你的瞬时帧速率与上面代码中的 frameDuration 相反。

to obtain rendering time. If you want it, your instantaneous framerate is the inverse of frameDuration in the above code.

小心时间整个帧渲染,因为iOS和其他移动设备中基于图块的延迟渲染器可能会通过将它们延迟到帧被绘制到屏幕之前隐藏特定渲染操作的真实成本。

Be careful to time the entire frame rendering, because the tile-based deferred renderer in iOS and other mobile devices may hide the true cost of particular rendering operations by delaying them until just before the frame is drawn to the screen.

但是,如果您想从Instruments获得不太精确的帧速率,您可以使用OpenGL ES驱动程序工具执行此操作,该工具将每秒核心动画帧报告为其记录的统计信息之一:

However, if you want to obtain a less precise framerate from Instruments, you can do that using the OpenGL ES Driver instrument, which reports Core Animation Frames Per Second as one of its logged statistics:

这篇关于如何衡量OpenGL ES的真正FPS性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆