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="500 1200 500 550 $flingtime"
58 DOWN="500 550 500 1200 $flingtime";;
63 UP="70 400 70 70 $flingtime"
64 DOWN="70 70 70 400 $flingtime";;
66 echo "Error: No display information available for $DEVICE"
71 if [ $startapps -gt 0 ]; then
73 # start a bunch of apps
76 echo Starting $app ...
77 t=$(startActivity $app)
83 while [ $count -lt $2 ]
102 while [ $cur -le $iterations ]
104 if [ $capturesystrace -gt 0 ]; then
105 ${ADB}atrace --async_start -z -c -b 16000 freq gfx view idle sched
107 doKeyevent APP_SWITCH
109 swipe "$DOWN" $downCount
113 swipe "$DOWN" $downCount
117 if [ $capturesystrace -gt 0 ]; then
118 ${ADB}atrace --async_dump -z -c -b 16000 freq gfx view idle sched > trace.${cur}.out
123 set -- $(getJankyFrames)
129 if [ ${totalDiff:=0} -eq 0 ]; then
130 echo Error: could not read frame info with \"dumpsys gfxinfo\"
133 ((frameSum=frameSum+totalDiff))
134 ((jankSum=jankSum+jankyDiff))
135 ((latency90Sum=latency90Sum+latency90))
136 ((latency95Sum=latency95Sum+latency95))
137 ((latency99Sum=latency99Sum+latency99))
138 if [ "$totalDiff" -eq 0 ]; then
139 echo Error: no frames detected. Is the display off?
141 ((jankPct=jankyDiff*100/totalDiff))
144 echo Frames: $totalDiff latency: $latency90/$latency95/$latency99 Janks: $jankyDiff\(${jankPct}%\)
148 ((aveJankPct=jankSum*100/frameSum))
149 ((aveJanks=jankSum/iterations))
150 ((aveFrames=frameSum/iterations))
151 ((aveLatency90=latency90Sum/iterations))
152 ((aveLatency95=latency95Sum/iterations))
153 ((aveLatency99=latency99Sum/iterations))
154 echo AVE: Frames: $aveFrames latency: $aveLatency90/$aveLatency95/$aveLatency99 Janks: $aveJanks\(${aveJankPct}%\)