Add a test to run fsx with the AIO flag switched on, in combination with various...
[xfstests-dev.git] / common.dbench
1 ##/bin/sh
2
3 #check dbench is installed
4 if [ "`whereis dbench`" == "dbench:"]; then
5         echo $0 error dbench not installed.
6         exit
7 fi
8
9 _run_dbench()
10 {
11         mkdir ./dbench || exit 1
12         cd dbench
13         dbench -x $1
14         status=$?
15         cd ..
16         rm -fr ./dbench
17         [ $status -ne 0 ] && exit 1
18 }
19
20 #
21 # Sample dbench output:
22 # "Throughput 40.6701 MB/sec (NB=50.8376 MB/sec  406.701 MBit/sec)"
23
24
25 # Output for a single-shot dbench run.
26 _format_header()
27 {
28         printf "%8s, %s\n" clients MB/sec
29 }
30 _filter_dbench()
31 {
32         clients=$1
33         perl -ne 'm/Throughput (\S+) MB\/sec/ &&
34                         { printf "%8u, %s\n", '$clients', $1 }'
35 }
36
37 # Output for a "multipass" dbench run.
38 _format_header_multipass()
39 {
40         while [ $# -gt 1 ]; do
41                 printf "%4s::MB/sec," $1
42                 shift
43         done
44         printf "%4s::MB/sec\n" $1
45 }
46 _filter_dbench_multipass()
47 {
48         perl -ne '
49         if (m/Throughput (\S+) MB\/sec/) {
50                 $results[$count++] = $1;
51         }
52         END {   for ($i = 0; $i < $count - 1; $i++) {
53                         printf "%12.3f,", $results[$i];
54                 }
55                 printf "%12.3f\n", $results[$count-1];
56         }'
57 }