summaryrefslogtreecommitdiff
path: root/tests/ext4/android_emmc_perf_tests.sh
blob: 202c0951780b625751547f953b2fd5b08fa8c965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash

PERF="rand_emmc_perf"

if [ ! -r "$PERF" ]
then
  echo "Cannot read $PERF test binary"
fi

if ! adb shell true >/dev/null 2>&1
then
  echo "No device detected over adb"
fi

HARDWARE=`adb shell getprop ro.hardware | tr -d "\r"`

case "$HARDWARE" in
  tuna | steelhead)
    CPUFREQ="/sys/devices/system/cpu/cpu0/cpufreq"
    CACHE="/dev/block/platform/omap/omap_hsmmc.0/by-name/cache"
    ;;

  stingray | wingray)
    CPUFREQ="/sys/devices/system/cpu/cpu0/cpufreq"
    CACHE="/dev/block/platform/sdhci-tegra.3/by-name/cache"
    ;;

  herring)
    echo "This test will wipe the userdata partition on $HARDWARE devices."
    read -p "Do you want to proceed? " ANSWER

    if [ "$ANSWER" != "yes" ]
    then
      echo "aborting test"
      exit 1
    fi

    CPUFREQ="/sys/devices/system/cpu/cpu0/cpufreq"
    CACHE="/dev/block/platform/s3c-sdhci.0/by-name/userdata"
    ;;

  grouper)
    CPUFREQ="/sys/devices/system/cpu/cpu0/cpufreq"
    CACHE="/dev/block/platform/sdhci-tegra.3/by-name/CAC"
    ;;

  manta)
    CPUFREQ="/sys/devices/system/cpu/cpu0/cpufreq"
    CACHE="/dev/block/platform/dw_mmc.0/by-name/cache"
    ;;

  *)
    echo "Unknown hardware $HARDWARE.  Exiting."
    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 umount /sdcard >/dev/null 2>&1
adb shell umount /data >/dev/null 2>&1
adb shell umount /cache >/dev/null 2>&1
# 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"

# Start the tests

# Sequential read test
for I in 1 2 3
do
  echo "Sequential read test $I"
  adb shell dd if="$CACHE" of=/dev/null bs=1048576 count=200
done

# 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
done

# Random read test
for I in 1 2 3
do
  adb shell "echo 3 > /proc/sys/vm/drop_caches"
  echo "Random read test $I"
  adb shell /dev/"$PERF" -r 100 "$CACHE"
done

# Random write test
for I in 1 2 3
do
  echo "Random write test $I"
  adb shell /dev/"$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"
done

# Make a new empty /cache filesystem
adb shell make_ext4fs "$CACHE"