README.md
1# skpbench
2
3skpbench is a benchmarking tool for replaying skp or mksp files on android devices.
4it achieves a lower variance in framerate by controlling the clock speed and stopping
5all other processes that could cause interference.
6
7## Build
8
9skpbench consists of the skpbench binary which must be built for the phone you intend to run on,
10and skpbench.py which runs on the machine the phone is connected to via ADB and is the entry point.
11
12The to build skia for android are at https://skia.org/user/build#android and reproduced here.
13
14Download the Android NDK
15
16```
17./bin/sk asset download android_ndk_linux /tmp/ndk
18```
19
20After this is set up once, build skpbench for your target cpu (assumed to be arm64 here for a Pixel 3)
21
22```
23bin/gn gen out/arm64 --args='ndk="/tmp/ndk" target_cpu="arm64" is_debug=false'
24ninja -C out/arm64 skpbench
25```
26
27## Benchmark an SKP on a connected device.
28
29First, copy the built skpbench binary and an example skp file to the device.
30(or pull a skp corpus using instructions in the section below)
31
32```
33adb push out/arm64/skpbench /data/local/tmp
34adb push /home/nifong/Downloads/foo.skp /data/local/tmp/skps/
35```
36
37Run skpbench.py
38
39```
40python tools/skpbench/skpbench.py \
41 --adb \
42 --config gles \
43 /data/local/tmp/skpbench \
44 /data/local/tmp/skps/foo.skp
45```
46
47`--adb` specifies that it should use adb to the only connected device and run skpbench there.
48`--force` is necessary because we don't yet have a configuration to monitor vitals on the Pixel 3.
49`--config gles` specifies Open GL ES is the backend GPU config to use.
50
51Additional documentation of arguments is printed by `python tools/skpbench/skpbench.py --help`
52
53Output appears in the following format
54```
55 accum median max min stddev samples sample_ms clock metric config bench
56 0.1834 0.1832 0.1897 0.1707 1.59% 101 50 cpu ms gles foo.skp
57```
58
59`accum` is the time taken to draw all frames, divided by the number of frames.
60`metric` specifies that the unit is ms (milliseconds per frame)
61
62## MSKP corpus
63
64A manually collected corpus of MSKPs from around 30 top apps (using skia via HWUI) and of about 20
65actions in RenderEngine exists in a google cloud storage folder managed by skia/infra/bots/assets/mskp/upload.py
66
67To download the fileset, first determine the highest current version of the fileset
68
69```
70gsutil ls gs://skia-assets/assets/mskp/
71```
72
73Download the latest version.
74
75```
76gsutil cp gs://skia-assets/assets/mskp/5.zip ~/Downloads
77```
78
79Unzip the archive and adb push it to the device.
80
81To upload a new version of the corpus, use the steps above to download and unzip the last version, change the
82content however you need, then Use the upload tool, passing the directory of the altered archive (not a zip file).
83Note that you must provide it as an absolute path.
84
85```
86python upload.py --target_dir=/home/nifong/scratch/new_mskps
87```
88
89The upload script should print a version number.
90Finally, submit something like https://skia-review.googlesource.com/c/skia/+/304376
91to point jobs at the new version.
92
93## Production
94
95skpbench is run as a tryjob from gerrit, where it uploads the results to perf.skia.org.
96Once such job name is `Perf-Android-Clang-Pixel4XL-GPU-Adreno640-arm64-Release-All-Android_Skpbench`
97
98Perf results are available by querying with this or similar.
99 extra_config = Android_Skpbench
100 sub_result = accum_cpu_ms
101
102Example perf query
103https://perf.skia.org/e/?queries=extra_config%3DAndroid_Skpbench%26sub_result%3Daccum_cpu_ms
104