tests, profiles: Use IEC prefixes for binary multiples
authorRobert Elliott <elliott@hpe.com>
Thu, 22 Dec 2016 20:50:43 +0000 (14:50 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 3 Jan 2017 01:19:49 +0000 (18:19 -0700)
Use IEC 80000-13 prefixes for binary multiples of bytes
(KiB, MiB, etc.) rather than SI prefixes for decimal multiples
of bytes (KB, MB, etc.) in places in which the code has fixed
divide by 1024, 1024*1024, >>20, etc.  and is clearly always
using binary multiples.

Signed-off-by: Jens Axboe <axboe@fb.com>
crc/test.c
profiles/act.c
profiles/tiobench.c
t/btrace2fio.c
t/dedupe.c
t/genzipf.c
t/lfsr-test.c
t/memlock.c
t/read-to-pipe-async.c

index 213b5d5ff72939be77bd1c3ad47069b1c7feb4a9..300000d2c153b5417d5a2f3788fa9722ea42a69e 100644 (file)
@@ -338,9 +338,9 @@ int fio_crctest(const char *type)
                                sprintf(pre, "\t");
                        else
                                sprintf(pre, "\t\t");
-                       printf("%s:%s%8.2f MB/sec\n", t[i].name, pre, mb_sec);
+                       printf("%s:%s%8.2f MiB/sec\n", t[i].name, pre, mb_sec);
                } else
-                       printf("%s:inf MB/sec\n", t[i].name);
+                       printf("%s:inf MiB/sec\n", t[i].name);
                first = 0;
        }
 
