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.
11 # The script then massages the output into CSV format with the
12 # human-readable output preceding it as a "comment" (#-prefixed).
14 BONNIE_NDIRS=${BONNIE_NDIRS:=1}
15 BONNIE_KFILES=${BONNIE_KFILES:=8}
16 BONNIE_FILETYPE=${BONNIE_FILETYPE:=regular}
21 # Sample bonnie throughput output (stderr):
22 #Version 1.02c ------Sequential Create------ --------Random Create--------
23 # -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
24 # files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
25 # 4 525 27 +++++ +++ 517 26 526 25 +++++ +++ 230 12
26 # [ Note: the "files" can also be "^files:max" and possibly other things ]
29 sed -e 's/^..................../# /g' | awk '{print} END {print "#"}'
33 # Sample bonnie IOPs output (stdout):
34 # ",,,,,,,,,,,,,,4,525,27,+++++,+++,517,26,526,25,+++++,+++,230,12"
35 # [ nathans note: always get +++ due to 0:0 for min:max file sizes. ]
36 # [ I will need to fix the filter if I ever start using file sizes. ]
40 tr -d '+' | tr -d \' | tr -s ',' | sed -e 's/^,//' -e 's/,$//'
44 echo Kfiles/dirs,seqCR/s,scCPU,seqRM/s,srCPU,rndmCR/s,rcCPU,rndmRM/s,rrCPU
48 case "$BONNIE_FILETYPE"
50 regular) BONNIE_FILETYPE=0 ;;
51 symlink) BONNIE_FILETYPE=-2 ;;
52 hardlink) BONNIE_FILETYPE=-1 ;;
53 *) echo "BONNIE_FILETYPE has an unrecognised value" && exit 1 ;;
56 run_bonnie -s 0 -n $BONNIE_KFILES:$BONNIE_FILETYPE:0:$BONNIE_NDIRS