summaryrefslogtreecommitdiff
path: root/app-launcher
diff options
context:
space:
mode:
authorMaggie White <maggiewhite@google.com>2017-06-21 17:42:25 -0700
committerMaggie White <maggiewhite@google.com>2017-06-26 11:17:08 -0700
commit5d58ea1a2253b447dc6b15a3a52ed7b790119c17 (patch)
tree1f30c41b66dffb0d1b14ad4c619d8c3dba015b0b /app-launcher
parent797cdee07445d47309a4623cd172daf7836328c4 (diff)
downloadextras-5d58ea1a2253b447dc6b15a3a52ed7b790119c17.tar.gz
Added setup commands and option to specify device
The script previously did not configure any framework settings for this script, so I added commands to disable any features that could affect the performance numbers like wifi, NFC, screen rotation. It also clears notifications and starts the device on the home screen. It's not possible prior to this commit to run the app-launcher on a host with multiple devices attached to adb, so I added a '-s <serial number' option that allows the user to specify a specific device based on its serial number. I also changed the spacing of the script to be all spaces instead of mixed tabs and spaces. Test: Manually ran script on a marlin device Change-Id: I82c621fe280033c55ba38bfdf95836fd95f5ed58
Diffstat (limited to 'app-launcher')
-rw-r--r--app-launcher/README6
-rwxr-xr-xapp-launcher/app-launcher425
2 files changed, 260 insertions, 171 deletions
diff --git a/app-launcher/README b/app-launcher/README
index cca58aa5..238350e5 100644
--- a/app-launcher/README
+++ b/app-launcher/README
@@ -6,13 +6,15 @@ measures various system metrics, computes basic stats for the metrics
and reports that stats.
Launching app-launcher :
-app-launcher -a|-b|-u [-v] num-iterations
+app-launcher -a|-b|-u [-c|-v|-s <serial number>] num-iterations
-a:Run on all cores
-b:Run only big cores
-c:pagecached. Don't drop pagecache before each launch (not default)
-h:Dump help menu'
-u:user experience, no change to cpu/gpu frequencies or governors'
--v : Optional, Verbose mode, prints stats on a lot of metrics.
+-v:Optional, Verbose mode, prints stats on a lot of metrics.
+-s <serial number>:Optional, specify serial number if multiple devices are
+ attached to host
num-iterations : Must be >= 100 to get statistically valid data.
Note, under -a|-b, we lock the CPU and GPU frequencies.
diff --git a/app-launcher/app-launcher b/app-launcher/app-launcher
index f02b3dcc..c9e4c8a4 100755
--- a/app-launcher/app-launcher
+++ b/app-launcher/app-launcher
@@ -7,36 +7,44 @@ parseoptions() {
iterations=0
pagecached=false
+ adb="adb"
while [ $# -gt 1 ]
do
- case $1 in
- -a)
- ;;
- -b)
- little_cores_off=true
- ;;
- -c)
- pagecached=true
- ;;
- -h)
- usage
- ;;
- -u)
- user_experience=true
- ;;
- -v)
- verbose=true
- ;;
- *)
- usage
- ;;
- esac
- shift
+ case $1 in
+ -a)
+ ;;
+ -b)
+ little_cores_off=true
+ ;;
+ -c)
+ pagecached=true
+ ;;
+ -h)
+ usage
+ ;;
+ -s)
+ if [ -z $2 ]; then
+ usage
+ fi
+ adb="adb -s $2"
+ shift
+ ;;
+ -u)
+ user_experience=true
+ ;;
+ -v)
+ verbose=true
+ ;;
+ *)
+ usage
+ ;;
+ esac
+ shift
done
iterations=$1
if [ $iterations -lt 100 ]; then
- usage
+ usage
fi
}
@@ -66,32 +74,32 @@ getstats () {
fgrep 'Sys CPU util' $infile | awk '{print $5}' | computestatsf
if [ $verbose == true ]; then
- echo "instructions : "
- fgrep instructions $infile | awk '{print $1}' | sed s/,//g | computestats
+ echo "instructions : "
+ fgrep instructions $infile | awk '{print $1}' | sed s/,//g | computestats
- echo "cycles per instruction : "
- fgrep instructions $infile | awk '{print $4}' | sed s/,//g | computestatsf
+ echo "cycles per instruction : "
+ fgrep instructions $infile | awk '{print $4}' | sed s/,//g | computestatsf
- echo "branch-misses : "
- fgrep branch-misses $infile | awk '{print $1}' | sed s/,//g | computestats
+ echo "branch-misses : "
+ fgrep branch-misses $infile | awk '{print $1}' | sed s/,//g | computestats
- echo "context-switches : "
- fgrep context-switches $infile | awk '{print $1}' | sed s/,//g | computestats
+ echo "context-switches : "
+ fgrep context-switches $infile | awk '{print $1}' | sed s/,//g | computestats
- echo "page-faults : "
- fgrep page-faults $infile | awk '{print $1}' | sed s/,//g | computestats
+ echo "page-faults : "
+ fgrep page-faults $infile | awk '{print $1}' | sed s/,//g | computestats
fi
if [ $system_bdev_set == true ]; then
- # (Storage) Data from /proc we've collected
- echo "KB read for $system_block_device blkdev :"
- fgrep KB $infile | grep system | awk '{print $5}' | computestats
+ # (Storage) Data from /proc we've collected
+ echo "KB read for $system_block_device blkdev :"
+ fgrep KB $infile | grep system | awk '{print $5}' | computestats
- echo "iowait% :"
- fgrep IOwait $infile | awk '{print $3}' | computestatsf
+ echo "iowait% :"
+ fgrep IOwait $infile | awk '{print $3}' | computestatsf
- echo "Device util% for $system_block_device blkdev :"
- fgrep 'Device util' $infile | awk '{print $4}' | computestatsf
+ echo "Device util% for $system_block_device blkdev :"
+ fgrep 'Device util' $infile | awk '{print $4}' | computestatsf
fi
}
@@ -105,9 +113,9 @@ cpufreq_volantis() {
num_cores=2
while [ $i -lt $num_cores ]
do
- adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_g\
+ $adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_g\
overnor"
- adb shell "echo 2499000 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_fr\
+ $adb shell "echo 2499000 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_fr\
eq"
i=`expr $i + 1`
done
@@ -119,89 +127,135 @@ eq"
cpufreq_fugu() {
echo "Setting Governor to performance"
if [ $little_cores_off == true ]; then
- echo "Cannot turn off Little cores on $model"
- exit 1
+ echo "Cannot turn off Little cores on $model"
+ exit 1
fi
i=0
num_cores=4
while [ $i -lt $num_cores ]
do
- adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
- adb shell "echo 1833000 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
- i=`expr $i + 1`
+ $adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
+ $adb shell "echo 1833000 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
+ i=`expr $i + 1`
done
}
+cpufreq_taimen_walleye () {
+ echo "Setting Governor to performance"
+ # GPU Governor and Frequency
+ $adb shell 'echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor'
+ $adb shell 'echo 624000000 > /sys/class/kgsl/kgsl-3d0/devfreq/max_freq'
+ if [ $little_cores_off == true ]; then
+ # Disable Little Cores, force app to run on big cores
+ echo "Disabling Little Cores"
+ $adb shell 'echo 0 > /sys/devices/system/cpu/cpu0/online'
+ $adb shell 'echo 0 > /sys/devices/system/cpu/cpu1/online'
+ $adb shell 'echo 0 > /sys/devices/system/cpu/cpu2/online'
+ $adb shell 'echo 0 > /sys/devices/system/cpu/cpu3/online'
+ else
+ echo "Enabling All Cores"
+ $adb shell 'echo 1 > /sys/devices/system/cpu/cpu0/online'
+ $adb shell 'echo 1 > /sys/devices/system/cpu/cpu1/online'
+ $adb shell 'echo 1 > /sys/devices/system/cpu/cpu2/online'
+ $adb shell 'echo 1 > /sys/devices/system/cpu/cpu3/online'
+ $adb shell 'echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor'
+ $adb shell 'echo 1900800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq'
+ fi
+ # Set Governor to performance, up scaling_max_frequency to highest
+ $adb shell 'echo performance > /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor'
+ # Only necessary to set max_freq on cpu4, cpu5-7 are in same cluster and will
+ # automatically get the same settings
+ $adb shell 'echo 2457600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq'
+}
+
cpufreq_marlin_sailfish () {
echo "Setting Governor to performance"
# GPU Governor and Frequency
- adb shell 'echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor'
- adb shell 'echo 624000000 > /sys/class/kgsl/kgsl-3d0/devfreq/max_freq'
+ $adb shell 'echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor'
+ $adb shell 'echo 624000000 > /sys/class/kgsl/kgsl-3d0/devfreq/max_freq'
if [ $little_cores_off == true ]; then
- # Disable Little Cores, force app to run on big cores
- echo "Disabling Little Cores"
- adb shell 'echo 0 > /sys/devices/system/cpu/cpu0/online'
- adb shell 'echo 0 > /sys/devices/system/cpu/cpu1/online'
+ # Disable Little Cores, force app to run on big cores
+ echo "Disabling Little Cores"
+ $adb shell 'echo 0 > /sys/devices/system/cpu/cpu0/online'
+ $adb shell 'echo 0 > /sys/devices/system/cpu/cpu1/online'
else
- echo "Enabling All Cores"
- adb shell 'echo 1 > /sys/devices/system/cpu/cpu0/online'
- adb shell 'echo 1 > /sys/devices/system/cpu/cpu1/online'
- adb shell 'echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor'
- adb shell 'echo 1996800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq'
- # cpu1 needed ?
- adb shell 'echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor'
- adb shell 'echo 1996800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq'
+ echo "Enabling All Cores"
+ $adb shell 'echo 1 > /sys/devices/system/cpu/cpu0/online'
+ $adb shell 'echo 1 > /sys/devices/system/cpu/cpu1/online'
+ $adb shell 'echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor'
+ $adb shell 'echo 1996800 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq'
+ # cpu1 needed ?
+ $adb shell 'echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor'
+ $adb shell 'echo 1996800 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq'
fi
# Set Governor to performance, up scaling_max_frequency to highest
- adb shell 'echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor'
+ $adb shell 'echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor'
# Only necessary to set max_freq on cpu2, cpu3 is in same cluster and will
# automatically get the same settings
- adb shell 'echo 2150400 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq'
+ $adb shell 'echo 2150400 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq'
}
cpufreq_angler () {
echo "Setting Governor and Frequency"
# GPU Governor and Frequency
- adb shell "echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor"
- adb shell "echo 0 > /sys/class/kgsl/kgsl-3d0/bus_split"
- adb shell "echo 1 > /sys/class/kgsl/kgsl-3d0/force_clk_on"
- adb shell "echo 10000 > /sys/class/kgsl/kgsl-3d0/idle_timer"
+ $adb shell "echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor"
+ $adb shell "echo 0 > /sys/class/kgsl/kgsl-3d0/bus_split"
+ $adb shell "echo 1 > /sys/class/kgsl/kgsl-3d0/force_clk_on"
+ $adb shell "echo 10000 > /sys/class/kgsl/kgsl-3d0/idle_timer"
if [ $little_cores_off == true ]; then
- # Disable Little Cores, force app to run on big cores
- echo "Disabling Little Cores"
- i=0
- num_cores=4
- while [ $i -lt $num_cores ]
- do
- adb shell "echo 0 > /sys/devices/system/cpu/cpu$i/online"
- i=`expr $i + 1`
- done
+ # Disable Little Cores, force app to run on big cores
+ echo "Disabling Little Cores"
+ i=0
+ num_cores=4
+ while [ $i -lt $num_cores ]
+ do
+ $adb shell "echo 0 > /sys/devices/system/cpu/cpu$i/online"
+ i=`expr $i + 1`
+ done
else
- echo "Enabling All Cores"
- # Enable Little cores here, set governor to performance
- # Lock frequency of little cores
- i=0
- num_cores=4
- while [ $i -lt $num_cores ]
- do
- adb shell "echo 1 > /sys/devices/system/cpu/cpu$i/online"
- adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
- # Lock frequency of little cores
- adb shell "echo 1555200 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
- i=`expr $i + 1`
- done
+ echo "Enabling All Cores"
+ # Enable Little cores here, set governor to performance
+ # Lock frequency of little cores
+ i=0
+ num_cores=4
+ while [ $i -lt $num_cores ]
+ do
+ $adb shell "echo 1 > /sys/devices/system/cpu/cpu$i/online"
+ $adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
+ # Lock frequency of little cores
+ $adb shell "echo 1555200 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
+ i=`expr $i + 1`
+ done
fi
i=4
num_cores=8
while [ $i -lt $num_cores ]
do
- adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
- # Lock frequency of big cores
- adb shell "echo 1958400 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
- i=`expr $i + 1`
+ $adb shell "echo performance > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_governor"
+ # Lock frequency of big cores
+ $adb shell "echo 1958400 > /sys/devices/system/cpu/cpu$i/cpufreq/scaling_max_freq"
+ i=`expr $i + 1`
done
}
+get_taimen_walleye_devnames () {
+ # This bit of code required to get the block dev for /system and /vendor
+ # Suffix can be _a or _b, depending on what the active /system partition is
+# suffix=`$adb shell getprop ro.boot.slot_suffix`
+ # Get the blockdevice using the suffix we got above
+# system_block_device=`$adb shell ls -l /dev/block/platform/soc/*ufs*/by-name/system$suffix | awk '{ print $10 }' `
+ # Vendor is more straightforward, but we don't use it right now
+# vendor_block_device=`$adb shell df /vendor | grep -v Filesystem | awk '{print $1}' `
+ # finally extract the last component of the absolute device pathname we got above
+# system_block_device=`echo $system_block_device | awk 'BEGIN { FS ="/" } ; { print $4 }' `
+# vendor_block_device=`echo $vendor_block_device | awk 'BEGIN { FS ="/" } ; { print $4 }' `
+ system_bdev_set=true
+# For now, hardcode sda for Marlin/Sailfish block device
+# XXX - We'll get stats for entire device
+ system_block_device=sda
+ echo Block Device $system_block_device
+}
+
#
# This strange bit of logic is needed to get the underlying block devices for /system
# for Marlin/Sailfish
@@ -209,11 +263,11 @@ cpufreq_angler () {
get_marlin_sailfish_devnames () {
# This bit of code required to get the block dev for /system and /vendor
# Suffix can be _a or _b, depending on what the active /system partition is
-# suffix=`adb shell getprop ro.boot.slot_suffix`
+# suffix=`$adb shell getprop ro.boot.slot_suffix`
# Get the blockdevice using the suffix we got above
-# system_block_device=`adb shell ls -l /dev/block/platform/soc/*ufs*/by-name/system$suffix | awk '{ print $10 }' `
+# system_block_device=`$adb shell ls -l /dev/block/platform/soc/*ufs*/by-name/system$suffix | awk '{ print $10 }' `
# Vendor is more straightforward, but we don't use it right now
-# vendor_block_device=`adb shell df /vendor | grep -v Filesystem | awk '{print $1}' `
+# vendor_block_device=`$adb shell df /vendor | grep -v Filesystem | awk '{print $1}' `
# finally extract the last component of the absolute device pathname we got above
# system_block_device=`echo $system_block_device | awk 'BEGIN { FS ="/" } ; { print $4 }' `
# vendor_block_device=`echo $vendor_block_device | awk 'BEGIN { FS ="/" } ; { print $4 }' `
@@ -226,19 +280,19 @@ get_marlin_sailfish_devnames () {
get_angler_devnames () {
# Get the underlying bdev from the "by-name" mapping
- system_block_device=`adb shell 'find /dev/block/platform -name by-name | xargs ls -l' | grep system | awk '{ print $10 }' `
+ system_block_device=`$adb shell 'find /dev/block/platform -name by-name | xargs ls -l' | grep system | awk '{ print $10 }' `
# extract the last component of the absolute device pathname we got above
system_block_device=`echo $system_block_device | awk 'BEGIN { FS ="/" } ; { print $4 }' `
# vendor is unused right now, but get the bdev anyway in case we decide to use it
# Get the underlying bdev from the "by-name" mapping
- vendor_block_device=`adb shell 'find /dev/block/platform -name by-name | xargs ls -l' | grep vendor | awk '{ print $10 }' `
+ vendor_block_device=`$adb shell 'find /dev/block/platform -name by-name | xargs ls -l' | grep vendor | awk '{ print $10 }' `
# extract the last component of the absolute device pathname we got above
vendor_block_device=`echo $vendor_block_device | awk 'BEGIN { FS ="/" } ; { print $4 }' `
system_bdev_set=true
}
get_fugu_devnames () {
- system_block_device=`adb shell ls -l /dev/block/by-name/system | awk '{ print $10 }' `
+ system_block_device=`$adb shell ls -l /dev/block/by-name/system | awk '{ print $10 }' `
system_block_device=`echo $system_block_device | awk 'BEGIN { FS ="/" } ; { print $4 }' `
system_bdev_set=true
}
@@ -251,91 +305,94 @@ get_volantis_devnames () {
system_stats_before() {
if [ $system_bdev_set == true ]; then
- # Get BEFORE read stats for /system
- adb shell 'cat /proc/diskstats' | grep -w $system_block_device > /tmp/$model-system
- BEFORE_RD_IOS_SYSTEM=`awk '{ print $4 }' /tmp/$model-system`
- BEFORE_RD_SECTORS_SYSTEM=`awk '{ print $6 }' /tmp/$model-system`
- # iowait% computation
- adb shell 'cat /proc/stat' | grep -w cpu > /tmp/procstat
- user_ticks_before=`awk '{ print ($2 + $3) }' /tmp/procstat`
- sys_ticks_before=`awk '{ print ($4 + $7 + $8) }' /tmp/procstat`
- cpubusy_ticks_before=`awk '{ print ($2 + $3 + $4 + $7 + $8) }' /tmp/procstat`
- iowait_ticks_before=`awk '{ print $6 }' /tmp/procstat`
- total_ticks_before=`awk '{ print ($2 + $3 + $4 + $5 + $7 + $8) }' /tmp/procstat`
- # Device util% computation
- # Note hz=100, so multiplying uptime (in seconds) by 100, gives us
- # the uptime in hz.
- adb shell 'cat /proc/uptime' > /tmp/uptime
- uptime_before_hz=`awk '{ print ($1 * 100) }' /tmp/uptime`
- # Note that the device (busy) ticks is in ms. Since hz=100, dividing
- # device (busy) ticks by 10, gives us this in the correct ticks units
- device_util_before_hz=`awk '{ print ($13 / 10) }' /tmp/$model-system`
+ # Get BEFORE read stats for /system
+ $adb shell 'cat /proc/diskstats' | grep -w $system_block_device > /tmp/$model-system
+ BEFORE_RD_IOS_SYSTEM=`awk '{ print $4 }' /tmp/$model-system`
+ BEFORE_RD_SECTORS_SYSTEM=`awk '{ print $6 }' /tmp/$model-system`
+ # iowait% computation
+ $adb shell 'cat /proc/stat' | grep -w cpu > /tmp/procstat
+ user_ticks_before=`awk '{ print ($2 + $3) }' /tmp/procstat`
+ sys_ticks_before=`awk '{ print ($4 + $7 + $8) }' /tmp/procstat`
+ cpubusy_ticks_before=`awk '{ print ($2 + $3 + $4 + $7 + $8) }' /tmp/procstat`
+ iowait_ticks_before=`awk '{ print $6 }' /tmp/procstat`
+ total_ticks_before=`awk '{ print ($2 + $3 + $4 + $5 + $7 + $8) }' /tmp/procstat`
+ # Device util% computation
+ # Note hz=100, so multiplying uptime (in seconds) by 100, gives us
+ # the uptime in hz.
+ $adb shell 'cat /proc/uptime' > /tmp/uptime
+ uptime_before_hz=`awk '{ print ($1 * 100) }' /tmp/uptime`
+ # Note that the device (busy) ticks is in ms. Since hz=100, dividing
+ # device (busy) ticks by 10, gives us this in the correct ticks units
+ device_util_before_hz=`awk '{ print ($13 / 10) }' /tmp/$model-system`
fi
}
system_stats_after() {
if [ $system_bdev_set == true ]; then
- # Get AFTER read stats for /system
- adb shell 'cat /proc/diskstats' | grep -w $system_block_device > /tmp/$model-system
- AFTER_RD_IOS_SYSTEM=`awk '{ print $4 }' /tmp/$model-system`
- AFTER_RD_SECTORS_SYSTEM=`awk '{ print $6 }' /tmp/$model-system`
- # iowait% computation
- adb shell 'cat /proc/stat' | grep -w cpu > /tmp/procstat
- user_ticks_after=`awk '{ print ($2 + $3) }' /tmp/procstat`
- sys_ticks_after=`awk '{ print ($4 + $7 + $8) }' /tmp/procstat`
- cpubusy_ticks_after=`awk '{ print ($2 + $3 + $4 + $7 + $8) }' /tmp/procstat`
- iowait_ticks_after=`awk '{ print $6 }' /tmp/procstat`
- total_ticks_after=`awk '{ print ($2 + $3 + $4 + $5 + $7 + $8) }' /tmp/procstat`
- # Device util% computation
- # Note hz=100, so multiplying uptime (in seconds) by 100, gives us
- # the uptime in hz.
- adb shell 'cat /proc/uptime' > /tmp/uptime
- uptime_after_hz=`awk '{ print ($1 * 100) }' /tmp/uptime`
- # Note that the device (busy) ticks is in ms. Since hz=100, dividing
- # device (busy) ticks by 10, gives us this in the correct ticks units
- device_util_after_hz=`awk '{ print ($13 / 10) }' /tmp/$model-system`
+ # Get AFTER read stats for /system
+ $adb shell 'cat /proc/diskstats' | grep -w $system_block_device > /tmp/$model-system
+ AFTER_RD_IOS_SYSTEM=`awk '{ print $4 }' /tmp/$model-system`
+ AFTER_RD_SECTORS_SYSTEM=`awk '{ print $6 }' /tmp/$model-system`
+ # iowait% computation
+ $adb shell 'cat /proc/stat' | grep -w cpu > /tmp/procstat
+ user_ticks_after=`awk '{ print ($2 + $3) }' /tmp/procstat`
+ sys_ticks_after=`awk '{ print ($4 + $7 + $8) }' /tmp/procstat`
+ cpubusy_ticks_after=`awk '{ print ($2 + $3 + $4 + $7 + $8) }' /tmp/procstat`
+ iowait_ticks_after=`awk '{ print $6 }' /tmp/procstat`
+ total_ticks_after=`awk '{ print ($2 + $3 + $4 + $5 + $7 + $8) }' /tmp/procstat`
+ # Device util% computation
+ # Note hz=100, so multiplying uptime (in seconds) by 100, gives us
+ # the uptime in hz.
+ $adb shell 'cat /proc/uptime' > /tmp/uptime
+ uptime_after_hz=`awk '{ print ($1 * 100) }' /tmp/uptime`
+ # Note that the device (busy) ticks is in ms. Since hz=100, dividing
+ # device (busy) ticks by 10, gives us this in the correct ticks units
+ device_util_after_hz=`awk '{ print ($13 / 10) }' /tmp/$model-system`
fi
}
system_stats_delta() {
if [ $system_bdev_set == true ]; then
- # Sectors to KB
- READ_KB_SYSTEM=`expr $AFTER_RD_SECTORS_SYSTEM - $BEFORE_RD_SECTORS_SYSTEM`
- READ_KB_SYSTEM=`expr $READ_KB_SYSTEM / 2`
- echo Read IOs /system = `expr $AFTER_RD_IOS_SYSTEM - $BEFORE_RD_IOS_SYSTEM`
- echo Read KB /system = $READ_KB_SYSTEM
- echo $iowait_ticks_before $iowait_ticks_after $total_ticks_before $total_ticks_after | awk '{ printf "IOwait = %.2f\n", (($2 - $1) * 100.0) / ($4 - $3) }'
- echo $device_util_before_hz $device_util_after_hz $uptime_before_hz $uptime_after_hz | awk '{ printf "Device util% = %.2f\n", (($2 - $1) * 100.0) / ($4 - $3) }'
- echo $user_ticks_after $user_ticks_before $total_ticks_after $total_ticks_before | awk '{ printf "User CPU util% = %.2f\n", (($1 - $2) * 100.0) / ($3 - $4) }'
- echo $sys_ticks_after $sys_ticks_before $total_ticks_after $total_ticks_before | awk '{ printf "Sys CPU util% = %.2f\n", (($1 - $2) * 100.0) / ($3 - $4) }'
- echo $cpubusy_ticks_after $cpubusy_ticks_before $total_ticks_after $total_ticks_before | awk '{ printf "Total CPU util% = %.2f\n", (($1 - $2) * 100.0) / ($3 - $4) }'
+ # Sectors to KB
+ READ_KB_SYSTEM=`expr $AFTER_RD_SECTORS_SYSTEM - $BEFORE_RD_SECTORS_SYSTEM`
+ READ_KB_SYSTEM=`expr $READ_KB_SYSTEM / 2`
+ echo Read IOs /system = `expr $AFTER_RD_IOS_SYSTEM - $BEFORE_RD_IOS_SYSTEM`
+ echo Read KB /system = $READ_KB_SYSTEM
+ echo $iowait_ticks_before $iowait_ticks_after $total_ticks_before $total_ticks_after | awk '{ printf "IOwait = %.2f\n", (($2 - $1) * 100.0) / ($4 - $3) }'
+ echo $device_util_before_hz $device_util_after_hz $uptime_before_hz $uptime_after_hz | awk '{ printf "Device util% = %.2f\n", (($2 - $1) * 100.0) / ($4 - $3) }'
+ echo $user_ticks_after $user_ticks_before $total_ticks_after $total_ticks_before | awk '{ printf "User CPU util% = %.2f\n", (($1 - $2) * 100.0) / ($3 - $4) }'
+ echo $sys_ticks_after $sys_ticks_before $total_ticks_after $total_ticks_before | awk '{ printf "Sys CPU util% = %.2f\n", (($1 - $2) * 100.0) / ($3 - $4) }'
+ echo $cpubusy_ticks_after $cpubusy_ticks_before $total_ticks_after $total_ticks_before | awk '{ printf "Total CPU util% = %.2f\n", (($1 - $2) * 100.0) / ($3 - $4) }'
fi
}
launch_app() {
package=$1
activity=$2
- adb shell "am force-stop $package"
+ $adb shell "am force-stop $package"
sleep 1
+ printf "Testing %s: \n" "$package" 1>&2
i=0
while [ $i -lt $iterations ]
do
- if [ $pagecached == false ]; then
- adb shell 'echo 3 > /proc/sys/vm/drop_caches'
- fi
- # The -W argument to am start forces am start to wait till the launch completes.
- # The -S argument forces it to kill any existing app that is running first
- # eg. adb shell 'am start -W -S -n com.android.chrome/com.google.android.apps.chrome.Main'
- system_stats_before
- adb shell "simpleperf stat -a am start -W -n $package/$activity"
- system_stats_after
- system_stats_delta
- sleep 1
- adb shell "am force-stop $package"
- sleep 1
- i=`expr $i + 1`
+ if [ $pagecached == false ]; then
+ $adb shell 'echo 3 > /proc/sys/vm/drop_caches'
+ fi
+ printf '[ %d%% ]\r' "$(($i * 100 / $iterations))" 1>&2
+ # The -W argument to am start forces am start to wait till the launch completes.
+ # The -S argument forces it to kill any existing app that is running first
+ # eg. adb shell 'am start -W -S -n com.android.chrome/com.google.android.apps.chrome.Main'
+ system_stats_before
+ $adb shell "simpleperf stat -a am start -W -n $package/$activity"
+ system_stats_after
+ system_stats_delta
+ sleep 1
+ $adb shell "am force-stop $package"
+ sleep 1
+ i=`expr $i + 1`
done
+ printf "\n" 1>&2
}
launch_fugu_apps() {
@@ -359,9 +416,10 @@ launch_phone_apps() {
}
usage() {
- echo 'Usage: app-launcher [-c|-v] -a|-b|-u num-iterations'
+ echo 'Usage: app-launcher [-c|-v|-s <serial num>] -a|-b|-u num-iterations'
echo 'where num-iterations >= 100'
echo '-v (optional) for verbose stats dump'
+ echo '-s <serial num> (optional) run test on specific device'
echo '-a|-b|-u required:'
echo ' -a:all cores'
echo ' -b:only big cores'
@@ -373,6 +431,28 @@ usage() {
exit 1
}
+setup() {
+ # Disable automatic rotation, NFC and wifi
+ # This works on OC, but haven't tested on NYC or earlier
+ $adb shell 'content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0'
+ $adb shell 'svc nfc disable'
+ $adb shell 'svc wifi disable'
+
+ # Set developer options, will automatically 'Stay Awake'
+ $adb shell 'am start -n com.android.settings/.DevelopmentSettings'
+ # Set screen timeout to 30 minutes
+ $adb shell 'settings put system screen_off_timeout 1800000'
+ # Clear all notifications
+ $adb shell 'service call notification 1'
+ # Go to home screen
+ $adb shell 'input keyevent KEYCODE_WAKEUP' && sleep 0.5
+ $adb shell 'input keyevent KEYCODE_ENTER' && sleep 0.5
+ $adb shell 'input keyevent KEYCODE_HOME' && sleep 0.5
+ sleep 2
+ # TODO: kill all background apps
+ # TODO: clear popups
+}
+
#
# The main() part of the script follows :
#
@@ -395,18 +475,18 @@ fi
parseoptions $@
-adb root && sleep 2
+$adb root && $adb wait-for-device
if [ $user_experience == false ]; then
# Important to stop the thermal-engine to prevent throttling while test is running
# and stop perfd
- adb shell 'stop thermal-engine'
- adb shell 'stop perfd'
+ $adb shell 'stop thermal-engine'
+ $adb shell 'stop perfd'
else
echo "User Experience: Default Configs. No changes to cpufreq settings"
fi
-model=`adb shell getprop ro.product.name`
+model=`$adb shell getprop ro.product.name`
# Releases are inconsistent with various trailing characters, remove them all
model=`echo $model | sed 's/[ \t\r\n]*$//' `
@@ -414,11 +494,17 @@ echo Found $model Device
system_bdev_set=false
case $model in
+ taimen | muskie | walleye)
+ if [ $user_experience == false ]; then
+ cpufreq_taimen_walleye
+ fi
+ get_taimen_walleye_devnames
+ ;;
marlin | sailfish)
if [ $user_experience == false ]; then
cpufreq_marlin_sailfish
fi
- get_marlin_sailfish_devnames
+ get_marlin_sailfish_devnames
;;
angler)
if [ $user_experience == false ]; then
@@ -444,6 +530,7 @@ case $model in
;;
esac
+setup
#
# launch each app in turn