2 # Script to start a set of apps, switch to recents and fling it back and forth.
3 # For each iteration, Total frames and janky frames are reported.
5 # Options are described below.
7 # Works for volantis, shamu, and hammerhead. Can be pushed and executed on
14 function processLocalOption {
19 (-L) appList=$2; shift; ret=1;;
20 (-T) capturesystrace=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"
36 CMDDIR=$(dirname $0 2>/dev/null)
45 UP="70 400 70 100 $flingtime"
46 DOWN="70 100 70 400 $flingtime";;
51 UP="500 1200 500 550 $flingtime"
52 DOWN="500 550 500 1200 $flingtime";;
57 UP="70 400 70 70 $flingtime"
58 DOWN="70 70 70 400 $flingtime";;
60 echo "Error: No display information available for $DEVICE"
65 if [ $startapps -gt 0 ]; then
67 # start a bunch of apps
70 echo Starting $app ...
71 t=$(startActivity $app)
77 while [ $count -lt $2 ]
96 while [ $cur -le $iterations ]
98 if [ $capturesystrace -gt 0 ]; then
99 ${ADB}atrace --async_start -z -c -b 16000 freq gfx view idle sched
101 doKeyevent APP_SWITCH
103 swipe "$DOWN" $downCount
107 swipe "$DOWN" $downCount
111 if [ $capturesystrace -gt 0 ]; then
112 ${ADB}atrace --async_dump -z -c -b 16000 freq gfx view idle sched > trace.${cur}.out
117 set -- $(getJankyFrames)
123 if [ ${totalDiff:=0} -eq 0 ]; then
124 echo Error: could not read frame info with \"dumpsys gfxinfo\"
128 ((frameSum=frameSum+totalDiff))
129 ((jankSum=jankSum+jankyDiff))
130 ((latency90Sum=latency90Sum+latency90))
131 ((latency95Sum=latency95Sum+latency95))
132 ((latency99Sum=latency99Sum+latency99))
133 if [ "$totalDiff" -eq 0 ]; then
134 echo Error: no frames detected. Is the display off?
137 ((jankPct=jankyDiff*100/totalDiff))
140 echo Frames: $totalDiff latency: $latency90/$latency95/$latency99 Janks: $jankyDiff\(${jankPct}%\)
144 ((aveJankPct=jankSum*100/frameSum))
145 ((aveJanks=jankSum/iterations))
146 ((aveFrames=frameSum/iterations))
147 ((aveLatency90=latency90Sum/iterations))
148 ((aveLatency95=latency95Sum/iterations))
149 ((aveLatency99=latency99Sum/iterations))
150 echo AVE: Frames: $aveFrames latency: $aveLatency90/$aveLatency95/$aveLatency99 Janks: $aveJanks\(${aveJankPct}%\)