027b59d90a
We would like to make relayoutWindow a non-blocking call, and of course why not, who likes blocking. However it functions as a critical path of BLASTSync. To understand why examine the Guarantee described in BLASTSync.md. In order to implement this guarantee we need to know “Which frame has the client finished drawing” when it calls finishDrawing. The current answer to this question is “The frame reflecting the state observed in the last call to relayoutWindow”. The comments on mPending and mCurrentDrawHandlers also have a lot more context on how this works currently. Since relayoutWindow has a critical section, it also ensures that changes to syncable state and preparation of sync will be observed atomically (since they are both observed over relayoutWindow, which is always called before any frame drawing updated syncable state). We design a new protocol described in BLASTSync.md, which uses a seqId to track which call to finishDrawing reflects which syncable state. We implement this seqId based system. Unfortunately the WindowManager doesn’t quite conform to the requirements specified by the protocol, and a follow up CL ensures that syncable state changes will always be sent with the seqId. This CL simply adds the protocol specification and makes some required interface changes. It can be seen to be a no-op. Bug: 161810301 Bug: 175861051 Bug: 175861127 Bug: 200285149 Change-Id: If2dea07121fe7de5d2524c5b63678dddf955d4b7
Window manager performance tests
Precondition
To reduce the variance of the test, if perf-setup.sh
(platform_testing/scripts/perf-setup)
is available, it is better to use the following instructions to lock CPU and GPU frequencies.
m perf-setup
PERF_SETUP_PATH=/data/local/tmp/perf-setup.sh
adb push $OUT/$PERF_SETUP_PATH $PERF_SETUP_PATH
adb shell chmod +x $PERF_SETUP_PATH
adb shell $PERF_SETUP_PATH
Example to run
Use atest
atest WmPerfTests:RelayoutPerfTest -- \
--module-arg WmPerfTests:instrumentation-arg:kill-bg:=true
Use am instrument
adb shell am instrument -w -r -e class android.wm.RelayoutPerfTest \
-e listener android.wm.WmPerfRunListener \
-e kill-bg true \
com.android.perftests.wm/androidx.test.runner.AndroidJUnitRunner
kill-bg
is optional.
Test arguments
- kill-bg
- boolean: Kill background process before running test.
- profiling-iterations
- int: Run the extra iterations with enabling method profiling.
- profiling-sampling
- int: The interval (0=trace each method, default is 10) of sample profiling in microseconds.