From: fsgqa Date: Thu, 25 Sep 2003 01:57:56 +0000 (+0000) Subject: Cleanup dbench benchmark scripts X-Git-Tag: v1.1.0~914 X-Git-Url: http://git.apps.os.sepia.ceph.com/?p=xfstests-dev.git;a=commitdiff_plain;h=58b380a189e6c621ce2e763d05849e88f16d0a96 Cleanup dbench benchmark scripts --- diff --git a/common.dbench b/common.dbench index d3cd5343..0c7415fa 100755 --- a/common.dbench +++ b/common.dbench @@ -1,27 +1,50 @@ -#!/bin/sh -# -# Does a dbench run (10 clients if $DBENCH_CLIENTS is not set), -# then massages the output into CSV format. -# -DBENCH_CLIENTS=${DBENCH_CLIENTS:=10} +##/bin/sh -run_dbench() +_run_dbench() { mkdir ./dbench || exit 1 cd dbench - dbench $DBENCH_CLIENTS + dbench $1 status=$? cd .. rm -fr ./dbench [ $status -ne 0 ] && exit 1 } -# +# # Sample dbench output: # "Throughput 40.6701 MB/sec (NB=50.8376 MB/sec 406.701 MBit/sec)" # -if [ $# -gt 0 ]; then + +# Output for a single-shot dbench run. +_format_header() +{ printf "%8s, %s\n" clients MB/sec - exit 0 -fi -run_dbench | awk 'END { printf "%8u, %s\n", '$DBENCH_CLIENTS', $2 }' +} +_filter_dbench() +{ + clients=$1 + perl -ne 'm/Throughput (\S+) MB\/sec/ && + { printf "%8u, %s\n", '$clients', $1 }' +} + +# Output for a "multipass" dbench run. +_format_header_multipass() +{ + for i in $@; do + printf "%4s::MB/sec," $i + done + printf "\n" +} +_filter_dbench_multipass() +{ + perl -ne ' + if (m/Throughput (\S+) MB\/sec/) { + $results[$count++] = $1; + } + END { for ($i = 0; $i < $count - 1; $i++) { + printf "%12.3f,", $results[$i]; + } + printf "%12.3f\n", $results[$count-1]; + }' +} diff --git a/run.dbench b/run.dbench index 78be9c92..03935916 100755 --- a/run.dbench +++ b/run.dbench @@ -2,9 +2,12 @@ # # Does a single-client dbench run # -DBENCH_CLIENTS=1 -export DBENCH_CLIENTS -[ ! -d "$here" ] && here=`pwd` +[ -z "$here" ] && here=`pwd` +. $here/common.dbench -exec $here/common.dbench $@ +if [ $# -gt 0 ]; then + _format_header + exit 0 +fi +_run_dbench 1 | _filter_dbench 1 diff --git a/run.dbench10 b/run.dbench10 index cd615b16..fc3b71a7 100755 --- a/run.dbench10 +++ b/run.dbench10 @@ -2,9 +2,12 @@ # # Does a dbench run with 10 clients # -DBENCH_CLIENTS=10 -export DBENCH_CLIENTS -[ ! -d "$here" ] && here=`pwd` +[ -z "$here" ] && here=`pwd` +. $here/common.dbench -exec $here/common.dbench $@ +if [ $# -gt 0 ]; then + _format_header + exit 0 +fi +_run_dbench 10 | _filter_dbench 10 diff --git a/run.dbench100 b/run.dbench100 index b3dcf29d..565be1a2 100755 --- a/run.dbench100 +++ b/run.dbench100 @@ -2,9 +2,12 @@ # # Does a dbench run with 100 clients # -DBENCH_CLIENTS=100 -export DBENCH_CLIENTS -[ ! -d "$here" ] && here=`pwd` +[ -z "$here" ] && here=`pwd` +. $here/common.dbench -exec $here/common.dbench $@ +if [ $# -gt 0 ]; then + _format_header + exit 0 +fi +_run_dbench 100 | _filter_dbench 100 diff --git a/run.dbench2 b/run.dbench2 index da4840ee..1eca9283 100755 --- a/run.dbench2 +++ b/run.dbench2 @@ -2,9 +2,12 @@ # # Does a dbench run with 2 clients # -DBENCH_CLIENTS=2 -export DBENCH_CLIENTS -[ ! -d "$here" ] && here=`pwd` +[ -z "$here" ] && here=`pwd` +. $here/common.dbench -exec $here/common.dbench $@ +if [ $# -gt 0 ]; then + _format_header + exit 0 +fi +_run_dbench 2 | _filter_dbench 2 diff --git a/run.dbench20 b/run.dbench20 index 20a90b0d..ed57015b 100755 --- a/run.dbench20 +++ b/run.dbench20 @@ -2,9 +2,12 @@ # # Does a dbench run with 20 clients # -DBENCH_CLIENTS=20 -export DBENCH_CLIENTS -[ ! -d "$here" ] && here=`pwd` +[ -z "$here" ] && here=`pwd` +. $here/common.dbench -exec $here/common.dbench $@ +if [ $# -gt 0 ]; then + _format_header + exit 0 +fi +_run_dbench 20 | _filter_dbench 20 diff --git a/run.dbench50 b/run.dbench50 index 323414b8..d2fd8fe7 100755 --- a/run.dbench50 +++ b/run.dbench50 @@ -2,9 +2,12 @@ # # Does a dbench run with 50 clients # -DBENCH_CLIENTS=50 -export DBENCH_CLIENTS -[ ! -d "$here" ] && here=`pwd` +[ -z "$here" ] && here=`pwd` +. $here/common.dbench -exec $here/common.dbench $@ +if [ $# -gt 0 ]; then + _format_header + exit 0 +fi +_run_dbench 50 | _filter_dbench 50 diff --git a/run.dbenchmulti b/run.dbenchmulti new file mode 100755 index 00000000..7bb52c2e --- /dev/null +++ b/run.dbenchmulti @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Does several dbench runs with increasing numbers of client +# + +[ -z "$here" ] && here=`pwd` +. $here/common.dbench + +if [ $# -gt 0 ]; then + _format_header_multipass 1 2 10 20 #50 + exit 0 +fi +tmpfile=/var/tmp/dbench.$$ +rm -f $tmpfile +_run_dbench 1 >> $tmpfile +_run_dbench 2 >> $tmpfile +_run_dbench 10 >> $tmpfile +_run_dbench 20 >> $tmpfile +#_run_dbench 50 >> $tmpfile +_filter_dbench_multipass < $tmpfile +rm -f $tmpfile diff --git a/run.metaperf_10i_1000n b/run.metaperf_10i_1000n index 69e4d3b2..446dd98b 100755 --- a/run.metaperf_10i_1000n +++ b/run.metaperf_10i_1000n @@ -4,6 +4,7 @@ # Use 1000 files, 10 iterations. # +[ -z "$here" ] && here=`pwd` . $here/common.metaperf if [ $# -gt 0 ]; then diff --git a/run.metaperf_10i_1n b/run.metaperf_10i_1n index 38158449..519641c4 100755 --- a/run.metaperf_10i_1n +++ b/run.metaperf_10i_1n @@ -4,6 +4,7 @@ # Use 1 file, 10 iterations. # +[ -z "$here" ] && here=`pwd` . $here/common.metaperf if [ $# -gt 0 ]; then