Bruce Cran | c60587f | 2013-11-04 11:52:08 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 2 | # |
| 3 | # Copyright (C) 2013 eNovance SAS <licensing@enovance.com> |
| 4 | # Author: Erwan Velu <erwan@enovance.com> |
| 5 | # |
| 6 | # The license below covers all files distributed with fio unless otherwise |
| 7 | # noted in the file itself. |
| 8 | # |
| 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. |
| 12 | # |
| 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. |
| 17 | # |
| 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 |
| 21 | |
| 22 | BLK_SIZE= |
| 23 | BLOCK_SIZE=4k |
| 24 | SEQ=-1 |
| 25 | TEMPLATE=/tmp/template.fio |
| 26 | OUTFILE= |
| 27 | DISKS= |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 28 | PRINTABLE_DISKS= |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 29 | RUNTIME=300 |
| 30 | ETA=0 |
Erwan Velu | 60238f0 | 2013-07-12 15:21:25 +0200 | [diff] [blame] | 31 | MODES="write,randwrite,read,randread" |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 32 | SHORT_HOSTNAME= |
Erwan Velu | 76c7c63 | 2013-07-10 16:44:24 +0200 | [diff] [blame] | 33 | CACHED_IO="FALSE" |
Erwan Velu | a741983 | 2013-07-11 09:56:28 +0200 | [diff] [blame] | 34 | PREFIX="" |
| 35 | PREFIX_FILENAME="" |
Erwan Velu | 7d1ca6c | 2013-07-12 17:01:31 +0200 | [diff] [blame] | 36 | IODEPTH=1 |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 37 | |
| 38 | show_help() { |
| 39 | PROG=$(basename $0) |
| 40 | echo "usage of $PROG:" |
| 41 | cat << EOF |
| 42 | -h : Show this help & exit |
Erwan Velu | 76c7c63 | 2013-07-10 16:44:24 +0200 | [diff] [blame] | 43 | -c : Enable cached-based IOs |
Erwan Velu | e1c6f2e | 2013-07-10 16:50:20 +0200 | [diff] [blame] | 44 | Disabled by default |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 45 | -a : Run sequential test then parallel one |
Erwan Velu | e1c6f2e | 2013-07-10 16:50:20 +0200 | [diff] [blame] | 46 | Disabled by default |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 47 | -s : Run sequential test (default value) |
| 48 | one test after another then one disk after another |
Erwan Velu | e1c6f2e | 2013-07-10 16:50:20 +0200 | [diff] [blame] | 49 | Disabled by default |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 50 | -p : Run parallel test |
| 51 | one test after anoter but all disks at the same time |
Erwan Velu | e1c6f2e | 2013-07-10 16:50:20 +0200 | [diff] [blame] | 52 | Enabled by default |
Erwan Velu | 7d1ca6c | 2013-07-12 17:01:31 +0200 | [diff] [blame] | 53 | -D iodepth : Run with the specified iodepth |
Erwan Velu | 80139d2 | 2013-07-15 12:03:55 +0200 | [diff] [blame] | 54 | Default is $IODEPTH |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 55 | -d disk1[,disk2,disk3,..] : Run the tests on the selected disks |
| 56 | Separated each disk with a comma |
Erwan Velu | e1c6f2e | 2013-07-10 16:50:20 +0200 | [diff] [blame] | 57 | -r seconds : Time in seconds per benchmark |
Erwan Velu | 72fe3ef | 2013-07-10 16:38:33 +0200 | [diff] [blame] | 58 | 0 means till the end of the device |
Erwan Velu | 80139d2 | 2013-07-15 12:03:55 +0200 | [diff] [blame] | 59 | Default is $RUNTIME seconds |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 60 | -b blocksize[,blocksize1, ...] : The blocksizes to test under fio format (4k, 1m, ...) |
| 61 | Separated each blocksize with a comma |
Erwan Velu | 80139d2 | 2013-07-15 12:03:55 +0200 | [diff] [blame] | 62 | Default is $BLOCK_SIZE |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 63 | -m mode1,[mode2,mode3, ...] : Define the fio IO profile to use like read, write, randread, randwrite |
Erwan Velu | 80139d2 | 2013-07-15 12:03:55 +0200 | [diff] [blame] | 64 | Default is "$MODES" |
Erwan Velu | a741983 | 2013-07-11 09:56:28 +0200 | [diff] [blame] | 65 | -x prefix : Add a prefix to the fio filename |
| 66 | Useful to let a context associated with the file |
| 67 | If the prefix features a / (slash), prefix will be considered as a directory |
Erwan Velu | ca14375 | 2013-07-15 11:10:27 +0200 | [diff] [blame] | 68 | -A cmd_to_run : System command to run after each job (exec_postrun in fio) |
| 69 | -B cmd_to_run : System command to run before each job (exec_prerun in fio) |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 70 | |
| 71 | Example: |
| 72 | |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 73 | $PROG -d /dev/sdb,/dev/sdc,/dev/sdd,/dev/sde -a -b 4k,128k,1m -r 100 -a -x dellr720-day2/ |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 74 | |
| 75 | Will generate an fio file that will run |
Erwan Velu | 60238f0 | 2013-07-12 15:21:25 +0200 | [diff] [blame] | 76 | - a sequential bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 4k with write,randwrite,read,randread tests |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 77 | ETA ~ 4 tests * 4 disks * 100 seconds |
Erwan Velu | 60238f0 | 2013-07-12 15:21:25 +0200 | [diff] [blame] | 78 | - a sequential bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 128k with write,randwrite,read,randread tests |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 79 | ETA ~ 4 tests * 4 disks * 100 seconds |
Erwan Velu | 60238f0 | 2013-07-12 15:21:25 +0200 | [diff] [blame] | 80 | - a sequential bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 1m with write,randwrite,read,randread tests |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 81 | ETA ~ 4 tests * 4 disks * 100 seconds |
Erwan Velu | 60238f0 | 2013-07-12 15:21:25 +0200 | [diff] [blame] | 82 | - a parallel bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 4k with write,randwrite,read,randread tests |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 83 | ETA ~ 4 tests * 100 seconds |
Erwan Velu | 60238f0 | 2013-07-12 15:21:25 +0200 | [diff] [blame] | 84 | - a parallel bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 128k with write,randwrite,read,randread tests |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 85 | ETA ~ 4 tests * 100 seconds |
Erwan Velu | 60238f0 | 2013-07-12 15:21:25 +0200 | [diff] [blame] | 86 | - a parallel bench on /dev/sdb /dev/sdc /dev/sdd /dev/sde for block size = 1m with write,randwrite,read,randread tests |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 87 | ETA ~ 4 tests * 100 seconds |
| 88 | |
Erwan Velu | 60238f0 | 2013-07-12 15:21:25 +0200 | [diff] [blame] | 89 | Generating dellr720-day2/localhost-4k,128k,1m-all-write,randwrite,read,randread-sdb,sdc,sdd,sde.fio |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 90 | Estimated Time = 6000 seconds : 1 hour 40 minutes |
| 91 | EOF |
| 92 | } |
| 93 | |
Erwan Velu | fdc0f3b | 2013-07-15 10:44:58 +0200 | [diff] [blame] | 94 | finish_template() { |
Erwan Velu | ea0542d | 2013-07-15 11:14:39 +0200 | [diff] [blame] | 95 | echo "iodepth=$IODEPTH" >> $TEMPLATE |
Erwan Velu | 72fe3ef | 2013-07-10 16:38:33 +0200 | [diff] [blame] | 96 | |
| 97 | if [ "$RUNTIME" != "0" ]; then |
Erwan Velu | ea0542d | 2013-07-15 11:14:39 +0200 | [diff] [blame] | 98 | echo "runtime=$RUNTIME" >> $TEMPLATE |
| 99 | echo "time_based" >> $TEMPLATE |
Erwan Velu | 72fe3ef | 2013-07-10 16:38:33 +0200 | [diff] [blame] | 100 | fi |
| 101 | |
Erwan Velu | 76c7c63 | 2013-07-10 16:44:24 +0200 | [diff] [blame] | 102 | if [ "$CACHED_IO" = "FALSE" ]; then |
Erwan Velu | ea0542d | 2013-07-15 11:14:39 +0200 | [diff] [blame] | 103 | echo "direct=1" >> $TEMPLATE |
Erwan Velu | 76c7c63 | 2013-07-10 16:44:24 +0200 | [diff] [blame] | 104 | fi |
Erwan Velu | fdc0f3b | 2013-07-15 10:44:58 +0200 | [diff] [blame] | 105 | } |
Erwan Velu | 76c7c63 | 2013-07-10 16:44:24 +0200 | [diff] [blame] | 106 | |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 107 | |
| 108 | diskname_to_printable() { |
| 109 | COUNT=0 |
| 110 | for disk in $(echo $@ | tr "," " "); do |
| 111 | R=$(basename $disk | sed 's|/|_|g') |
| 112 | COUNT=$(($COUNT + 1)) |
| 113 | if [ $COUNT -eq 1 ]; then |
| 114 | P="$R" |
| 115 | else |
| 116 | P="$P,$R" |
| 117 | fi |
| 118 | done |
| 119 | echo $P |
| 120 | } |
| 121 | |
Erwan Velu | fdc0f3b | 2013-07-15 10:44:58 +0200 | [diff] [blame] | 122 | gen_template() { |
| 123 | cat >$TEMPLATE << EOF |
| 124 | [global] |
| 125 | ioengine=libaio |
| 126 | invalidate=1 |
| 127 | ramp_time=5 |
| 128 | EOF |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | gen_seq_suite() { |
| 132 | TYPE=$1 |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 133 | disk=$2 |
| 134 | PRINTABLE_DISK=$(diskname_to_printable $disk) |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 135 | cat >> $OUTFILE << EOF |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 136 | [$TYPE-$PRINTABLE_DISK-$BLK_SIZE-seq] |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 137 | stonewall |
| 138 | bs=$BLK_SIZE |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 139 | filename=$disk |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 140 | rw=$TYPE |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 141 | write_bw_log=${PREFIX_FILENAME}$SHORT_HOSTNAME-$BLK_SIZE-$PRINTABLE_DISK-$TYPE-seq.results |
| 142 | write_iops_log=${PREFIX_FILENAME}$SHORT_HOSTNAME-$BLK_SIZE-$PRINTABLE_DISK-$TYPE-seq.results |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 143 | EOF |
| 144 | ETA=$(($ETA + $RUNTIME)) |
| 145 | } |
| 146 | |
| 147 | gen_seq_fio() { |
| 148 | for disk in $(echo $DISKS | tr "," " "); do |
| 149 | for mode in $(echo $MODES | tr "," " "); do |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 150 | gen_seq_suite "$mode" "$disk" |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 151 | done |
| 152 | done |
| 153 | } |
| 154 | |
| 155 | |
| 156 | gen_para_suite() { |
| 157 | TYPE=$1 |
| 158 | NEED_WALL=$2 |
| 159 | D=0 |
| 160 | for disk in $(echo $DISKS | tr "," " "); do |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 161 | PRINTABLE_DISK=$(diskname_to_printable $disk) |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 162 | cat >> $OUTFILE << EOF |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 163 | [$TYPE-$PRINTABLE_DISK-$BLK_SIZE-para] |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 164 | bs=$BLK_SIZE |
| 165 | EOF |
| 166 | |
| 167 | if [ "$D" = 0 ]; then |
| 168 | echo "stonewall" >> $OUTFILE |
| 169 | D=1 |
| 170 | fi |
| 171 | |
| 172 | cat >> $OUTFILE << EOF |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 173 | filename=$disk |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 174 | rw=$TYPE |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 175 | write_bw_log=${PREFIX_FILENAME}$SHORT_HOSTNAME-$BLK_SIZE-$PRINTABLE_DISK-$TYPE-para.results |
| 176 | write_iops_log=${PREFIX_FILENAME}$SHORT_HOSTNAME-$BLK_SIZE-$PRINTABLE_DISK-$TYPE-para.results |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 177 | EOF |
| 178 | done |
| 179 | |
| 180 | ETA=$(($ETA + $RUNTIME)) |
| 181 | echo >> $OUTFILE |
| 182 | } |
| 183 | |
| 184 | gen_para_fio() { |
| 185 | for mode in $(echo $MODES | tr "," " "); do |
| 186 | gen_para_suite "$mode" |
| 187 | done |
| 188 | } |
| 189 | |
| 190 | gen_fio() { |
| 191 | case $SEQ in |
| 192 | 2) |
| 193 | gen_seq_fio |
| 194 | gen_para_fio |
| 195 | ;; |
| 196 | 1) |
| 197 | gen_seq_fio |
| 198 | ;; |
| 199 | 0) |
| 200 | gen_para_fio |
| 201 | ;; |
| 202 | esac |
| 203 | } |
| 204 | |
| 205 | parse_cmdline() { |
Erwan Velu | ca14375 | 2013-07-15 11:10:27 +0200 | [diff] [blame] | 206 | while getopts "hacpsd:b:r:m:x:D:A:B:" opt; do |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 207 | case $opt in |
| 208 | h) |
| 209 | show_help |
| 210 | exit 0 |
| 211 | ;; |
| 212 | b) |
| 213 | BLOCK_SIZE=$OPTARG |
| 214 | ;; |
Erwan Velu | 76c7c63 | 2013-07-10 16:44:24 +0200 | [diff] [blame] | 215 | c) |
| 216 | CACHED_IO="TRUE" |
| 217 | ;; |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 218 | s) |
| 219 | if [ "$SEQ" = "-1" ]; then |
| 220 | SEQ=1 |
| 221 | fi |
| 222 | ;; |
Erwan Velu | a741983 | 2013-07-11 09:56:28 +0200 | [diff] [blame] | 223 | x) |
| 224 | PREFIX=$OPTARG |
| 225 | echo "$PREFIX" | grep -q "/" |
| 226 | if [ "$?" -eq 0 ]; then |
| 227 | mkdir -p $PREFIX |
| 228 | # No need to keep the prefix for the log files |
| 229 | # we do have a directory for that |
| 230 | PREFIX_FILENAME="" |
| 231 | else |
| 232 | # We need to keep the prefix for the log files |
| 233 | PREFIX_FILENAME=$PREFIX |
| 234 | fi |
| 235 | ;; |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 236 | r) |
| 237 | RUNTIME=$OPTARG |
| 238 | ;; |
| 239 | p) |
| 240 | if [ "$SEQ" = "-1" ]; then |
| 241 | SEQ=0 |
| 242 | fi |
| 243 | ;; |
| 244 | m) |
| 245 | MODES=$OPTARG; |
| 246 | ;; |
| 247 | d) |
| 248 | DISKS=$OPTARG |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 249 | PRINTABLE_DISKS=$(diskname_to_printable "$DISKS") |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 250 | ;; |
Erwan Velu | 7d1ca6c | 2013-07-12 17:01:31 +0200 | [diff] [blame] | 251 | D) |
| 252 | IODEPTH=$OPTARG |
| 253 | ;; |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 254 | a) |
| 255 | SEQ=2 |
| 256 | ;; |
Erwan Velu | ca14375 | 2013-07-15 11:10:27 +0200 | [diff] [blame] | 257 | B) |
| 258 | echo "exec_prerun=$OPTARG" >> $TEMPLATE |
| 259 | ;; |
| 260 | A) |
| 261 | echo "exec_postrun=$OPTARG" >> $TEMPLATE |
| 262 | ;; |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 263 | \?) |
| 264 | echo "Invalid option: -$OPTARG" >&2 |
| 265 | ;; |
| 266 | esac |
| 267 | done |
| 268 | |
| 269 | if [ "$SEQ" = "-1" ]; then |
| 270 | SEQ=0 |
| 271 | fi |
| 272 | |
| 273 | SHORT_HOSTNAME=$(hostname -s) |
| 274 | case $SEQ in |
| 275 | 2) |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 276 | OUTFILE=${PREFIX}$SHORT_HOSTNAME-$BLOCK_SIZE-all-$MODES-$PRINTABLE_DISKS.fio |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 277 | ;; |
| 278 | |
| 279 | 1) |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 280 | OUTFILE=${PREFIX}$SHORT_HOSTNAME-$BLOCK_SIZE-sequential-$MODES-$PRINTABLE_DISKS.fio |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 281 | ;; |
| 282 | 0) |
Erwan Velu | bed59ba | 2013-08-08 10:59:46 +0200 | [diff] [blame] | 283 | OUTFILE=${PREFIX}$SHORT_HOSTNAME-$BLOCK_SIZE-parallel-$MODES-$PRINTABLE_DISKS.fio |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 284 | ;; |
| 285 | esac |
| 286 | |
| 287 | if [ -z "$DISKS" ]; then |
| 288 | echo "Missing DISKS !" |
Erwan Velu | e1c6f2e | 2013-07-10 16:50:20 +0200 | [diff] [blame] | 289 | echo "Please read the help !" |
| 290 | show_help |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 291 | exit 1 |
| 292 | fi |
| 293 | |
| 294 | } |
| 295 | |
Erwan Velu | 60238f0 | 2013-07-12 15:21:25 +0200 | [diff] [blame] | 296 | check_mode_order() { |
| 297 | FOUND_WRITE="NO" |
| 298 | CAUSE="You are reading data before writing them " |
| 299 | |
| 300 | # If no write occurs, let's show a different message |
| 301 | echo $MODES | grep -q "write" |
| 302 | if [ "$?" -ne 0 ]; then |
| 303 | CAUSE="You are reading data while never wrote them before" |
| 304 | fi |
| 305 | |
| 306 | for mode in $(echo $MODES | tr "," " "); do |
| 307 | echo $mode | grep -q write |
| 308 | if [ "$?" -eq 0 ]; then |
| 309 | FOUND_WRITE="YES" |
| 310 | fi |
| 311 | echo $mode | grep -q "read" |
| 312 | if [ "$?" -eq 0 ]; then |
| 313 | if [ "$FOUND_WRITE" = "NO" ]; then |
| 314 | echo "###############################################################" |
| 315 | echo "# Warning : $CAUSE#" |
| 316 | echo "# On some storage devices, this could lead to invalid results #" |
| 317 | echo "# #" |
| 318 | echo "# Press Ctrl-C to adjust pattern order if you have doubts #" |
| 319 | echo "# Or Wait 5 seconds before the file will be created #" |
| 320 | echo "###############################################################" |
| 321 | sleep 5 |
| 322 | # No need to try showing the message more than one time |
| 323 | return |
| 324 | fi |
| 325 | fi |
| 326 | done |
| 327 | } |
| 328 | |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 329 | |
| 330 | ########## MAIN |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 331 | gen_template |
Erwan Velu | 3b73c53 | 2013-07-15 12:33:44 +0200 | [diff] [blame] | 332 | parse_cmdline "$@" |
Erwan Velu | fdc0f3b | 2013-07-15 10:44:58 +0200 | [diff] [blame] | 333 | finish_template |
| 334 | check_mode_order |
Erwan Velu | afbbd64 | 2013-06-25 17:47:01 +0200 | [diff] [blame] | 335 | |
| 336 | echo "Generating $OUTFILE" |
| 337 | cp -f $TEMPLATE $OUTFILE |
| 338 | echo >> $OUTFILE |
| 339 | |
| 340 | for BLK_SIZE in $(echo $BLOCK_SIZE | tr "," " "); do |
| 341 | gen_fio |
| 342 | done |
| 343 | ETA_H=$(($ETA / 3600)) |
| 344 | ETA_M=$((($ETA - ($ETA_H*3600)) / 60)) |
Erwan Velu | af360e3 | 2013-07-11 10:16:05 +0200 | [diff] [blame] | 345 | if [ "$ETA" = "0" ]; then |
Erwan Velu | 72fe3ef | 2013-07-10 16:38:33 +0200 | [diff] [blame] | 346 | echo "Cannot estimate ETA as RUNTIME=0" |
| 347 | else |
| 348 | echo "Estimated Time = $ETA seconds : $ETA_H hour $ETA_M minutes" |
| 349 | fi |