skia2/tools/skpbench
Brian Salomon 59c60b0cb3 Reland "Add idea of DataType to SkYUVAPixmapInfo."
This is a reland of ed63444587

Original change's description:
> Add idea of DataType to SkYUVAPixmapInfo.
> 
> DataType describes the data type of YUVA channels
> independent of how they are grouped into planes.
> 
> Adds mapping functions between SkColorType/channel count
> and DataType.
> 
> SkYUVAPixmapInfo can be constructed from DataType and will
> choose appropriate SkColorTypes for each plane.
> 
> Valid SkYUVAPixmapInfos now have the same DataType for each
> plane (could relax this in the future, esp for alpha plane).
> 
> SkYUVAPixmapInfo::SupportedDataTypes specifies the supported
> combinations of SkYUVAInfo::PlanarConfig and
> kYUVAPixmapInfo::DataType supported by a GrContext (based on
> supported texture formats).
> 
> SkImageGenerator/SkCodec YUVA query API now takes a
> SupportedDataTypes.
> 
> Change-Id: I8791234638e6ba3396d1e7960b7bc210edc6dd57
> Bug: skia:10632
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314276
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

Bug: skia:10632
Change-Id: I35b55b7477c11c822fdb3729a9f84acff1eb785d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315284
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-09-03 18:05:17 +00:00
..
__init__.py
_adb_path.py Assert there are some sources when running skpbench 2019-09-11 20:20:33 +00:00
_adb.py skpbench: invoke 'adb wait-for-device' lazily 2019-07-29 16:49:59 +00:00
_benchresult.py
_hardware_android.py
_hardware_nexus_6p.py
_hardware_pixel2.py
_hardware_pixel_c.py
_hardware_pixel.py
_hardware.py
_os_path.py Assert there are some sources when running skpbench 2019-09-11 20:20:33 +00:00
README.md Add a basic readme to help the uninitiated build and run skpbench 2020-06-11 13:27:03 +00:00
sheet.py
skiaperf.py find min and max, separared by comma. not minmax. 2019-11-06 16:35:23 +00:00
skpbench.cpp Reland "Add idea of DataType to SkYUVAPixmapInfo." 2020-09-03 18:05:17 +00:00
skpbench.py Reland "Update skpbench to let the gpu thread run alongside the recording threads" 2020-05-18 15:12:47 +00:00

skpbench

skpbench is a benchmarking tool for replaying skp or mksp files on android devices. it achieves a lower variance in framerate by controlling the clock speed and stopping all other processes that could cause interference.

Build

skpbench consists of the skpbench binary which must be built for the phone you intend to run on, and skpbench.py which runs on the machine the phone is connected to via ADB and is the entry point.

The to build skia for android are at https://skia.org/user/build#android and reproduced here.

Download the Android NDK

cipd auth-login
python2 infra/bots/assets/android_ndk_linux/download.py  -t /tmp/ndk

After this is set up once, build skpbench for your target cpu (assumed to be arm64 here for a Pixel 3)

bin/gn gen out/arm64 --args='ndk="/tmp/ndk" target_cpu="arm64" is_debug=false'
ninja -C out/arm64 skpbench

Benchmark an SKP on a connected device.

First, copy the built skpbench binary and an example skp file to the device.

adb push out/arm64/skpbench /data/local/tmp
adb push /home/nifong/Downloads/foo.skp /data/local/tmp/skps/

Run skpbench.py (in my case on a Pixel 3)

python tools/skpbench/skpbench.py \
  --adb \
  --force \
  --config gles \
  /data/local/tmp/skpbench \
  /data/local/tmp/skps/foo.skp

--adb specifies that it should use adb to the only connected device and run skpbench there. --force is necessary because we don't yet have a configuration to monitor vitals on the Pixel 3. --config gles specifies Open GL ES is the backend GPU config to use.

Additional documentation of arguments is printed by python tools/skpbench/skpbench.py --help

Output appears in the following format

   accum    median       max       min   stddev  samples  sample_ms  clock  metric  config    bench
  0.1834    0.1832    0.1897    0.1707    1.59%      101         50  cpu    ms      gles      foo.skp

accum is the time taken to draw all frames, divided by the number of frames. metric specifies that the unit is ms (milliseconds per frame)

Production

skpbench is run as a tryjob from gerrit, where it uploads the results to perf.skia.org. TODO(nifong, csmartdalton): elaborate on this section.