genfio: Enforce time_based if runtime > 0
[fio.git] / tools / genfio
index 123f6e42a6025fbff8f84483b0c5cb3a34524de5..6d3220daf1a4d93568a20f5950272a8f1198ac37 100755 (executable)
@@ -32,6 +32,7 @@ SHORT_HOSTNAME=
 CACHED_IO="FALSE"
 PREFIX=""
 PREFIX_FILENAME=""
+IODEPTH=1
 
 show_help() {
        PROG=$(basename $0)
@@ -48,6 +49,8 @@ show_help() {
 -p                             : Run parallel test
                                        one test after anoter but all disks at the same time
                                        Enabled by default
+-D iodepth                     : Run with the specified iodepth
+                                       Default is 32
 -d disk1[,disk2,disk3,..]      : Run the tests on the selected disks
                                        Separated each disk with a comma
                                        Disk name shall be "sdxx", /dev/ shall NOT be used here
@@ -90,6 +93,7 @@ gen_template() {
 cat >$TEMPLATE << EOF
 [global]
 ioengine=libaio
+iodepth=$IODEPTH
 invalidate=1
 ramp_time=5
 EOF
@@ -97,6 +101,7 @@ EOF
 if [ "$RUNTIME" != "0" ]; then
 cat >>$TEMPLATE << EOF
 runtime=$RUNTIME
+time_based
 EOF
 fi
 
@@ -180,7 +185,7 @@ esac
 }
 
 parse_cmdline() {
-while getopts "hacpsd:b:r:m:x:" opt; do
+while getopts "hacpsd:b:r:m:x:D:" opt; do
   case $opt in
     h)
        show_help
@@ -224,6 +229,9 @@ while getopts "hacpsd:b:r:m:x:" opt; do
     d)
        DISKS=$OPTARG
       ;;
+    D)
+       IODEPTH=$OPTARG
+      ;;
     a)
        SEQ=2
       ;;