2 # Copyright 2009, The Android Open Source Project
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Run a bunch of test on the sdcard to establish a performance profile.
19 adb shell cat /proc/version
21 print_sched_features() {
22 adb shell cat /sys/kernel/debug/sched_features
25 # Use dd to get the raw speed of the card
30 # Time to run a test vs number of processes
32 local file="/tmp/sdcard-scalability.txt"
34 echo "# Scalability tests" | tee -a ${file}
35 echo "# Kernel: $(print_kernel)" | tee -a ${file}
36 echo "# Sched features: $(print_sched_features)" | tee -a ${file}
37 echo "# StopWatch scalability total/cumulative duration 0.0 Samples: 1" | tee -a ${file}
38 echo "# Process Time" | tee -a ${file}
39 for p in $(seq 1 8); do
40 adb shell sdcard_perf_test --test=write --procnb=${p} --size=1000 --chunk-size=100 --iterations=50 >/tmp/tmp-sdcard.txt
41 local t=$(grep 'write_total' /tmp/tmp-sdcard.txt | tail -n 1 | cut -f 6 -d ' ')
42 echo "$p $t" | tee -a ${file}
47 # Readers and writers should not starve each others.
49 # Check readers finished before writers.
50 # Find the time of the last read op.
51 # Count how many writes and how many read happend
52 # during that period, do the ratio.
56 #######################################################################
59 echo "Make sure debugfs is mounted on the device."