DO NOT MERGE: Add SurfaceFlingerPerfTests

cherry-pick following change ids from U so we can get
a performance baseline in t-qpr
 I4577987a8c06243b58f3982b379540104ca19a10
 Ic8f07222c8307223c030dab08f4acd3eb18e18aa
 Ic2b49ddbba9d27a8f9ac8015870a1c4aa86014f6
 I28e280b8df2d7140fb51fb05fd4e897e23478143
 I89c75c956d6aa644367a834453e80c550d351fc2
 I3c273a71ed29d5011848517b2bff81c1f3b5b80d

Test: atest SurfaceFlingerPerfTests
Bug: b/230039226
Ignore-AOSP-First: New folder that does not exist within AOSP.
Change-Id: If31b1b573faeed269cf2cc8c7e483e4c5a351dba
diff --git a/apct-tests/perftests/surfaceflinger/README.md b/apct-tests/perftests/surfaceflinger/README.md
new file mode 100644
index 0000000..0dec70f
--- /dev/null
+++ b/apct-tests/perftests/surfaceflinger/README.md
@@ -0,0 +1,34 @@
+## SurfaceFlinger 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 SurfaceFlingerPerfTests:SurfaceFlingerPerfTest -- \
+      --module-arg SurfaceFlingerPerfTests:instrumentation-arg:kill-bg:=true
+```
+Use `am instrument`
+```
+adb shell am instrument -w -r -e class android.surfaceflinger.SurfaceFlingerPerfTest \
+          -e kill-bg true \
+          com.android.perftests.surfaceflinger/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.