1# Copyright 2020 Google Inc. 2# 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6#!/bin/bash 7mkdir -p out 8 9# download perfetto trace_processor 10if [ ! -f "trace_processor" ]; then 11 wget https://get.perfetto.dev/trace_processor 12 chmod +x trace_processor 13fi 14 15declare -a testnames=("star" "movie_loading" "uk" "white_material_wave_loading" 16 "check_animation" "confetti" "gears" 17 "hand_sanitizer" "heart_preloader" "i_was_scared_after_that_brouhaha" 18 "im_thirsty" "true_will" "workout_monkey_stay_healthy" 19 "ripple_loading_animation" "signature" "asdasd" "celebration" "check") 20 21adb root 22# get out of the lock screen 23adb shell input keyevent MENU 24adb shell input keyevent MENU 25adb shell setprop persist.traced.enable 1 26adb shell setenforce 0 27adb shell setprop debug.egl.traceGpuCompletion 1 28adb shell am force-stop org.skia.skottie 29renderer_names=(lottie_hw lottie_sw skottie) 30# iterate over lottie HW and skottie renderers 31for renderer in {0,2} 32do 33echo "renderer " ${renderer_names[${renderer}]} 34# iterate over each of the 18 lottie files 35for file in {0..17} 36do 37if [[ $1 == "delay" ]]; then 38 # start program first and wait 7 seconds for program to load fully 39 echo "waiting to show file " ${file} " " ${testnames[$file]} 40 adb shell am start -n org.skia.skottie/.PerfActivity --ei renderer ${renderer} --ei file ${file} 41 sleep 7 42 ./collect.sh 43else 44 # start perfetto first (before the app) to give it a chance to capture startup metrics/shader compile and first frame rendering 45 ./collect.sh & 46 perfetto_pid=$! 47 # give one second for the perfetto script to start 48 sleep 1 49 echo "show file " ${file} " " ${testnames[$file]} 50 adb shell am start -n org.skia.skottie/.PerfActivity --ei renderer ${renderer} --ei file ${file} 51 #wait for perfetto to finish (~10s) 52 wait $perfetto_pid 53fi 54adb shell am force-stop org.skia.skottie 55./trace_processor --run-metrics=skottie_metric.sql --metrics-output=json trace > out/data_${renderer_names[${renderer}]}_${file}_${testnames[$file]}.json 56mv trace out/trace_${renderer_names[${renderer}]}_${file}_${testnames[$file]} 57done 58done 59echo All done 60