简体   繁体   English

如何测量使用TextureView的android应用的FPS? (上午使用OpenGL)

[英]How do I measure FPS of an android application that uses TextureView? (Am using OpenGL)

I have an infinite loop in my Render Thread. 我的渲染线程中有一个无限循环。 I tried measuring assuming that every call to eglSwapBuffers draws a new frame, but that is giving me results like 200 fps, which is not possible, right? 我尝试进行测量,假设每次调用eglSwapBuffers绘制一个新帧,但这给了我200 fps的结果,这是不可能的,对吧? The refresh rate cannot exceed 60? 刷新率不能超过60?

Now I am doing the same thing but also using surfaceTexture.getTimeStamp() of the surfaceTexture of the SurfaceView. 现在,我正在做同样的事情,但是还使用了SurfaceView的surfaceTexture的surfaceTexture.getTimeStamp() I consider a frame as having been drawn only if the timestamp returned in the previous iteration is not the same as in the current. 我认为仅当上一次迭代中返回的时间戳与当前迭代中的时间戳不同时,才绘制框架。 Is the an acceptable way to measure? 可以接受的测量方法吗? This is showing 50-55fps when I do no drawing. 当我不绘图时,这显示为50-55fps。 ie the loop has only eglSwapBuffers() and the getTimeStamp calls. 即循环仅eglSwapBuffers()getTimeStamp调用。

The surfaceTexture.getTimeStamp() seems to be giving the correct result. surfaceTexture.getTimeStamp()似乎给出了正确的结果。 I tested it by adding up all the differences between results returned by consecutive getTimeStamp() calls and it is equal to the total time the code ran for. 我通过将连续的getTimeStamp()调用返回的结果之间的所有差加起来来测试它,它等于代码运行的总时间。 This indicates that no frames are being left unconsidered etc. 这表明没有任何帧被忽略等。

Another solution I found is this Android app . 我发现的另一个解决方案是这个Android应用程序 I do not know how it works but it is giving approximately the same results as the above method. 我不知道它是如何工作的,但是它给出的结果与上述方法大致相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM