3 # Copyright (c) 2002-2005 Silicon Graphics, Inc. All Rights Reserved.
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it would be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write the Free Software Foundation,
16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #check dbench is installed
20 if [ "`whereis dbench`" == "dbench:" ]; then
21 echo $0 error dbench not installed.
27 mkdir ./dbench || exit 1
33 [ $status -ne 0 ] && exit 1
37 # Sample dbench output:
38 # "Throughput 40.6701 MB/sec (NB=50.8376 MB/sec 406.701 MBit/sec)"
41 # Output for a single-shot dbench run.
44 printf "%8s, %s\n" clients MB/sec
49 perl -ne 'm/Throughput (\S+) MB\/sec/ &&
50 { printf "%8u, %s\n", '$clients', $1 }'
53 # Output for a "multipass" dbench run.
54 _format_header_multipass()
56 while [ $# -gt 1 ]; do
57 printf "%4s::MB/sec," $1
60 printf "%4s::MB/sec\n" $1
62 _filter_dbench_multipass()
65 if (m/Throughput (\S+) MB\/sec/) {
66 $results[$count++] = $1;
68 END { for ($i = 0; $i < $count - 1; $i++) {
69 printf "%12.3f,", $results[$i];
71 printf "%12.3f\n", $results[$count-1];