Added command-line option -t, which allows to drop the caches of the target too. Added dd flag conv=notrunc to write performance tests, which makes running blockdev-perftest on files instead of devices a lot easier.

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@933 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2009-07-06 17:43:47 +00:00
parent ed81fdc037
commit 6947c6168e
+9 -3
View File
@@ -27,13 +27,14 @@
#########################
usage() {
echo "Usage: $0 [-a] [-d] [-i <i>] [-n] [-r] [-s <l2s>] <dev>"
echo "Usage: $0 [-a] [-d] [-i <i>] [-n] [-r] [-s <l2s>] [-t [user@]host] <dev>"
echo " -a - use asynchronous (buffered) I/O."
echo " -d - use direct (non-buffered) I/O."
echo " -i - number times each test is iterated."
echo " -n - do not verify the data on <dev> before overwriting it."
echo " -r - only perform the read test."
echo " -s - logarithm base two of the I/O size."
echo " -t - username and hostname of the target to drop the caches on."
echo " <dev> - block device to run the I/O performance test on."
}
@@ -51,6 +52,9 @@ drop_caches() {
if [ -w /proc/sys/vm/drop_caches ]; then
echo 3 > /proc/sys/vm/drop_caches
fi
if [ "${target_login}" != "" ]; then
ssh -n ${target_login} 'sync; if [ -w /proc/sys/vm/drop_caches ]; then echo 3 > /proc/sys/vm/drop_caches; fi'
fi
}
# Read times in seconds from stdin, one number per line, echo each number
@@ -71,6 +75,7 @@ log2_min_blocksize=9 # 512 bytes
log2_max_blocksize=26 # 64 MB
iotype=direct
read_test_only=false
target_login=""
verify_device_data=true
@@ -78,7 +83,7 @@ verify_device_data=true
# Argument processing #
#########################
set -- $(/usr/bin/getopt "adhi:nrs:" "$@")
set -- $(/usr/bin/getopt "adhi:nrs:t:" "$@")
while [ "$1" != "${1#-}" ]
do
case "$1" in
@@ -88,6 +93,7 @@ do
'-n') verify_device_data="false"; shift;;
'-r') read_test_only="true"; shift;;
'-s') log2_io_size="$2"; shift; shift;;
'-t') target_login="$2"; shift; shift;;
'--') shift;;
*) usage; exit 1;;
esac
@@ -123,7 +129,7 @@ then
fi
if [ "${iotype}" = "direct" ]; then
dd_oflags="oflag=direct"
dd_oflags="oflag=direct conv=notrunc"
dd_iflags="iflag=direct"
else
dd_oflags="oflag=sync"