1#!/bin/bash
2# Copyright 2020 Google LLC
3#
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# This script measures frametimes for CanvasKit rendering all skps in ~/skps, using puppeteer. It
8# can optionally output a human-readable summary of the collected measurements.
9# See the document "SIMD CanvasKit Build Performance Testing" for results and context:
10# https://docs.google.com/document/d/114kdSGPMnOSQCZ7pFgd3MGMn5mIW562RMoXVmD13e0M/edit?ts=5f0eedf6#
11#
12# arguments:
13# --release     perfs the release build of CanvasKit and outputs data to release_out.json
14# --simd        perfs the experimental_simd build of CanvasKit outputs data to simd_out.json
15# --summary     outputs results from the perfs in a human readable table format.
16#
17# example usage: ./perf_all_skps.sh --release --simd --summary
18
19for f in $HOME/skps/*.skp;
20do
21    if [[ "$*" == *"--release"* ]]
22    then
23        echo $f
24        node perf-canvaskit-with-puppeteer.js \
25            --canvaskit_js ../../out/canvaskit_wasm/canvaskit.js \
26            --canvaskit_wasm ../../out/canvaskit_wasm/canvaskit.wasm --use_gpu \
27            --input_skp $f \
28            --bench_html render-skp.html \
29            --chromium_executable_path "/applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" \
30            --output release_out.json \
31            --merge_output_as `basename $f`
32    fi
33    if [[ "$*" == *"--simd"* ]]
34    then
35        node perf-canvaskit-with-puppeteer.js \
36            --canvaskit_js ../../out/canvaskit_wasm_experimental_simd/canvaskit.js \
37            --canvaskit_wasm ../../out/canvaskit_wasm_experimental_simd/canvaskit.wasm --use_gpu \
38            --input_skp $f \
39            --bench_html render-skp.html \
40            --chromium_executable_path "/applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" \
41            --enable_simd \
42            --output simd_out.json \
43            --merge_output_as `basename $f`
44    fi
45done
46if [[ "$*" == *"--summary"* ]]
47then
48    node skp_data_prep
49fi
50