xref: /aosp_15_r20/frameworks/base/apct-tests/perftests/surfaceflinger/README.md (revision d57664e9bc4670b3ecf6748a746a57c557b6bc9e)
1*d57664e9SAndroid Build Coastguard Worker## SurfaceFlinger performance tests
2*d57664e9SAndroid Build Coastguard Worker
3*d57664e9SAndroid Build Coastguard Worker### Precondition
4*d57664e9SAndroid Build Coastguard WorkerTo reduce the variance of the test, if `perf-setup.sh` (platform_testing/scripts/perf-setup)
5*d57664e9SAndroid Build Coastguard Workeris available, it is better to use the following instructions to lock CPU and GPU frequencies.
6*d57664e9SAndroid Build Coastguard Worker```
7*d57664e9SAndroid Build Coastguard Workerm perf-setup
8*d57664e9SAndroid Build Coastguard WorkerPERF_SETUP_PATH=/data/local/tmp/perf-setup.sh
9*d57664e9SAndroid Build Coastguard Workeradb push $OUT/$PERF_SETUP_PATH $PERF_SETUP_PATH
10*d57664e9SAndroid Build Coastguard Workeradb shell chmod +x $PERF_SETUP_PATH
11*d57664e9SAndroid Build Coastguard Workeradb shell $PERF_SETUP_PATH
12*d57664e9SAndroid Build Coastguard Worker```
13*d57664e9SAndroid Build Coastguard Worker
14*d57664e9SAndroid Build Coastguard Worker### Example to run
15*d57664e9SAndroid Build Coastguard WorkerUse `atest`
16*d57664e9SAndroid Build Coastguard Worker```
17*d57664e9SAndroid Build Coastguard Workeratest SurfaceFlingerPerfTests:SurfaceFlingerPerfTest -- \
18*d57664e9SAndroid Build Coastguard Worker      --module-arg SurfaceFlingerPerfTests:instrumentation-arg:kill-bg:=true
19*d57664e9SAndroid Build Coastguard Worker```
20*d57664e9SAndroid Build Coastguard WorkerUse `am instrument`
21*d57664e9SAndroid Build Coastguard Worker```
22*d57664e9SAndroid Build Coastguard Workeradb shell am instrument -w -r -e class android.surfaceflinger.SurfaceFlingerPerfTest \
23*d57664e9SAndroid Build Coastguard Worker          -e kill-bg true \
24*d57664e9SAndroid Build Coastguard Worker          com.android.perftests.surfaceflinger/androidx.test.runner.AndroidJUnitRunner
25*d57664e9SAndroid Build Coastguard Worker```
26*d57664e9SAndroid Build Coastguard Worker* `kill-bg` is optional.
27*d57664e9SAndroid Build Coastguard Worker
28*d57664e9SAndroid Build Coastguard WorkerTest arguments
29*d57664e9SAndroid Build Coastguard Worker- kill-bg
30*d57664e9SAndroid Build Coastguard Worker    * boolean: Kill background process before running test.
31*d57664e9SAndroid Build Coastguard Worker- profiling-iterations
32*d57664e9SAndroid Build Coastguard Worker    * int: Run the extra iterations with enabling method profiling.
33*d57664e9SAndroid Build Coastguard Worker- profiling-sampling
34*d57664e9SAndroid Build Coastguard Worker    * int: The interval (0=trace each method, default is 10) of sample profiling in microseconds.
35