index 58ae7af9b86c6b9241c0af9099283bb0d646cd97..643f8a874f76ca415aa14aa8b1697a23116f671e 100644 (file)
@@ -130,20 +130,20 @@ static struct fio_option options[] = {
        },
        {
                .name   = "read-req-num-512-blocks",
-               .lname  = "Number of 512b blocks to read",
+               .lname  = "Number of 512B blocks to read",
                .type   = FIO_OPT_INT,
                .off1   = offsetof(struct act_options, num_read_blocks),
-               .help   = "Number of 512b blocks to read at the time",
+               .help   = "Number of 512B blocks to read at the time",
                .def    = "3",
                .category = FIO_OPT_C_PROFILE,
                .group  = FIO_OPT_G_ACT,
        },
        {
                .name   = "large-block-op-kbytes",
-               .lname  = "Size of large block ops (writes)",
+               .lname  = "Size of large block ops in KiB (writes)",
                .type   = FIO_OPT_INT,
                .off1   = offsetof(struct act_options, write_size),
-               .help   = "Size of large block ops (writes)",
+               .help   = "Size of large block ops in KiB (writes)",
                .def    = "131072",
                .category = FIO_OPT_C_PROFILE,
                .group  = FIO_OPT_G_ACT,
index 17229b9e060c88f25f26ef70094fe3771f48c3c6..9d9885a35788d4249652d511a0e176f532962def 100644 (file)
@@ -39,7 +39,7 @@ static struct fio_option options[] = {
                .lname  = "Tiobench size",
                .type   = FIO_OPT_STR_VAL,
                .off1   = offsetof(struct tiobench_options, size),
-               .help   = "Size in MB",
+               .help   = "Size in MiB",
                .category = FIO_OPT_C_PROFILE,
                .group  = FIO_OPT_G_TIOBENCH,
        },
@@ -91,7 +91,7 @@ static struct fio_option options[] = {
 static int tb_prep_cmdline(void)
 {
        /*
-        * tiobench uses size as MB, so multiply up
+        * tiobench uses size as MiB, so multiply up
         */
        size *= 1024 * 1024ULL;
        if (size)
index c589ceaf2465aa6461dd2e6285d8a7870c2a6a73..4cdb38d10d3ec8c53ee265787124b70a76893556 100644 (file)
@@ -62,7 +62,7 @@ struct btrace_out {
 
        uint64_t first_ttime[DDIR_RWDIR_CNT];
        uint64_t last_ttime[DDIR_RWDIR_CNT];
-       uint64_t kb[DDIR_RWDIR_CNT];
+       uint64_t kib[DDIR_RWDIR_CNT];
 
        uint64_t start_delay;
 };
@@ -406,7 +406,7 @@ static int handle_trace(struct blk_io_trace *t, struct btrace_pid *p)
 
                i = inflight_find(t->sector + (t->bytes >> 9));
                if (i) {
-                       i->p->o.kb[t_to_rwdir(t)] += (t->bytes >> 10);
+                       i->p->o.kib[t_to_rwdir(t)] += (t->bytes >> 10);
                        i->p->o.complete_seen = 1;
                        inflight_remove(i);
                }
@@ -556,7 +556,7 @@ static int bs_cmp(const void *ba, const void *bb)
        return bsb->nr - bsa->nr;
 }
 
-static unsigned long o_to_kb_rate(struct btrace_out *o, int rw)
+static unsigned long o_to_kib_rate(struct btrace_out *o, int rw)
 {
        uint64_t usec = (o->last_ttime[rw] - o->first_ttime[rw]) / 1000ULL;
        uint64_t val;
@@ -568,7 +568,7 @@ static unsigned long o_to_kb_rate(struct btrace_out *o, int rw)
        if (!usec)
                return 0;
 
-       val = o->kb[rw] * 1000ULL;
+       val = o->kib[rw] * 1000ULL;
        return val / usec;
 }
 
@@ -623,7 +623,7 @@ static void __output_p_ascii(struct btrace_pid *p, unsigned long *ios)
                printf("\tmerges: %lu (perc=%3.2f%%)\n", o->merges[i], perc);
                perc = ((float) o->seq[i] * 100.0) / (float) o->ios[i];
                printf("\tseq:    %lu (perc=%3.2f%%)\n", (unsigned long) o->seq[i], perc);
-               printf("\trate:   %lu KB/sec\n", o_to_kb_rate(o, i));
+               printf("\trate:   %lu KiB/sec\n", o_to_kib_rate(o, i));
 
                for (j = 0; j < o->nr_bs[i]; j++) {
                        struct bs *bs = &o->bs[i][j];
@@ -746,7 +746,7 @@ static int __output_p_fio(struct btrace_pid *p, unsigned long *ios)
                for (i = 0; i < DDIR_RWDIR_CNT; i++) {
                        unsigned long rate;
 
-                       rate = o_to_kb_rate(o, i);
+                       rate = o_to_kib_rate(o, i);
                        if (i)
                                printf(",");
                        if (rate)
@@ -810,7 +810,7 @@ static int prune_entry(struct btrace_out *o)
        for (i = 0; i < DDIR_RWDIR_CNT; i++) {
                unsigned long this_rate;
 
-               this_rate = o_to_kb_rate(o, i);
+               this_rate = o_to_kib_rate(o, i);
                if (this_rate < rate_threshold) {
                        remove_ddir(o, i);
                        this_rate = 0;
@@ -926,7 +926,7 @@ static int merge_entries(struct btrace_pid *pida, struct btrace_pid *pidb)
                oa->ios[i] += ob->ios[i];
                oa->merges[i] += ob->merges[i];
                oa->seq[i] += ob->seq[i];
-               oa->kb[i] += ob->kb[i];
+               oa->kib[i] += ob->kib[i];
                oa->first_ttime[i] = min(oa->first_ttime[i], ob->first_ttime[i]);
                oa->last_ttime[i] = max(oa->last_ttime[i], ob->last_ttime[i]);
                merge_bs(&oa->bs[i], &oa->nr_bs[i], ob->bs[i], ob->nr_bs[i]);
@@ -1021,7 +1021,7 @@ static int usage(char *argv[])
        log_err("\t-n\tNumber IOS threshold to ignore task\n");
        log_err("\t-f\tFio job file output\n");
        log_err("\t-d\tUse this file/device for replay\n");
-       log_err("\t-r\tIgnore jobs with less than this KB/sec rate\n");
+       log_err("\t-r\tIgnore jobs with less than this KiB/sec rate\n");
        log_err("\t-R\tSet rate in fio job (def=%u)\n", set_rate);
        log_err("\t-D\tCap queue depth at this value (def=%u)\n", max_depth);
        log_err("\t-c\tCollapse \"identical\" jobs (def=%u)\n", collapse_entries);
index 7856da1a14865e2aaa07e9fea3b9580c9ecee4c6..c0e9a6953bd501f4d2c635a21bae2b507fd6a39f 100644 (file)
@@ -363,7 +363,7 @@ static void show_progress(struct worker_thread *threads, unsigned long total)
                tdiff = mtime_since_now(&last_tv);
                if (tdiff) {
                        this_items = (this_items * 1000) / (tdiff * 1024);
-                       printf("%3.2f%% done (%luKB/sec)\r", perc, this_items);
+                       printf("%3.2f%% done (%luKiB/sec)\r", perc, this_items);
                        last_nitems = nitems;
                        fio_gettime(&last_tv, NULL);
                } else
index d8253c3c869d948950dc38f3d1b1db16acde8908..9faec38934945658ac4bc08606c7120e0d8388ac 100644 (file)
@@ -3,8 +3,8 @@
  * what an access pattern would look like.
  *
  * For instance, the following would generate a zipf distribution
- * with theta 1.2, using 262144 (1 GB / 4096) values and split the reporting into
- * 20 buckets:
+ * with theta 1.2, using 262144 (1 GiB / 4096) values and split the
+ * reporting into 20 buckets:
  *
  *     ./t/fio-genzipf -t zipf -i 1.2 -g 1 -b 4096 -o 20
  *
@@ -49,7 +49,7 @@ enum {
 };
 
 static int dist_type = TYPE_ZIPF;
-static unsigned long gb_size = 500;
+static unsigned long gib_size = 500;
 static unsigned long block_size = 4096;
 static unsigned long output_nranges = DEF_NR_OUTPUT;
 static double percentage;
@@ -131,7 +131,7 @@ static int parse_options(int argc, char *argv[])
                        }
                        break;
                case 'g':
-                       gb_size = strtoul(optarg, NULL, 10);
+                       gib_size = strtoul(optarg, NULL, 10);
                        break;
                case 'i':
                        dist_val = atof(optarg);
@@ -291,9 +291,10 @@ int main(int argc, char *argv[])
                return 1;
 
        if (output_type != OUTPUT_CSV)
-               printf("Generating %s distribution with %f input and %lu GB size and %lu block_size.\n", dist_types[dist_type], dist_val, gb_size, block_size);
+               printf("Generating %s distribution with %f input and %lu GiB size and %lu block_size.\n",
+                      dist_types[dist_type], dist_val, gib_size, block_size);
 
-       nranges = gb_size * 1024 * 1024 * 1024ULL;
+       nranges = gib_size * 1024 * 1024 * 1024ULL;
        nranges /= block_size;
 
        if (dist_type == TYPE_ZIPF)
index bad5097271723ba68e50cf488cbfd3d6d329e608..7016f2688f6bfc0dc5f50811143722a1820d06ac 100644 (file)
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
                v_size = numbers * sizeof(uint8_t);
                v = malloc(v_size);
                memset(v, 0, v_size);
-               printf("\nVerification table is %lf KBs\n", (double)(v_size) / 1024);
+               printf("\nVerification table is %lf KiB\n", (double)(v_size) / 1024);
        }
        v_start = v;
 
index d9d586d8a5ac4db84c5f7fa0978ce06897543975..3d3579ad25292f0369b16f8a71306e9db7a8eea2 100644 (file)
@@ -4,7 +4,7 @@
 #include <pthread.h>
 
 static struct thread_data {
-       unsigned long mb;
+       unsigned long mib;
 } td;
 
 static void *worker(void *data)
@@ -15,14 +15,14 @@ static void *worker(void *data)
        char *buf;
        int i, first = 1;
 
-       size = td->mb * 1024UL * 1024UL;
+       size = td->mib * 1024UL * 1024UL;
        buf = malloc(size);
 
        for (i = 0; i < 100000; i++) {
                for (index = 0; index + 4096 < size; index += 4096)
                        memset(&buf[index+512], 0x89, 512);
                if (first) {
-                       printf("loop%d: did %lu MB\n", i+1, size/(1024UL*1024UL));
+                       printf("loop%d: did %lu MiB\n", i+1, size/(1024UL*1024UL));
                        first = 0;
                }
        }
@@ -31,20 +31,20 @@ static void *worker(void *data)
 
 int main(int argc, char *argv[])
 {
-       unsigned long mb, threads;
+       unsigned long mib, threads;
        pthread_t *pthreads;
        int i;
 
        if (argc < 3) {
-               printf("%s: <mb per thread> <threads>\n", argv[0]);
+               printf("%s: <MiB per thread> <threads>\n", argv[0]);
                return 1;
        }
 
-       mb = strtoul(argv[1], NULL, 10);
+       mib = strtoul(argv[1], NULL, 10);
        threads = strtoul(argv[2], NULL, 10);
 
        pthreads = calloc(threads, sizeof(pthread_t));
-       td.mb = mb;
+       td.mib = mib;
 
        for (i = 0; i < threads; i++)
                pthread_create(&pthreads[i], NULL, worker, &td);
index e8bdc85756daac7b7b3f1d4a2b9fec3358d03967..ebdd8f1066f7c29588f620792ad12046838f0f8c 100644 (file)
@@ -661,9 +661,9 @@ int main(int argc, char *argv[])
 
        bytes /= 1024;
        rate = (bytes * 1000UL * 1000UL) / utime_since(&s, &re);
-       fprintf(stderr, "Read rate (KB/sec) : %lu\n", rate);
+       fprintf(stderr, "Read rate (KiB/sec) : %lu\n", rate);
        rate = (bytes * 1000UL * 1000UL) / utime_since(&s, &we);
-       fprintf(stderr, "Write rate (KB/sec): %lu\n", rate);
+       fprintf(stderr, "Write rate (KiB/sec): %lu\n", rate);
 
        close(fd);
        return 0;