summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sumrall <ksumrall@android.com>2013-07-10 05:14:56 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-07-10 05:14:56 +0000
commitffadc3728f91535324b5b277edf13dd048fbadef (patch)
treebc0ab2b532f32b445ac92f791964b10d073902e0
parent3497a75bfb6b0c061b98ba086227ce123ae7a133 (diff)
parent1bf4d3345149615ec47e41cd940287a71b241b44 (diff)
downloadextras-ffadc3728f91535324b5b277edf13dd048fbadef.tar.gz
Merge "Add the -u option to support running on USER builds"
-rwxr-xr-xtests/ext4/android_emmc_perf_tests.sh171
1 files changed, 104 insertions, 67 deletions
diff --git a/tests/ext4/android_emmc_perf_tests.sh b/tests/ext4/android_emmc_perf_tests.sh
index fcee36c8..6464312f 100755
--- a/tests/ext4/android_emmc_perf_tests.sh
+++ b/tests/ext4/android_emmc_perf_tests.sh
@@ -1,12 +1,17 @@
#!/bin/bash
PERF="rand_emmc_perf"
+PERF_LOC=/dev
STATS_FILE="/data/local/tmp/stats_test"
STATS_MODE=0
+USERBUILD_MODE=0
if [ "$1" = "-s" ]
then
STATS_MODE=1
+elif [ "$1" = "-u" ]
+then
+ USERBUILD_MODE=1
fi
if [ ! -r "$PERF" ]
@@ -72,40 +77,56 @@ case "$HARDWARE" in
exit 1
esac
-# prepare the device
-adb root
-adb wait-for-device
-adb push "$PERF" /dev
-adb shell stop
-adb shell stop sdcard
-adb shell stop ril-daemon
-adb shell stop media
-adb shell stop drm
-adb shell stop keystore
-adb shell stop tf_daemon
-adb shell stop bluetoothd
-adb shell stop hciattach
-adb shell stop p2p_supplicant
-adb shell stop wpa_supplicant
-adb shell stop mobicore
-adb shell umount /sdcard >/dev/null 2>&1
-adb shell umount /mnt/sdcard >/dev/null 2>&1
-adb shell umount /mnt/shell/sdcard0 >/dev/null 2>&1
-adb shell umount /mnt/shell/emulated >/dev/null 2>&1
-adb shell umount /cache >/dev/null 2>&1
-if [ "$STATS_MODE" -ne 1 ]
+# We cannot stop and unmount stuff in a user build, so don't even try.
+if [ "$USERBUILD_MODE" -eq 0 ]
then
- adb shell umount /data >/dev/null 2>&1
+ # prepare the device
+ adb root
+ adb wait-for-device
+ adb push "$PERF" /dev
+ adb shell stop
+ adb shell stop sdcard
+ adb shell stop ril-daemon
+ adb shell stop media
+ adb shell stop drm
+ adb shell stop keystore
+ adb shell stop tf_daemon
+ adb shell stop bluetoothd
+ adb shell stop hciattach
+ adb shell stop p2p_supplicant
+ adb shell stop wpa_supplicant
+ adb shell stop mobicore
+ adb shell umount /sdcard >/dev/null 2>&1
+ adb shell umount /mnt/sdcard >/dev/null 2>&1
+ adb shell umount /mnt/shell/sdcard0 >/dev/null 2>&1
+ adb shell umount /mnt/shell/emulated >/dev/null 2>&1
+ adb shell umount /cache >/dev/null 2>&1
+ if [ "$STATS_MODE" -ne 1 ]
+ then
+ adb shell umount /data >/dev/null 2>&1
+ fi
+else
+ # For user builds, put the $PERF binary in /data/local/tmp,
+ # and also setup CACHE to point to a file on /data/local/tmp,
+ # and create that file
+ PERF_LOC=/data/local/tmp
+ adb push "$PERF" "$PERF_LOC"
+ CACHE=/data/local/tmp/testfile
+ echo "Creating testfile for user builds (can take up to 60 seconds)"
+ adb shell dd if=/dev/zero of=$CACHE bs=1048576 count=512
fi
# Add more services here that other devices need to stop.
# So far, this list is sufficient for:
# Prime
-# At this point, the device is quiescent, need to crank up the cpu speed,
-# then run tests
-adb shell "cat $CPUFREQ/cpuinfo_max_freq > $CPUFREQ/scaling_max_freq"
-adb shell "cat $CPUFREQ/cpuinfo_max_freq > $CPUFREQ/scaling_min_freq"
+if [ "$USERBUILD_MODE" -eq 0 ]
+then
+ # At this point, the device is quiescent, need to crank up the cpu speed,
+ # then run tests
+ adb shell "cat $CPUFREQ/cpuinfo_max_freq > $CPUFREQ/scaling_max_freq"
+ adb shell "cat $CPUFREQ/cpuinfo_max_freq > $CPUFREQ/scaling_min_freq"
+fi
# Start the tests
@@ -182,66 +203,82 @@ then
else
# Sequential read test
- for I in 1 2 3
- do
- adb shell "echo 3 > /proc/sys/vm/drop_caches"
- echo "Sequential read test $I"
- adb shell dd if="$CACHE" of=/dev/null bs=1048576 count=200
- done
+ if [ "$USERBUILD_MODE" -eq 0 ]
+ then
+ # There is no point in running this in USERBUILD mode, because
+ # we can't drop caches, and the numbers are ludicrously high
+ for I in 1 2 3
+ do
+ adb shell "echo 3 > /proc/sys/vm/drop_caches"
+ echo "Sequential read test $I"
+ adb shell dd if="$CACHE" of=/dev/null bs=1048576 count=200
+ done
+ fi
# Sequential write test
for I in 1 2 3
do
echo "Sequential write test $I"
- adb shell dd if=/dev/zero of="$CACHE" bs=1048576 count=200
+ # It's unclear if this test is useful on USERBUILDS, given the
+ # caching on the filesystem
+ adb shell dd if=/dev/zero conv=notrunc of="$CACHE" bs=1048576 count=200
done
- # Random read tests require that we read from a much larger range of offsets
- # into the emmc chip than the write test. If we only read though 100 Megabytes
- # (and with a read-ahead of 128K), we quickly fill the buffer cache with 100
- # Megabytes of data, and subsequent reads are nearly instantaneous. Since
- # reading is non-destructive, and we've never shipped a device with less than
- # 8 Gbytes, for this test we read from the raw emmc device, and randomly seek
- # in the first 6 Gbytes. That is way more memory than any device we currently
- # have and it should keep the cache from being poluted with entries from
- # previous random reads.
- #
- # Also, test with the read-ahead set very low at 4K, and at the default
-
- # Random read test, 4K read-ahead
- ORIG_READAHEAD=`adb shell cat /sys/block/$MMCDEV/queue/read_ahead_kb | tr -d "\r"`
- adb shell "echo 4 > /sys/block/$MMCDEV/queue/read_ahead_kb"
- for I in 1 2 3
- do
- adb shell "echo 3 > /proc/sys/vm/drop_caches"
- echo "Random read (4K read-ahead) test $I"
- adb shell /dev/"$PERF" -r 6000 "/dev/block/$MMCDEV"
- done
+ if [ "$USERBUILD_MODE" -eq 0 ]
+ then
+ # Random read tests require that we read from a much larger range of offsets
+ # into the emmc chip than the write test. If we only read though 100 Megabytes
+ # (and with a read-ahead of 128K), we quickly fill the buffer cache with 100
+ # Megabytes of data, and subsequent reads are nearly instantaneous. Since
+ # reading is non-destructive, and we've never shipped a device with less than
+ # 8 Gbytes, for this test we read from the raw emmc device, and randomly seek
+ # in the first 6 Gbytes. That is way more memory than any device we currently
+ # have and it should keep the cache from being poluted with entries from
+ # previous random reads.
+ #
+ # Also, test with the read-ahead set very low at 4K, and at the default
+
+ # Random read test, 4K read-ahead
+ ORIG_READAHEAD=`adb shell cat /sys/block/$MMCDEV/queue/read_ahead_kb | tr -d "\r"`
+ adb shell "echo 4 > /sys/block/$MMCDEV/queue/read_ahead_kb"
+ for I in 1 2 3
+ do
+ adb shell "echo 3 > /proc/sys/vm/drop_caches"
+ echo "Random read (4K read-ahead) test $I"
+ adb shell "$PERF_LOC"/"$PERF" -r 6000 "/dev/block/$MMCDEV"
+ done
- # Random read test, default read-ahead
- adb shell "echo $ORIG_READAHEAD > /sys/block/$MMCDEV/queue/read_ahead_kb"
- for I in 1 2 3
- do
- adb shell "echo 3 > /proc/sys/vm/drop_caches"
- echo "Random read (default read-ahead of ${ORIG_READAHEAD}K) test $I"
- adb shell /dev/"$PERF" -r 6000 "/dev/block/$MMCDEV"
- done
+ # Random read test, default read-ahead
+ adb shell "echo $ORIG_READAHEAD > /sys/block/$MMCDEV/queue/read_ahead_kb"
+ for I in 1 2 3
+ do
+ adb shell "echo 3 > /proc/sys/vm/drop_caches"
+ echo "Random read (default read-ahead of ${ORIG_READAHEAD}K) test $I"
+ adb shell "$PERF_LOC"/"$PERF" -r 6000 "/dev/block/$MMCDEV"
+ done
+ fi
# Random write test
for I in 1 2 3
do
echo "Random write test $I"
- adb shell /dev/"$PERF" -w 100 "$CACHE"
+ adb shell "$PERF_LOC"/"$PERF" -w 100 "$CACHE"
done
# Random write test with O_SYNC
for I in 1 2 3
do
echo "Random write with o_sync test $I"
- adb shell /dev/"$PERF" -w -o 100 "$CACHE"
+ adb shell "$PERF_LOC"/"$PERF" -w -o 100 "$CACHE"
done
fi
-# Make a new empty /cache filesystem
-adb shell make_ext4fs -w "$CACHE"
+# cleanup
+if [ "$USERBUILD_MODE" -eq 0 ]
+then
+ # Make a new empty /cache filesystem
+ adb shell make_ext4fs -w "$CACHE"
+else
+ adb shell rm -f "$CACHE" "$PERF_LOC"/"$PERF"
+fi