2016-01-09 108 views

回答

2

我的猜测是,它使用这些命令[编程]:

(1)adb shell dumpsys SurfaceFlinger --latency-clear

(2)adb shell dumpsys SurfaceFlinger --latency <window name>

例如,

adb shell dumpsys SurfaceFlinger --latency com.android.settings/com.android.settings.SubSettings 

RefreshPeriod <-- Time in nano seconds 
desiredPresentTime actualPresentTime frameReadyTime <-- Time in nano seconds 
desiredPresentTime actualPresentTime frameReadyTime 
desiredPresentTime actualPresentTime frameReadyTime 
... 

关于如何以解释结果,见https://chromium.googlesource.com/chromium/src/build/+/fefabac95d6aee4d941111e67f606dc50dfe9dd1/android/pylib/perf/surface_stats_collector.py#215 and https://android.googlesource.com/platform/frameworks/native/+/86efcc0/services/surfaceflinger/FrameTracker.cpp#217

0
void Update() 
{ 
    float fps = 1f/Time.deltaTime; 
    Debug.Log(fps); 
}