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;;
21 (-B) echo $$ > /dev/cpuset/background/tasks;;
23 echo "$0: unrecognized option: $1"
24 echo; echo "Usage: $0 [options]"
25 echo "-A : use all known applications"
26 echo "-B : run in background cpuset"
27 echo "-L applist : list of applications"
28 echo " default: $appList"
29 echo "-N : no app startups, just fling"
30 echo "-g : generate activity strings"
32 echo "-T : capture systrace on each iteration"
38 CMDDIR=$(dirname $0 2>/dev/null)
47 UP="70 400 70 100 $flingtime"
48 DOWN="70 100 70 400 $flingtime";;
49 (angler|ariel|mtp8996)
53 UP="500 1200 500 550 $flingtime"
54 DOWN="500 550 500 1200 $flingtime";;
59 UP="500 1200 500 550 $flingtime"
60 DOWN="500 550 500 1200 $flingtime";;
65 UP="70 400 70 70 $flingtime"
66 DOWN="70 70 70 400 $flingtime";;
68 echo "Error: No display information available for $DEVICE"
73 if [ $startapps -gt 0 ]; then
75 # start a bunch of apps
78 echo Starting $app ...
79 t=$(startActivity $app)
85 while [ $count -lt $2 ]
104 while [ $cur -le $iterations ]
106 if [ $capturesystrace -gt 0 ]; then
107 ${ADB}atrace --async_start -z -c -b 16000 freq gfx view idle sched
109 doKeyevent APP_SWITCH
111 swipe "$DOWN" $downCount
115 swipe "$DOWN" $downCount
119 if [ $capturesystrace -gt 0 ]; then
120 ${ADB}atrace --async_dump -z -c -b 16000 freq gfx view idle sched > trace.${cur}.out
125 set -- $(getJankyFrames)
131 if [ ${totalDiff:=0} -eq 0 ]; then
132 echo Error: could not read frame info with \"dumpsys gfxinfo\"
135 ((frameSum=frameSum+totalDiff))
136 ((jankSum=jankSum+jankyDiff))
137 ((latency90Sum=latency90Sum+latency90))
138 ((latency95Sum=latency95Sum+latency95))
139 ((latency99Sum=latency99Sum+latency99))
140 if [ "$totalDiff" -eq 0 ]; then
141 echo Error: no frames detected. Is the display off?
143 ((jankPct=jankyDiff*100/totalDiff))
146 echo Frames: $totalDiff latency: $latency90/$latency95/$latency99 Janks: $jankyDiff\(${jankPct}%\)
150 ((aveJankPct=jankSum*100/frameSum))
151 ((aveJanks=jankSum/iterations))
152 ((aveFrames=frameSum/iterations))
153 ((aveLatency90=latency90Sum/iterations))
154 ((aveLatency95=latency95Sum/iterations))
155 ((aveLatency99=latency99Sum/iterations))
156 echo AVE: Frames: $aveFrames latency: $aveLatency90/$aveLatency95/$aveLatency99 Janks: $aveJanks\(${aveJankPct}%\)