summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Kjos <tkjos@google.com>2015-06-05 13:28:46 -0700
committerTodd Kjos <tkjos@google.com>2015-06-05 13:36:54 -0700
commitae1f93cc3cef9c8c790330dd09f2ff87bf38eabc (patch)
tree478383d85bc02929c6099a1129cebee62ae659e8
parentaf02e8aa9164f723a0c2a421a97c227c5adff4c2 (diff)
downloadextras-ae1f93cc3cef9c8c790330dd09f2ff87bf38eabc.tar.gz
Enhancements to workload scripts
- display frame latencies (90th/95th/99th) for recents and systemapps - allow device type to be specified to capture - workaround for am hang when starting chrome on volantis - bullhead support for recentfling New output of "recentfling.sh": Fling recents... Frames: 772 latency: 19/22/34 Janks: 131(16%) New output of "systemapps.sh -T": App Start(ms) Iter(ms) Jank Latency gmail 1090 2168 69(72%) 65/75/88 hangouts 1757 2758 60(82%) 69/111/114 chrome 0 997 59(64%) 68/77/84 youtube 3533 4834 140(48%) 70/93/150 play 1868 3147 92(62%) 89/106/182 home 0 1125 210(15%) 62/84/129 TOTAL 8248 35052 Change-Id: If4fc94ab0188dae2afabfbf696be06b6ddf55ce1
-rwxr-xr-xtests/workloads/capture.sh22
-rwxr-xr-xtests/workloads/defs.sh74
-rwxr-xr-xtests/workloads/recentfling.sh64
-rwxr-xr-xtests/workloads/systemapps.sh126
4 files changed, 188 insertions, 98 deletions
diff --git a/tests/workloads/capture.sh b/tests/workloads/capture.sh
index 721fe8c8..3b2f446e 100755
--- a/tests/workloads/capture.sh
+++ b/tests/workloads/capture.sh
@@ -5,12 +5,24 @@
# do a throw-away adb in case the server is out-of-date
adb devices -l 2>&1 >/dev/null
-devInfo=$(adb devices -l | grep -v ^List | head -1)
-set -- $devInfo
-echo devInfo=$devInfo
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ (-d) DEVICE=$2; shift;;
+ (*)
+ echo Unknown option $1
+ exit 1;;
+ esac
+ shift
+done
-DEVICE=$(echo $4 | sed 's/product://')
+if [ "$DEVICE" = "" ]; then
+ devInfo=$(adb devices -l | grep -v ^List | head -1)
+ set -- $devInfo
+ echo devInfo=$devInfo
+ DEVICE=$(echo $4 | sed 's/product://')
+fi
function convert {
in=$1
@@ -26,7 +38,7 @@ function convert {
case $DEVICE in
-(shamu|hammerhead)
+(shamu|hammerhead|bullhead)
# no scaling necessary
xmax=0
ymax=0;;
diff --git a/tests/workloads/defs.sh b/tests/workloads/defs.sh
index ba820fd6..dbed4dd7 100755
--- a/tests/workloads/defs.sh
+++ b/tests/workloads/defs.sh
@@ -12,6 +12,7 @@ generateActivities=0
gmailActivity='com.google.android.gm/com.google.android.gm.ConversationListActivityGmail'
hangoutsActivity='com.google.android.talk/com.google.android.talk.SigningInActivity'
chromeActivity='com.android.chrome/com.google.android.apps.chrome.document.DocumentActivity'
+chromeActivityVolantis='com.android.chrome/com.google.android.apps.chrome.ChromeTabbedActivity'
youtubeActivity='com.google.android.youtube/com.google.android.apps.youtube.app.WatchWhileActivity'
cameraActivity='com.google.android.GoogleCamera/com.android.camera.CameraActivity'
playActivity='com.android.vending/com.google.android.finsky.activities.MainActivity'
@@ -95,6 +96,9 @@ else
ADB="adb -s $deviceName shell "
DEVICE=$(echo $4 | sed 's/product://')
isOnDevice=0
+ if [ "$DEVICE" = volantis ]; then
+ chromeActivity=$chromeActivityVolantis
+ fi
fi
# default values if not set by options or calling script
@@ -208,37 +212,41 @@ function getEndTime {
}
function resetJankyFrames {
- ${ADB}dumpsys gfxinfo $1 reset 2>&1 >/dev/null
+ _gfxapp=$1
+ _gfxapp=${app:="com.android.systemui"}
+ ${ADB}dumpsys gfxinfo $_gfxapp reset 2>&1 >/dev/null
}
function getJankyFrames {
- if [ -z "$ADB" ]; then
- # Note: no awk or sed on devices so have to do this
- # purely with bash
- total=0
- janky=0
- /system/bin/dumpsys gfxinfo | grep " frames" | while read line
- do
- if echo $line | grep -q "Total frames"; then
- set -- $line
- ((total=total+$4))
- elif echo $line | grep -q "Janky frames"; then
- set -- $line
- ((janky=janky+$3))
- fi
- # Note: no tail, awk, or sed on 5.x so get final
- # sum via most recently written file
- echo $total $janky > ./janky.$$
- done
- cat ./janky.$$
- rm -f ./janky.$$
- else
- ${ADB}dumpsys gfxinfo $1 | sed -e 's/ //' | awk '
- BEGIN { total=0; janky=0; }
- /Total frames/ { total+=$4; }
- /Janky frames/ { janky+=$3; }
- END { printf "%d %d\n", total, janky; }'
- fi
+ _gfxapp=$1
+ _gfxapp=${_gfxapp:="com.android.systemui"}
+
+ # Note: no awk or sed on devices so have to do this
+ # purely with bash
+ total=0
+ janky=0
+ latency=0
+ ${ADB}dumpsys gfxinfo $_gfxapp | tr "\r" " " | egrep "9[059]th| frames" | while read line
+ do
+ if echo $line | grep -q "Total frames"; then
+ set -- $line
+ total=$4
+ elif echo $line | grep -q "Janky frames"; then
+ set -- $line
+ janky=$3
+ elif echo $line | grep -q "90th"; then
+ set -- $(echo $line | tr m " ")
+ l90=$3
+ elif echo $line | grep -q "95th"; then
+ set -- $(echo $line | tr m " ")
+ l95=$3
+ elif echo $line | grep -q "99th"; then
+ set -- $(echo $line | tr m " ")
+ l99=$3
+ echo $total $janky $l90 $l95 $l99
+ break
+ fi
+ done
}
function checkForDirectReclaim {
@@ -332,8 +340,14 @@ function startActivity {
echo 0
return 0
elif [ "$1" = chrome ]; then
- vout $AM_START -p "$(getPackageName $1)" http://www.theverge.com
- set -- $($AM_START -p "$(getPackageName $1)" http://www.theverge.com | grep ThisTime)
+ if [ "$DEVICE" = volantis ]; then
+ vout $AM_START_NOWAIT -p "$(getPackageName $1)" http://www.theverge.com
+ $AM_START_NOWAIT -p "$(getPackageName $1)" http://www.theverge.com > /dev/null
+ set -- 0 0
+ else
+ vout $AM_START -p "$(getPackageName $1)" http://www.theverge.com
+ set -- $($AM_START -p "$(getPackageName $1)" http://www.theverge.com | grep ThisTime)
+ fi
else
vout $AM_START "$(getActivityName $1)"
set -- $($AM_START "$(getActivityName $1)" | grep ThisTime)
diff --git a/tests/workloads/recentfling.sh b/tests/workloads/recentfling.sh
index 68fdb2ff..092c8d92 100755
--- a/tests/workloads/recentfling.sh
+++ b/tests/workloads/recentfling.sh
@@ -44,6 +44,12 @@ case $DEVICE in
upCount=6
UP="70 400 70 100 $flingtime"
DOWN="70 100 70 400 $flingtime";;
+(bullhead)
+ flingtime=200
+ downCount=5
+ upCount=5
+ UP="500 1200 500 550 $flingtime"
+ DOWN="500 550 500 1200 $flingtime";;
(volantis)
flingtime=400
downCount=5
@@ -66,20 +72,6 @@ if [ $startapps -gt 0 ]; then
done
fi
-cur=1
-
-set -- $(getJankyFrames)
-totalFrames=$1
-jankyFrames=$2
-frameSum=0
-jankSum=0
-
-if [ ${totalFrames:=0} -eq 0 ]; then
-#echo Error: could not read frame info with \"dumpsys graphicsstats\"
- echo Error: could not read frame info with \"dumpsys gfxinfo\"
- exit 1
-fi
-
function swipe {
count=0
while [ $count -lt $2 ]
@@ -89,14 +81,25 @@ function swipe {
done
}
+cur=1
+frameSum=0
+jankSum=0
+latency90Sum=0
+latency95Sum=0
+latency99Sum=0
+
echo Fling recents...
-doKeyevent APP_SWITCH
+doKeyevent HOME
+sleep 0.5
+resetJankyFrames
while [ $cur -le $iterations ]
do
if [ $capturesystrace -gt 0 ]; then
${ADB}atrace --async_start -z -c -b 16000 freq gfx view idle sched
fi
+ doKeyevent APP_SWITCH
+ sleep 0.5
swipe "$DOWN" $downCount
sleep 1
swipe "$UP" $upCount
@@ -108,25 +111,40 @@ do
if [ $capturesystrace -gt 0 ]; then
${ADB}atrace --async_dump -z -c -b 16000 freq gfx view idle sched > trace.${cur}.out
fi
+ doKeyevent HOME
+ sleep 0.5
set -- $(getJankyFrames)
- newTotalFrames=$1
- newJankyFrames=$2
- ((totalDiff=newTotalFrames-totalFrames))
+ totalDiff=$1
+ jankyDiff=$2
+ latency90=$3
+ latency95=$4
+ latency99=$5
+ if [ ${totalDiff:=0} -eq 0 ]; then
+ echo Error: could not read frame info with \"dumpsys gfxinfo\"
+ exit 1
+ fi
+
((frameSum=frameSum+totalDiff))
- ((jankyDiff=newJankyFrames-jankyFrames))
((jankSum=jankSum+jankyDiff))
+ ((latency90Sum=latency90Sum+latency90))
+ ((latency95Sum=latency95Sum+latency95))
+ ((latency99Sum=latency99Sum+latency99))
if [ "$totalDiff" -eq 0 ]; then
echo Error: no frames detected. Is the display off?
exit 1
fi
((jankPct=jankyDiff*100/totalDiff))
- totalFrames=$newTotalFrames
- jankyFrames=$newJankyFrames
+ resetJankyFrames
- echo Frames: $totalDiff Janks: $jankyDiff \(${jankPct}%\)
+ echo Frames: $totalDiff latency: $latency90/$latency95/$latency99 Janks: $jankyDiff\(${jankPct}%\)
((cur=cur+1))
done
doKeyevent HOME
((aveJankPct=jankSum*100/frameSum))
-echo AVE: Frames: $frameSum Janks: $jankSum \(${aveJankPct}%\)
+((aveJanks=jankSum/iterations))
+((aveFrames=frameSum/iterations))
+((aveLatency90=latency90Sum/iterations))
+((aveLatency95=latency95Sum/iterations))
+((aveLatency99=latency99Sum/iterations))
+echo AVE: Frames: $aveFrames latency: $aveLatency90/$aveLatency95/$aveLatency99 Janks: $aveJanks\(${aveJankPct}%\)
diff --git a/tests/workloads/systemapps.sh b/tests/workloads/systemapps.sh
index 184c4ee4..bd971488 100755
--- a/tests/workloads/systemapps.sh
+++ b/tests/workloads/systemapps.sh
@@ -74,6 +74,9 @@ function computeStats {
reclaim=$4
frames=$5
janks=$6
+ l90=$7
+ l95=$8
+ l99=$9
curMax=$(eval "echo \$${label}max")
curMax=${curMax:=0}
curMin=$(eval "echo \$${label}min")
@@ -88,6 +91,12 @@ function computeStats {
curFrames=${curFrames:=0}
curJanks=$(eval "echo \$${label}janks")
curJanks=${curJanks:=0}
+ cur90=$(eval "echo \$${label}90")
+ cur90=${cur90:=0}
+ cur95=$(eval "echo \$${label}95")
+ cur95=${cur95:=0}
+ cur99=$(eval "echo \$${label}99")
+ cur99=${cur99:=0}
if [ $curMax -lt $t ]; then
eval "${label}max=$t"
fi
@@ -105,12 +114,19 @@ function computeStats {
eval "${label}frames=$curFrames"
((curJanks=curJanks+${janks:=0}))
eval "${label}janks=$curJanks"
+ ((cur90=cur90+${l90:=0}))
+ eval "${label}90=$cur90"
+ ((cur95=cur95+${l95:=0}))
+ eval "${label}95=$cur95"
+ ((cur99=cur99+${l99:=0}))
+ eval "${label}99=$cur99"
}
function getStats {
label=$1
echo $(eval "echo \$${label}max") $(eval "echo \$${label}min") $(eval "echo \$${label}sum") \
$(eval "echo \$${label}restart") $(eval "echo \$${label}reclaim") \
- $(eval "echo \$${label}frames") $(eval "echo \$${label}janks")
+ $(eval "echo \$${label}frames") $(eval "echo \$${label}janks") \
+ $(eval "echo \$${label}90") $(eval "echo \$${label}95") $(eval "echo \$${label}99")
}
cur=1
@@ -126,7 +142,7 @@ do
fi
if [ $iterations -gt 1 -o $cur -eq 1 ]; then
if [ $totaltimetest -eq 0 ]; then
- printf "%-6s %7s(ms) %6s(ms) %s %s %s %s\n" App Time AmTime Restart DirReclaim JankyFrames
+ printf "%-6s %7s(ms) %6s(ms) %s %s %s %s\n" App Time AmTime Restart DirReclaim Jank Latency
fi
fi
@@ -136,53 +152,77 @@ do
vout Starting $app...
((appnum=appnum+1))
loopTimestamp=$(date +"%s %N")
- if [ $totaltimetest -gt 0 ]; then
- # no instramentation, just cycle through the apps
+ resetJankyFrames
+ resetJankyFrames $(getPackageName $app)
+ if [ $totaltimetest -eq 0 ]; then
+ tmpTraceOut="$tmpTraceOutBase-$app.out"
+ >$tmpTraceOut
+ startInstramentation
+ else
if [ $appnum -eq 0 ]; then
- printf "%-8s %5s(ms) %3s(ms)\n" App Start Iter
- fi
- if [ $forcecoldstart -eq 0 ]; then
- t=$(startActivity $app)
- else
- t=$(forceStartActivity $app)
+ printf "%-8s %5s(ms) %3s(ms) %s %s\n" App Start Iter Jank Latency
fi
- loopEndTimestamp=$(date +"%s %N")
- diffTime=$(computeTimeDiff $loopTimestamp $loopEndTimestamp)
- # Note: "%d" doesn't work right if run on device
- printf "%-10s %5.0f %5.0f\n" $app $t $diffTime
- ((totaltime=totaltime+t))
- continue
fi
- tmpTraceOut="$tmpTraceOutBase-$app.out"
- >$tmpTraceOut
- startInstramentation
- resetJankyFrames $(getPackageName $app)
- t=$(startActivity $app)
+ if [ $forcecoldstart -eq 0 ]; then
+ t=$(startActivity $app)
+ else
+ t=$(forceStartActivity $app)
+ fi
+
+ loopEndTimestamp=$(date +"%s %N")
+ diffTime=$(computeTimeDiff $loopTimestamp $loopEndTimestamp)
# let app finish drawing before checking janks
sleep 3
set -- $(getJankyFrames $(getPackageName $app))
frames=$1
janks=$2
- ((jankPct=100*janks/frames))
- stopAndDumpInstramentation $tmpTraceOut
- actName=$(getActivityName $app)
- stime=$(getStartTime $actName $tmpTraceOut)
- relaunch=$?
- etime=$(getEndTime $actName $tmpTraceOut)
- ((tdiff=$etime-$stime))
- if [ $etime -eq 0 -o $stime -eq 0 ]; then
- handleError $app : could not compute start time stime=$stime etime=$etime
- # use AmTime so statistics make sense
- tdiff=$t
+ l90=$3
+ l95=$4
+ l99=$5
+ set -- $(getJankyFrames)
+ systemFrames=$1
+ systemJanks=$2
+ s90=$3
+ s95=$4
+ s99=$5
+ ((frames=frames+systemFrames))
+ ((janks=janks+systemJanks))
+ ((l90=l90+s90))
+ ((l95=l95+s95))
+ ((l99=l99+s99))
+ if [ $frames -eq 0 ]; then
+ janks=0
+ jankPct=0
+ else
+ ((jankPct=100*janks/frames))
fi
- checkForDirectReclaim $actName $tmpTraceOut
- directReclaim=$?
+ if [ $totaltimetest -gt 0 ]; then
+ # Note: using %f since %d doesn't work correctly
+ # when running on lollipop
+ printf "%-10s %5.0f %5.0f %4.0f(%2.0f%%) %2.0f/%2.0f/%2.0f\n" $app $t $diffTime $janks $jankPct $l90 $l95 $l99
+ ((totaltime=totaltime+t))
+ continue
+ else
+ stopAndDumpInstramentation $tmpTraceOut
+ actName=$(getActivityName $app)
+ stime=$(getStartTime $actName $tmpTraceOut)
+ relaunch=$?
+ etime=$(getEndTime $actName $tmpTraceOut)
+ ((tdiff=$etime-$stime))
+ if [ $etime -eq 0 -o $stime -eq 0 ]; then
+ handleError $app : could not compute start time stime=$stime etime=$etime
+ # use AmTime so statistics make sense
+ tdiff=$t
+ fi
+ checkForDirectReclaim $actName $tmpTraceOut
+ directReclaim=$?
- printf "%-12s %5d %5d %5d %5d %5d(%d%%)\n" "$app" "$tdiff" "$t" "$relaunch" "$directReclaim" "$janks" "$jankPct"
- computeStats "$app" "$tdiff" "$relaunch" "$directReclaim" "$frames" "$janks"
+ printf "%-12s %5d %5d %5d %5d %5d(%d%%) %d/%d/%d\n" "$app" "$tdiff" "$t" "$relaunch" "$directReclaim" "$janks" "$jankPct" $l90 $l95 $l99
+ computeStats "$app" "$tdiff" "$relaunch" "$directReclaim" "$frames" "$janks" $l90 $l95 $l99
- if [ $savetmpfiles -eq 0 ]; then
- rm -f $tmpTraceOut
+ if [ $savetmpfiles -eq 0 ]; then
+ rm -f $tmpTraceOut
+ fi
fi
done
((cur=cur+1))
@@ -198,7 +238,7 @@ if [ $iterations -gt 1 -a $totaltimetest -eq 0 ]; then
echo =========================================
printf "Stats after $iterations iterations:\n"
echo =========================================
- printf "%-6s %7s(ms) %6s(ms) %6s(ms) %s %s %s %s\n" App Max Ave Min Restart DirReclaim JankyFrames
+ printf "%-6s %7s(ms) %6s(ms) %6s(ms) %s %s %s %s\n" App Max Ave Min Restart DirReclaim Jank Latency
for app in $appList
do
set -- $(getStats $app)
@@ -206,7 +246,13 @@ if [ $iterations -gt 1 -a $totaltimetest -eq 0 ]; then
((ave=sum/iterations))
frames=$6
janks=$7
+ l90=$8
+ l95=$9
+ l99=${10}
+ ((ave90=l90/iterations))
+ ((ave95=l95/iterations))
+ ((ave99=l99/iterations))
((jankPct=100*janks/frames))
- printf "%-12s %5d %5d %5d %5d %5d %5d(%d%%)\n" $app $1 $ave $2 $4 $5 $janks $jankPct
+ printf "%-12s %5d %5d %5d %5d %5d %5d(%d%%) %d/%d/%d\n" $app $1 $ave $2 $4 $5 $janks $jankPct $ave90 $ave95 $ave99
done
fi