如何应用程序开发过程中衡量FPS在Android [英] How to measure FPS on Android during app development

查看:114
本文介绍了如何应用程序开发过程中衡量FPS在Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法(也许是一些应用程序,黑客,库)来衡量应用程序开发Android的过程中每秒帧数(FPS)?

Is there a way (maybe some apps, hacks, libs) to measure frames per second (FPS) during app development for Android?

推荐答案

请注意,性能将是可怕的与调试器连接。

Note that performance will be terrible with the debugger attached.

这是我自己的Andr​​oid游戏,帧时间可以和<一测href="http://developer.android.com/reference/android/os/SystemClock.html"><$c$c>android.os.SystemClock.也就是说,你叫 SystemClock.elapsedRealtime()每帧一次,并减去从previous框的值。由于 elapsedRealtime()以毫秒为单位,计算帧率很简单,只要 1 / frameTime的

From my own Android game, frame time can be measured with android.os.SystemClock. That is, you call SystemClock.elapsedRealtime() once per frame and subtract the value from the previous frame. Since elapsedRealtime() is measured in milliseconds, calculating framerate is as simple as 1 / frametime.

另外请注意,frameTime的一般是更好地衡量性能比帧率。 1000fps和1200fps之间的差的时间作为60帧和61fps(约,可能比,虽然少)

Also note that frametime is generally a better gauge of performance than framerate. The difference between 1000fps and 1200fps is the same amount of time as the difference between 60fps and 61fps (approximately, probably less than that though)

这篇关于如何应用程序开发过程中衡量FPS在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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