xfstests 241: run longer
[xfstests-dev.git] / run.bonnie_io
1 #!/bin/bash
2 #
3 # Copyright (c) 2002-2003 Silicon Graphics, Inc.  All Rights Reserved.
4 #
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.
8 #
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.
13 #
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
17 #
18
19 # Does a bonnie throughput run (80M file and 1K chunksize if the
20 # BONNIE_FILESIZE and/or BONNIE_CHUNKSIZE variables are not set),
21 # then massages the output into CSV format with the human-readable
22 # output preceding it as a "comment" (ie. #-prefixed).
23
24 BONNIE_FILESIZE=${BONNIE_FILESIZE:=500M}
25 BONNIE_CHUNKSIZE=${BONNIE_CHUNKSIZE:=1K}
26
27 [ -z "$here" ] && here=`pwd`
28 . $here/common.bonnie
29
30
31 # Sample bonnie throughput output (stderr):
32 #Version 1.02c       ------Sequential Output------ --Sequential Input- --Random-
33 #                    -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
34 #Machine   Size:chnk K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
35 #          150M:64k           52024  99 88969  99           245492 100  3746 264
36
37 filter_stderr()
38 {
39         sed -e 's/^..................../# /g' | awk '{print} END {print "#"}'
40 }
41
42
43 # Sample bonnie throughput output (stdout):
44 # ",150M:64k,,,52024,99,88969,99,,,245492,100,3746.0,264,,,,,,,,,,,,,"
45
46 filter_stdout()
47 {
48         perl -ne '
49                 chomp;
50                 s/,+/,/g; s/^,//; s/,$//;
51                 @values = split /,/;
52                 printf "%9s", shift @values;
53                 for ($i = 0; $i <= $#values; $i++) {
54                         if ($i % 2) { printf ",%4s%%", $values[$i] }
55                         else        { printf ",%10s", $values[$i] }
56                 }
57                 printf "\n";
58         '
59 }
60
61 if [ $# -gt 0 ]; then
62         printf "%9s,%10s,%5s,%10s,%5s,%10s,%5s,%10s,%5s\n" size:chnk \
63                 writeK/s wCPU rewriteK/s rwCPU readK/s rCPU seek/s sCPU
64         exit 0
65 fi
66 run_bonnie -n 0 -s $BONNIE_FILESIZE:$BONNIE_CHUNKSIZE