Fix up output for mkfs failure with logsize not a multiple
[xfstests-dev.git] / common.dbench
1 ##/bin/sh
2
3 _run_dbench()
4 {
5         mkdir ./dbench || exit 1
6         cd dbench
7         dbench $1
8         status=$?
9         cd ..
10         rm -fr ./dbench
11         [ $status -ne 0 ] && exit 1
12 }
13
14 #
15 # Sample dbench output:
16 # "Throughput 40.6701 MB/sec (NB=50.8376 MB/sec  406.701 MBit/sec)"
17
18
19 # Output for a single-shot dbench run.
20 _format_header()
21 {
22         printf "%8s, %s\n" clients MB/sec
23 }
24 _filter_dbench()
25 {
26         clients=$1
27         perl -ne 'm/Throughput (\S+) MB\/sec/ &&
28                         { printf "%8u, %s\n", '$clients', $1 }'
29 }
30
31 # Output for a "multipass" dbench run.
32 _format_header_multipass()
33 {
34         while [ $# -gt 1 ]; do
35                 printf "%4s::MB/sec," $1
36                 shift
37         done
38         printf "%4s::MB/sec\n" $1
39 }
40 _filter_dbench_multipass()
41 {
42         perl -ne '
43         if (m/Throughput (\S+) MB\/sec/) {
44                 $results[$count++] = $1;
45         }
46         END {   for ($i = 0; $i < $count - 1; $i++) {
47                         printf "%12.3f,", $results[$i];
48                 }
49                 printf "%12.3f\n", $results[$count-1];
50         }'
51 }