From 6947c6168e7761b71f4502ae3c356e4fac3c689c Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 6 Jul 2009 17:43:47 +0000 Subject: [PATCH] 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 --- scripts/blockdev-perftest | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/blockdev-perftest b/scripts/blockdev-perftest index 08e434ed9..65cdf3167 100755 --- a/scripts/blockdev-perftest +++ b/scripts/blockdev-perftest @@ -27,13 +27,14 @@ ######################### usage() { - echo "Usage: $0 [-a] [-d] [-i ] [-n] [-r] [-s ] " + echo "Usage: $0 [-a] [-d] [-i ] [-n] [-r] [-s ] [-t [user@]host] " 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 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 " - 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"