2016-01-09 116 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); 
}