3 # Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
4 # Author: Erwan Velu <erwan@enovance.com>
6 # The license below covers all files distributed with fio unless otherwise
7 # noted in the file itself.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License version 2 as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it will 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.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 TEMPLATE=/tmp/template.fio
30 MODES="read,write,randread,randwrite"
36 echo "usage of $PROG:"
38 -h : Show this help & exit
39 -c : Enable cached-based IOs
41 -a : Run sequential test then parallel one
43 -s : Run sequential test (default value)
44 one test after another then one disk after another
46 -p : Run parallel test
47 one test after anoter but all disks at the same time
49 -d disk1[,disk2,disk3,..] : Run the tests on the selected disks
50 Separated each disk with a comma
51 Disk name shall be "sdxx", /dev/ shall NOT be used here
52 -r seconds : Time in seconds per benchmark
53 0 means till the end of the device
54 Default is 300 seconds
55 -b blocksize[,blocksize1, ...] : The blocksizes to test under fio format (4k, 1m, ...)
56 Separated each blocksize with a comma
58 -m mode1,[mode2,mode3, ...] : Define the fio IO profile to use like read, write, randread, randwrite
59 Default is "read,write,randread,randwrite"
63 $PROG -d sdb,sdc,sdd,sde -a -b 4k,128k,1m -r 100 -a
65 Will generate an fio file that will run
66 - a sequential bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 4k with read,write,randread,randwrite tests
67 ETA ~ 4 tests * 4 disks * 100 seconds
68 - a sequential bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 128k with read,write,randread,randwrite tests
69 ETA ~ 4 tests * 4 disks * 100 seconds
70 - a sequential bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 1m with read,write,randread,randwrite tests
71 ETA ~ 4 tests * 4 disks * 100 seconds
72 - a parallel bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 4k with read,write,randread,randwrite tests
73 ETA ~ 4 tests * 100 seconds
74 - a parallel bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 128k with read,write,randread,randwrite tests
75 ETA ~ 4 tests * 100 seconds
76 - a parallel bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 1m with read,write,randread,randwrite tests
77 ETA ~ 4 tests * 100 seconds
79 Generating localhost-4k,128k,1m-all-read,write,randread,randwrite-sdb,sdc,sdd,sde.fio
80 Estimated Time = 6000 seconds : 1 hour 40 minutes
92 if [ "$RUNTIME" != "0" ]; then
93 cat >>$TEMPLATE << EOF
98 if [ "$CACHED_IO" = "FALSE" ]; then
99 cat >>$TEMPLATE << EOF
108 cat >> $OUTFILE << EOF
109 [$TYPE-$disk-$BLK_SIZE-seq]
114 write_bw_log=$SHORT_HOSTNAME-$BLK_SIZE-$disk-$TYPE-seq.results
115 write_iops_log=$SHORT_HOSTNAME-$BLK_SIZE-$disk-$TYPE-seq.results
117 ETA=$(($ETA + $RUNTIME))
121 for disk in $(echo $DISKS | tr "," " "); do
122 for mode in $(echo $MODES | tr "," " "); do
123 gen_seq_suite "$mode"
133 for disk in $(echo $DISKS | tr "," " "); do
134 cat >> $OUTFILE << EOF
135 [$TYPE-$disk-$BLK_SIZE-para]
139 if [ "$D" = 0 ]; then
140 echo "stonewall" >> $OUTFILE
144 cat >> $OUTFILE << EOF
147 write_bw_log=$SHORT_HOSTNAME-$BLK_SIZE-$disk-$TYPE-para.results
148 write_iops_log=$SHORT_HOSTNAME-$BLK_SIZE-$disk-$TYPE-para.results
152 ETA=$(($ETA + $RUNTIME))
157 for mode in $(echo $MODES | tr "," " "); do
158 gen_para_suite "$mode"
178 while getopts "hacpsd:b:r:m:" opt; do
191 if [ "$SEQ" = "-1" ]; then
199 if [ "$SEQ" = "-1" ]; then
213 echo "Invalid option: -$OPTARG" >&2
218 if [ "$SEQ" = "-1" ]; then
222 SHORT_HOSTNAME=$(hostname -s)
225 OUTFILE=$SHORT_HOSTNAME-$BLOCK_SIZE-all-$MODES-$DISKS.fio
229 OUTFILE=$SHORT_HOSTNAME-$BLOCK_SIZE-sequential-$MODES-$DISKS.fio
232 OUTFILE=$SHORT_HOSTNAME-$BLOCK_SIZE-parallel-$MODES-$DISKS.fio
236 if [ -z "$DISKS" ]; then
237 echo "Missing DISKS !"
238 echo "Please read the help !"
250 echo "Generating $OUTFILE"
251 cp -f $TEMPLATE $OUTFILE
254 for BLK_SIZE in $(echo $BLOCK_SIZE | tr "," " "); do
257 ETA_H=$(($ETA / 3600))
258 ETA_M=$((($ETA - ($ETA_H*3600)) / 60))
259 if [ "$ETA_M" = "0" ]; then
260 echo "Cannot estimate ETA as RUNTIME=0"
262 echo "Estimated Time = $ETA seconds : $ETA_H hour $ETA_M minutes"