2 # Script to play a john oliver youtube video N times.
3 # For each iteration, Total frames and janky frames are reported.
5 # Options are described below.
9 searchText="last week tonight with john oliver: online harassment"
12 function processLocalOption {
15 (-S) searchText="$2"; shift;;
16 (-t) vidMinutes="$2"; shift;;
18 echo "$0: unrecognized option: $1"
19 echo; echo "Usage: $0 [options]"
21 echo "-S youtube search text"
29 CMDDIR=$(dirname $0 2>/dev/null)
35 searchButton="860 177"
36 selectFirstVideo="225 400"
37 enableControls="1000 610"
41 searchButton="1200 160"
42 selectFirstVideo="480 653"
43 enableControls="1377 812"
47 searchButton="860 177"
48 selectFirstVideo="225 400"
49 enableControls="1000 610"
53 searchButton="1356 93"
54 selectFirstVideo="378 264"
55 enableControls="1464 812"
59 searchButton="1440 70"
60 selectFirstVideo="228 224"
61 enableControls="1528 880"
66 echo "Error: No display information available for $DEVICE"
72 while [ $count -lt $2 ]
90 resetJankyFrames $(getPackageName $app)
92 while [ $cur -le $iterations ]
94 t=$(startActivity $app)
102 doTap $selectFirstVideo
108 ((vidTime=60*vidMinutes))
117 set -- $(getJankyFrames $(getPackageName $app))
123 if [ ${totalDiff:=0} -eq 0 ]; then
124 echo Error: could not read frame info with \"dumpsys gfxinfo\"
127 ((frameSum=frameSum+totalDiff))
128 ((jankSum=jankSum+jankyDiff))
129 ((latency90Sum=latency90Sum+latency90))
130 ((latency95Sum=latency95Sum+latency95))
131 ((latency99Sum=latency99Sum+latency99))
132 if [ "$totalDiff" -eq 0 ]; then
133 echo Error: no frames detected. Is the display off?
135 ((jankPct=jankyDiff*100/totalDiff))
136 resetJankyFrames $(getPackageName $app)
139 echo Frames: $totalDiff latency: $latency90/$latency95/$latency99 Janks: $jankyDiff\(${jankPct}%\)
143 ((aveJankPct=jankSum*100/frameSum))
144 ((aveJanks=jankSum/iterations))
145 ((aveFrames=frameSum/iterations))
146 ((aveLatency90=latency90Sum/iterations))
147 ((aveLatency95=latency95Sum/iterations))
148 ((aveLatency99=latency99Sum/iterations))
149 echo AVE: Frames: $aveFrames latency: $aveLatency90/$aveLatency95/$aveLatency99 Janks: $aveJanks\(${aveJankPct}%\)