Cleanup dbench benchmark scripts
authorfsgqa <fsgqa>
Thu, 25 Sep 2003 01:57:56 +0000 (01:57 +0000)
committerfsgqa <fsgqa>
Thu, 25 Sep 2003 01:57:56 +0000 (01:57 +0000)
common.dbench
run.dbench
run.dbench10
run.dbench100
run.dbench2
run.dbench20
run.dbench50
run.dbenchmulti [new file with mode: 0755]
run.metaperf_10i_1000n
run.metaperf_10i_1n

index d3cd53438353b3f467caedbb2d9514f56e4eeccb..0c7415fa9adb1d88f04162933255d73de7ad6fe4 100755 (executable)
@@ -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];
+       }'
+}
index 78be9c927f0f936ff0bed3975c985db328e836a7..039359169a201a84ee96571c48180dbcbc8b808b 100755 (executable)
@@ -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
index cd615b1694c9df3142daf60c90a698ff1431d797..fc3b71a738686a7cd4498609e9509425d0b92d26 100755 (executable)
@@ -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
index b3dcf29d2ebc01ccae899bb4528715f3d0c45673..565be1a2c281fda7cffd154149b2401f7ad9911b 100755 (executable)
@@ -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
index da4840ee1ad53916cf3167b5064843945cf85ec2..1eca928389a730cb6f4a7fde5e216eb565ff4cea 100755 (executable)
@@ -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
index 20a90b0dccae8b1f9d4075ee27438ae0dcfef156..ed57015b57d143c9559cbb4ed8ec9a3212121894 100755 (executable)
@@ -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
index 323414b875c079a0712f02323503dd51fc169f6e..d2fd8fe72321288cc4f53737926a7cc23a341971 100755 (executable)
@@ -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 (executable)
index 0000000..7bb52c2
--- /dev/null
@@ -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
index 69e4d3b21ae8aadc9b327517246cc27409733e88..446dd98b2c621985adff19cd58b020195cf6b9c8 100755 (executable)
@@ -4,6 +4,7 @@
 # Use 1000 files, 10 iterations.
 # 
 
+[ -z "$here" ] && here=`pwd`
 . $here/common.metaperf
 
 if [ $# -gt 0 ]; then
index 38158449a7c0b607474be47a0b3b00dd70dee527..519641c4e4cc433ec91840717f0540e58758c90b 100755 (executable)
@@ -4,6 +4,7 @@
 # Use 1 file, 10 iterations.
 # 
 
+[ -z "$here" ] && here=`pwd`
 . $here/common.metaperf
 
 if [ $# -gt 0 ]; then