Add tera/peta suffixes
authorJens Axboe <jens.axboe@oracle.com>
Fri, 17 Jul 2009 21:16:17 +0000 (23:16 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 17 Jul 2009 21:16:17 +0000 (23:16 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
HOWTO
fio.1
parse.c

diff --git a/HOWTO b/HOWTO
index 6cdd71d270cf1d63c9552cfaef0ae1024c8775a8..dc70ab6693688e4078713abd0292bb8036915035 100644 (file)
--- a/HOWTO
+++ b/HOWTO
@@ -197,21 +197,21 @@ Some parameters take an option of a given type, such as an integer or
 a string. The following types are used:
 
 str    String. This is a sequence of alpha characters.
 a string. The following types are used:
 
 str    String. This is a sequence of alpha characters.
-time   Integer with possible time postfix. In seconds unless otherwise
+time   Integer with possible time suffix. In seconds unless otherwise
        specified, use eg 10m for 10 minutes. Accepts s/m/h for seconds,
        minutes, and hours.
        specified, use eg 10m for 10 minutes. Accepts s/m/h for seconds,
        minutes, and hours.
-int    SI integer. A whole number value, which may contain a postfix
-       describing the base of the number. Accepted postfixes are k/m/g,
-       meaning kilo, mega, and giga. So if you want to specify 4096,
-       you could either write out '4096' or just give 4k. The postfixes
-       signify base 2 values, so 1024 is 1k and 1024k is 1m and so on.
-       If the option accepts an upper and lower range, use a colon ':'
-       or minus '-' to separate such values. May also include a prefix
-       to indicate numbers base. If 0x is used, the number is assumed to
-       be hexadecimal. See irange.
+int    SI integer. A whole number value, which may contain a suffix
+       describing the base of the number. Accepted suffixes are k/m/g/t/p,
+       meaning kilo, mega, giga, tera, and peta. The suffix is not case
+       sensitive. So if you want to specify 4096, you could either write
+       out '4096' or just give 4k. The suffixes signify base 2 values, so
+       1024 is 1k and 1024k is 1m and so on. If the option accepts an upper
+       and lower range, use a colon ':' or minus '-' to separate such values.
+       May also include a prefix to indicate numbers base. If 0x is used,
+       the number is assumed to be hexadecimal. See irange.
 bool   Boolean. Usually parsed as an integer, however only defined for
        true and false (1 and 0).
 bool   Boolean. Usually parsed as an integer, however only defined for
        true and false (1 and 0).
-irange Integer range with postfix. Allows value range to be given, such
+irange Integer range with suffix. Allows value range to be given, such
        as 1024-4096. A colon may also be used as the separator, eg
        1k:4k. If the option allows two sets of ranges, they can be
        specified with a ',' or '/' delimiter: 1k-4k/8k-32k. Also see
        as 1024-4096. A colon may also be used as the separator, eg
        1k:4k. If the option allows two sets of ranges, they can be
        specified with a ',' or '/' delimiter: 1k-4k/8k-32k. Also see
@@ -600,7 +600,7 @@ thinktime_blocks
                after every block.
 
 rate=int       Cap the bandwidth used by this job. The number is in bytes/sec,
                after every block.
 
 rate=int       Cap the bandwidth used by this job. The number is in bytes/sec,
-               the normal postfix rules apply. You can use rate=500k to limit
+               the normal suffix rules apply. You can use rate=500k to limit
                reads and writes to 500k each, or you can specify read and
                writes separately. Using rate=1m,500k would limit reads to
                1MB/sec and writes to 500KB/sec. Capping only reads or
                reads and writes to 500k each, or you can specify read and
                writes separately. Using rate=1m,500k would limit reads to
                1MB/sec and writes to 500KB/sec. Capping only reads or
diff --git a/fio.1 b/fio.1
index 497db5393eba0233dbba3f3a06b0beb63ed17d42..b3925b5f19b766b3cdba94ceca463e01adcde58b 100644 (file)
--- a/fio.1
+++ b/fio.1
@@ -78,9 +78,10 @@ String: a sequence of alphanumeric characters.
 .TP
 .I int
 SI integer: a whole number, possibly containing a suffix denoting the base unit
 .TP
 .I int
 SI integer: a whole number, possibly containing a suffix denoting the base unit
-of the value.  Accepted suffixes are `k', 'M' and 'G', denoting kilo (1024),
-mega (1024*1024) and giga (1024*1024*1024) respectively. If prefixed with '0x',
-the value is assumed to be base 16 (hexadecimal).
+of the value.  Accepted suffixes are `k', 'M', 'G', 'T', and 'P', denoting
+kilo (1024), mega (1024^2), giga (1024^3), tera (1024^4), and peta (1024^5)
+respectively. The suffix is not case sensitive. If prefixed with '0x', the
+value is assumed to be base 16 (hexadecimal).
 .TP
 .I bool
 Boolean: a true or false value. `0' denotes false, `1' denotes true.
 .TP
 .I bool
 Boolean: a true or false value. `0' denotes false, `1' denotes true.
diff --git a/parse.c b/parse.c
index 29f444b40ba1d6589a2d1a9813ab0bfb058d73f1..2a49b63c1065c30bde38bd664f6bd622f859f04b 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -112,7 +112,7 @@ static unsigned long get_mult_time(char c)
        }
 }
 
        }
 }
 
-static unsigned long get_mult_bytes(char c)
+static unsigned long long get_mult_bytes(char c)
 {
        switch (c) {
        case 'k':
 {
        switch (c) {
        case 'k':
@@ -124,9 +124,12 @@ static unsigned long get_mult_bytes(char c)
        case 'g':
        case 'G':
                return 1024 * 1024 * 1024;
        case 'g':
        case 'G':
                return 1024 * 1024 * 1024;
-       case 'e':
-       case 'E':
+       case 't':
+       case 'T':
                return 1024 * 1024 * 1024 * 1024UL;
                return 1024 * 1024 * 1024 * 1024UL;
+       case 'p':
+       case 'P':
+               return 1024 * 1024 * 1024 * 1024ULL * 1024ULL;
        default:
                return 1;
        }
        default:
                return 1;
        }