2 # Script to start 3 chrome tabs, fling each of them, repeat
3 # For each iteration, Total frames and janky frames are reported.
5 # Options are described below.
13 function processLocalOption {
18 (-L) appList=$2; shift; ret=1;;
19 (-T) capturesystrace=1;;
20 (-W) waittime=$2; shift; ret=1;;
22 echo "$0: unrecognized option: $1"
23 echo; echo "Usage: $0 [options]"
24 echo "-A : use all known applications"
25 echo "-L applist : list of applications"
26 echo " default: $appList"
27 echo "-N : no app startups, just fling"
28 echo "-g : generate activity strings"
30 echo "-T : capture systrace on each iteration"
31 echo "-d device : device type (shamu, volantis, bullhead,...)"
37 CMDDIR=$(dirname $0 2>/dev/null)
46 UP="70 400 70 100 $flingtime"
47 DOWN="70 100 70 400 $flingtime";;
52 UP="700 1847 700 400 $flingtime"
53 DOWN="700 400 700 1847 $flingtime";;
58 UP="500 1200 500 550 $flingtime"
59 DOWN="500 550 500 1200 $flingtime";;
64 UP="500 1400 500 400 $flingtime"
65 DOWN="500 400 500 1400 $flingtime";;
70 UP="500 1560 500 530 $flingtime"
71 DOWN="500 530 500 1560 $flingtime";;
73 echo "Error: No display information available for $DEVICE"
79 while [ $count -lt $2 ]
96 resetJankyFrames $(getPackageName $app)
98 while [ $cur -le $iterations ]
100 if [ $capturesystrace -gt 0 ]; then
101 ${ADB}atrace --async_start -z -c -b 16000 freq gfx view idle sched
103 t=$(startActivity $app)
108 swipe "$DOWN" $downCount
113 if [ $capturesystrace -gt 0 ]; then
114 ${ADB}atrace --async_dump -z -c -b 16000 freq gfx view idle sched > trace.${cur}.out
119 set -- $(getJankyFrames $(getPackageName $app))
125 if [ ${totalDiff:=0} -eq 0 ]; then
126 echo Error: could not read frame info with \"dumpsys gfxinfo\"
130 ((frameSum=frameSum+totalDiff))
131 ((jankSum=jankSum+jankyDiff))
132 ((latency90Sum=latency90Sum+latency90))
133 ((latency95Sum=latency95Sum+latency95))
134 ((latency99Sum=latency99Sum+latency99))
135 if [ "$totalDiff" -eq 0 ]; then
136 echo Error: no frames detected. Is the display off?
139 ((jankPct=jankyDiff*100/totalDiff))
140 resetJankyFrames $(getPackageName $app)
143 echo Frames: $totalDiff latency: $latency90/$latency95/$latency99 Janks: $jankyDiff\(${jankPct}%\)
147 ((aveJankPct=jankSum*100/frameSum))
148 ((aveJanks=jankSum/iterations))
149 ((aveFrames=frameSum/iterations))
150 ((aveLatency90=latency90Sum/iterations))
151 ((aveLatency95=latency95Sum/iterations))
152 ((aveLatency99=latency99Sum/iterations))
153 echo AVE: Frames: $aveFrames latency: $aveLatency90/$aveLatency95/$aveLatency99 Janks: $aveJanks\(${aveJankPct}%\)