FileDocCategorySizeDatePackage
TestFramerateView.javaAPI DocAndroid 5.1 API3028Thu Mar 12 22:22:48 GMT 2015com.android.testframerate

TestFramerateView

public class TestFramerateView extends android.opengl.GLSurfaceView

Fields Summary
private static String
TAG
private long
mLastTime_us
private long
mNumShortFramesElapsed
Constructors Summary
public TestFramerateView(android.content.Context context)


       
        super(context);
        setEGLContextClientVersion(2);
        setRenderer(new Renderer());
    
Methods Summary
private voidregisterTime(long now_us)

        
        long longFrameTime_ms = Integer.parseInt(SystemProperties.get("debug.longframe_ms", "16"));
        long elapsedTime_us = now_us - mLastTime_us;
        float fps = 1000000.f / elapsedTime_us;
        if (mLastTime_us > 0 && elapsedTime_us > longFrameTime_ms*1000) {
          Log.v(TAG, "Long frame: " + elapsedTime_us/1000.f + " ms (" + fps + " fps)");
          if (mNumShortFramesElapsed > 0) {
            Log.v(TAG, "  Short frames since last long frame: " + mNumShortFramesElapsed);
            mNumShortFramesElapsed = 0;
          }
        } else {
            ++mNumShortFramesElapsed;
        }

        mLastTime_us = now_us;