fix dmapi test suite to work with more recent autotools
[xfstests-dev.git] / run.bonnie_ops
1 #!/bin/sh
2
3 # Do a bonnie++ create/read/delete run using 8192 files (unless
4 # BONNIE_KFILES environment variable is set -- note this number
5 # is multiplied by 1024 by bonnie++).  By default the files are
6 # created in the same directory, BONNIE_NDIRS specifies a count
7 # of subdirs to evenly spread files through.  Regular files are
8 # created by default (BONNIE_FILETYPE=regular), alternatively
9 # the values "symlinks" and "hardlinks" can be used.
10
11 # The script then massages the output into CSV format with the
12 # human-readable output preceding it as a "comment" (#-prefixed).
13
14 BONNIE_NDIRS=${BONNIE_NDIRS:=1}
15 BONNIE_KFILES=${BONNIE_KFILES:=8}
16 BONNIE_FILETYPE=${BONNIE_FILETYPE:=regular}
17
18 [ -z "$here" ] && here=`pwd`
19 . $here/common.bonnie
20
21
22 # Sample bonnie throughput output (stderr):
23 #Version 1.02c       ------Sequential Create------ --------Random Create--------
24 #                    -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
25 #              files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
26 #                  4   525  27 +++++ +++   517  26   526  25 +++++ +++   230  12
27 # [ Note: the "files" can also be "^files:max" and possibly other things ]
28 filter_stderr()
29 {
30         sed -e 's/^..................../# /g' | awk '{print} END {print "#"}'
31 }
32
33
34 # Sample bonnie IOPs output (stdout):
35 # ",,,,,,,,,,,,,,4,525,27,+++++,+++,517,26,526,25,+++++,+++,230,12"
36 # [ nathans note: always get +++ due to 0:0 for min:max file sizes. ]
37 # [ I will need to fix the filter if I ever start using file sizes. ]
38
39 filter_stdout()
40 {
41         perl -ne '
42                 chomp;
43                 s/\+*//g; s/,+/,/g; s/^,//; s/,$//;
44                 @values = split /,/;
45                 printf "%9s", 1024 * shift @values;
46                 for ($i = 0; $i <= $#values; $i++) {
47                         if ($i % 2) { printf ",%4s%%", $values[$i] }
48                         else        { printf ",%10s", $values[$i] }
49                 }
50                 printf "\n";
51         '
52 }
53
54 if [ $# -gt 0 ]; then
55         printf "%9s,%10s,%5s,%10s,%5s,%10s,%5s,%10s,%5s\n" files \
56                 seqCR/s scCPU seqRM/s srCPU randCR/s rcCPU randRM/s rrCPU
57         exit 0
58 fi
59
60 case "$BONNIE_FILETYPE"
61 in
62         regular)  BONNIE_FILETYPE=0 ;;
63         symlink)  BONNIE_FILETYPE=-2 ;;
64         hardlink) BONNIE_FILETYPE=-1 ;;
65         *)  echo "BONNIE_FILETYPE has an unrecognised value" && exit 1 ;;
66 esac
67
68 run_bonnie -s 0 -n $BONNIE_KFILES:$BONNIE_FILETYPE:0:$BONNIE_NDIRS