Branch
Hash :
0c9ce8c7
Author :
Date :
2023-09-08T21:34:07
Trace-based testing app Modifying angle_trace_tests app to run traces automatically on invocation and dumps fps information. Also, compares the screenshot with the golden images if provided and dumps the histogram of image diff. Golden image naming format: <trace_name>_golden.png - Run traces - Capture screenshot - Record FPS value - Record image diff histogram Bug: b/270421213 Doc: doc/StandaloneBenchmark.md Change-Id: I42b8d229e1e358d48887f29f2424b9e771093ce9 Commit-Queue: Shashank Sharma <shawshanks@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6072349 Commit-Queue: Cody Northrop <cnorthrop@google.com> Auto-Submit: Shashank Sharma <shawshanks@google.com> Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com>
This option builds the trace tests apk to run the selected traces from restricted traces in “src/tests/restricted_traces/“. Running traces this way won’t require additional trace data setup. Simply clicking on the apk or running the app activity will run the traces. Additionally, it will also dump the fps values of the traces it runs and also the histogram of the diff of the screenshot of the KeyFrame of the trace if golden images are provided.
Setup is similar to ANGLE Restricted Traces and requires some additional GN args.
Follow the Accessing the traces in restricted_traces/README.md and then return here.
This option is available only for Android. Follow the steps in DevSetupAndroid.md (Recommend using the Performance arguments for best performance)
When that is working, add the following GN arg to your setup:
build_angle_trace_perf_tests = true
Since the traces are numerous and trace data is huge in size, you should limit the compilation to a subset to keep the apk file size within limits.
angle_restricted_traces = ["pokemon_go 5", "car_chase 1"]
angle_standalone_benchmark_traces = ["pokemon_go", "car_chase"]
angle_standalone_benchmark_goldens_dir = "<Path to golden images of the traces if present>"
Names of the png files of golden images should match \<trace name>_golden.png
To build the apk:
autoninja -C out/<config> angle_trace_tests
adb install out/<config>/angle_trace_tests_apk/angle_trace_tests-debug.apk
To allow the results to be available in the external storage, we need to provide appropriate permission.
adb shell "appops set com.android.angle.test MANAGE_EXTERNAL_STORAGE allow || true"
You can run the app either by clicking on the “ANGLEBench” app icon or by running the following command (after unlocking the phone).
Note: It is important to unlock the device before running the adb command.
adb shell am start -n com.android.angle.test/com.android.angle.test.StandaloneBenchmarkActivity
Below configs for the trace runs are set to hardcoded values
gVerboseLogging = true;
gScreenshotDir = "<Application_Dir>/files";
gSaveScreenshots = true;
gUseANGLE = "vulkan";
However, other configs can be set using org.chromium.native_test.NativeTest.CommandLineFlags. Example:
adb shell am start -n com.android.angle.test/com.android.angle.test.StandaloneBenchmarkActivity -e org.chromium.native_test.NativeTest.CommandLineFlags '--trials=1\ --trial-time=60'
Once all the traces listed in angle_standalone_benchmark_traces are finished, the app will generate traces_fps.txt.
If angle_standalone_benchmark_goldens_dir is specified in the GN args, it will also generate traces_img_comp.txt.
Output files will be placed on the device in chromium_tests_root dir in external storage. For example: /sdcard/chromium_tests_root/
<trace 1 name> <FPS value>
<trace 2 name> <FPS value>
...
<trace 1 name>:
Diff in pixel value: 0-20, 20-40, 40-70, 70-100, 100-150, 150-255
Number of pixels: <#>, <#>, <#>, <#>, <#>, <#>,
<trace 2 name>:
Diff in pixel value: 0-20, 20-40, 40-70, 70-100, 100-150, 150-255
Number of pixels: <#>, <#>, <#>, <#>, <#>, <#>,
...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
# ANGLE Standalone Benchmark
This option builds the trace tests apk to run the selected traces from restricted traces in "src/tests/restricted_traces/". Running traces this way won't require additional trace data setup. Simply clicking on the apk or running the app activity will run the traces. Additionally, it will also dump the fps values of the traces it runs and also the histogram of the diff of the screenshot of the KeyFrame of the trace if golden images are provided.
Setup is similar to ANGLE Restricted Traces and requires some additional GN args.
## Accessing the traces
Follow the `Accessing the traces` in [restricted_traces/README.md](../src/tests/restricted_traces/README.md#accessing-the-traces) and then return here.
## Building the Standalone Benchmark apk
This option is available only for Android. Follow the steps in [DevSetupAndroid.md](DevSetupAndroid.md) (Recommend using the [`Performance`](DevSetupAndroid.md#performance-config) arguments for best performance)
When that is working, add the following GN arg to your setup:
```
build_angle_trace_perf_tests = true
```
### Selecting which traces to build
Since the traces are numerous and trace data is huge in size, you should limit the compilation to a subset to keep the apk file size within limits.
```
angle_restricted_traces = ["pokemon_go 5", "car_chase 1"]
angle_standalone_benchmark_traces = ["pokemon_go", "car_chase"]
angle_standalone_benchmark_goldens_dir = "<Path to golden images of the traces if present>"
```
Names of the png files of golden images should match \<trace name\>_golden.png
To build the apk:
```
autoninja -C out/<config> angle_trace_tests
```
## Installing the apk
```
adb install out/<config>/angle_trace_tests_apk/angle_trace_tests-debug.apk
```
### Set permissions for the app
To allow the results to be available in the external storage, we need to provide appropriate permission.
```
adb shell "appops set com.android.angle.test MANAGE_EXTERNAL_STORAGE allow || true"
```
## Running the apk
You can run the app either by clicking on the "ANGLEBench" app icon or by running the following command (after unlocking the phone).
Note: It is important to unlock the device before running the adb command.
```
adb shell am start -n com.android.angle.test/com.android.angle.test.StandaloneBenchmarkActivity
```
## Run configs
Below configs for the trace runs are set to hardcoded values
```
gVerboseLogging = true;
gScreenshotDir = "<Application_Dir>/files";
gSaveScreenshots = true;
gUseANGLE = "vulkan";
```
However, other configs can be set using `org.chromium.native_test.NativeTest.CommandLineFlags`. Example:
```
adb shell am start -n com.android.angle.test/com.android.angle.test.StandaloneBenchmarkActivity -e org.chromium.native_test.NativeTest.CommandLineFlags '--trials=1\ --trial-time=60'
```
## Results
Once all the traces listed in `angle_standalone_benchmark_traces` are finished, the app will generate `traces_fps.txt`.
If `angle_standalone_benchmark_goldens_dir` is specified in the GN args, it will also generate `traces_img_comp.txt`.
Output files will be placed on the device in `chromium_tests_root` dir in external storage. For example: `/sdcard/chromium_tests_root/`
### traces_fps.txt
```
<trace 1 name> <FPS value>
<trace 2 name> <FPS value>
...
```
### traces_img_comp.txt
```
<trace 1 name>:
Diff in pixel value: 0-20, 20-40, 40-70, 70-100, 100-150, 150-255
Number of pixels: <#>, <#>, <#>, <#>, <#>, <#>,
<trace 2 name>:
Diff in pixel value: 0-20, 20-40, 40-70, 70-100, 100-150, 150-255
Number of pixels: <#>, <#>, <#>, <#>, <#>, <#>,
...
```