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
40 by default, fio is run in direct mode
41 -a : Run sequential test then parallel one
42 -s : Run sequential test (default value)
43 one test after another then one disk after another
44 -p : Run parallel test
45 one test after anoter but all disks at the same time
46 -d disk1[,disk2,disk3,..] : Run the tests on the selected disks
47 Separated each disk with a comma
48 Disk name shall be "sdxx", /dev/ shall NOT be used here
49 -r seconds : Time in seconds per benchmark (300 as default)
50 0 means till the end of the device
51 -b blocksize[,blocksize1, ...] : The blocksizes to test under fio format (4k, 1m, ...)
52 Separated each blocksize with a comma
53 -m mode1,[mode2,mode3, ...] : Define the fio IO profile to use like read, write, randread, randwrite
57 $PROG -d sdb,sdc,sdd,sde -a -b 4k,128k,1m -r 100 -a
59 Will generate an fio file that will run
60 - a sequential bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 4k with read,write,randread,randwrite tests
61 ETA ~ 4 tests * 4 disks * 100 seconds
62 - a sequential bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 128k with read,write,randread,randwrite tests
63 ETA ~ 4 tests * 4 disks * 100 seconds
64 - a sequential bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 1m with read,write,randread,randwrite tests
65 ETA ~ 4 tests * 4 disks * 100 seconds
66 - a parallel bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 4k with read,write,randread,randwrite tests
67 ETA ~ 4 tests * 100 seconds
68 - a parallel bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 128k with read,write,randread,randwrite tests
69 ETA ~ 4 tests * 100 seconds
70 - a parallel bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 1m with read,write,randread,randwrite tests
71 ETA ~ 4 tests * 100 seconds
73 Generating localhost-4k,128k,1m-all-read,write,randread,randwrite-sdb,sdc,sdd,sde.fio
74 Estimated Time = 6000 seconds : 1 hour 40 minutes
86 if [ "$RUNTIME" != "0" ]; then
87 cat >>$TEMPLATE << EOF
92 if [ "$CACHED_IO" = "FALSE" ]; then
93 cat >>$TEMPLATE << EOF
102 cat >> $OUTFILE << EOF
103 [$TYPE-$disk-$BLK_SIZE-seq]
108 write_bw_log=$SHORT_HOSTNAME-$BLK_SIZE-$disk-$TYPE-seq.results
109 write_iops_log=$SHORT_HOSTNAME-$BLK_SIZE-$disk-$TYPE-seq.results
111 ETA=$(($ETA + $RUNTIME))
115 for disk in $(echo $DISKS | tr "," " "); do
116 for mode in $(echo $MODES | tr "," " "); do
117 gen_seq_suite "$mode"
127 for disk in $(echo $DISKS | tr "," " "); do
128 cat >> $OUTFILE << EOF
129 [$TYPE-$disk-$BLK_SIZE-para]
133 if [ "$D" = 0 ]; then
134 echo "stonewall" >> $OUTFILE
138 cat >> $OUTFILE << EOF
141 write_bw_log=$SHORT_HOSTNAME-$BLK_SIZE-$disk-$TYPE-para.results
142 write_iops_log=$SHORT_HOSTNAME-$BLK_SIZE-$disk-$TYPE-para.results
146 ETA=$(($ETA + $RUNTIME))
151 for mode in $(echo $MODES | tr "," " "); do
152 gen_para_suite "$mode"
172 while getopts "hacpsd:b:r:m:" opt; do
185 if [ "$SEQ" = "-1" ]; then
193 if [ "$SEQ" = "-1" ]; then
207 echo "Invalid option: -$OPTARG" >&2
212 if [ "$SEQ" = "-1" ]; then
216 SHORT_HOSTNAME=$(hostname -s)
219 OUTFILE=$SHORT_HOSTNAME-$BLOCK_SIZE-all-$MODES-$DISKS.fio
223 OUTFILE=$SHORT_HOSTNAME-$BLOCK_SIZE-sequential-$MODES-$DISKS.fio
226 OUTFILE=$SHORT_HOSTNAME-$BLOCK_SIZE-parallel-$MODES-$DISKS.fio
230 if [ -z "$DISKS" ]; then
231 echo "Missing DISKS !"
243 echo "Generating $OUTFILE"
244 cp -f $TEMPLATE $OUTFILE
247 for BLK_SIZE in $(echo $BLOCK_SIZE | tr "," " "); do
250 ETA_H=$(($ETA / 3600))
251 ETA_M=$((($ETA - ($ETA_H*3600)) / 60))
252 if [ "$ETA_M" = "0" ]; then
253 echo "Cannot estimate ETA as RUNTIME=0"
255 echo "Estimated Time = $ETA seconds : $ETA_H hour $ETA_M minutes"