Home | History | Annotate | Download | only in sdcard
      1 #!/bin/bash
      2 # Copyright 2009, The Android Open Source Project
      3 #
      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
      7 #
      8 #     http://www.apache.org/licenses/LICENSE-2.0
      9 #
     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.
     15 
     16 # Run a bunch of test on the sdcard to establish a performance profile.
     17 
     18 print_kernel() {
     19   adb shell cat /proc/version
     20 }
     21 print_sched_features() {
     22   adb shell cat /sys/kernel/debug/sched_features
     23 }
     24 
     25 # Use dd to get the raw speed of the card
     26 block_level() {
     27   true
     28 }
     29 
     30 # Time to run a test vs number of processes
     31 scalability() {
     32   local file="/tmp/sdcard-scalability.txt"
     33   rm -f ${file}
     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}
     43   done
     44 
     45 }
     46 
     47 # Readers and writers should not starve each others.
     48 fairness() {
     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.
     53   true
     54 }
     55 
     56 #######################################################################
     57 # MAIN
     58 
     59 echo "Make sure debugfs is mounted on the device."
     60 block_level
     61 scalability
     62 fairness
     63 
     64 
     65