perf: a random write buffered fio perf test
[xfstests-dev.git] / tests / perf / 001
1 #! /bin/bash
2 # perf/001 Test
3 #
4 # Buffered random write performance test.
5 #
6 #-----------------------------------------------------------------------
7 # (c) 2017 Josef Bacik
8 #
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24
25 seq=`basename $0`
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
28
29 here=`pwd`
30 tmp=/tmp/$$
31 fio_config=$tmp.fio
32 fio_results=$tmp.json
33 status=1        # failure is the default!
34 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35
36 # get standard environment, filters and checks
37 . ./common/rc
38 . ./common/filter
39 . ./common/perf
40
41 # real QA test starts here
42 _supported_fs generic
43 _supported_os Linux
44 _require_scratch
45 _require_block_device $SCRATCH_DEV
46 _require_fio_results
47
48 rm -f $seqres.full
49
50 _size=$((16 * $LOAD_FACTOR))
51 cat >$fio_config <<EOF
52 [t1]
53 directory=${SCRATCH_MNT}
54 allrandrepeat=1
55 readwrite=randwrite
56 size=${_size}G
57 ioengine=psync
58 end_fsync=1
59 fallocate=none
60 EOF
61
62 _require_fio $fio_config
63
64 _fio_results_init
65
66 # We are going to write at least 16gib, make sure our scratch fs is large enough
67 # to fit and not deal with any enospc overhead.
68 _size=$(($_size * 4 * 1024 * 1024))
69 _scratch_mkfs >> $seqres.full 2>&1
70 _scratch_mount
71 _require_fs_space $SCRATCH_MNT $_size
72
73 cat $fio_config >> $seqres.full
74 $FIO_PROG --output-format=json --output=$fio_results $fio_config
75
76 _scratch_unmount
77 cat $fio_results >> $seqres.full
78 _fio_results_compare $seq $fio_results
79 echo "Silence is golden"
80 status=0; exit