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";;
67 echo "Error: No display information available for $DEVICE"
73 while [ $count -lt $2 ]
90 resetJankyFrames $(getPackageName $app)
92 while [ $cur -le $iterations ]
94 if [ $capturesystrace -gt 0 ]; then
95 ${ADB}atrace --async_start -z -c -b 16000 freq gfx view idle sched
97 t=$(startActivity $app)
101 t=$(startActivity $app)
105 t=$(startActivity $app)
111 swipe "$DOWN" $downCount
115 swipe "$DOWN" $downCount
120 if [ $capturesystrace -gt 0 ]; then
121 ${ADB}atrace --async_dump -z -c -b 16000 freq gfx view idle sched > trace.${cur}.out
126 set -- $(getJankyFrames $(getPackageName $app))
132 if [ ${totalDiff:=0} -eq 0 ]; then
133 echo Error: could not read frame info with \"dumpsys gfxinfo\"
137 ((frameSum=frameSum+totalDiff))
138 ((jankSum=jankSum+jankyDiff))
139 ((latency90Sum=latency90Sum+latency90))
140 ((latency95Sum=latency95Sum+latency95))
141 ((latency99Sum=latency99Sum+latency99))
142 if [ "$totalDiff" -eq 0 ]; then
143 echo Error: no frames detected. Is the display off?
146 ((jankPct=jankyDiff*100/totalDiff))
147 resetJankyFrames $(getPackageName $app)
150 echo Frames: $totalDiff latency: $latency90/$latency95/$latency99 Janks: $jankyDiff\(${jankPct}%\)
154 ((aveJankPct=jankSum*100/frameSum))
155 ((aveJanks=jankSum/iterations))
156 ((aveFrames=frameSum/iterations))
157 ((aveLatency90=latency90Sum/iterations))
158 ((aveLatency95=latency95Sum/iterations))
159 ((aveLatency99=latency99Sum/iterations))
160 echo AVE: Frames: $aveFrames latency: $aveLatency90/$aveLatency95/$aveLatency99 Janks: $aveJanks\(${aveJankPct}%\)