2 #include "../profile.h"
4 #include "../optgroup.h"
6 static unsigned long long size;
7 static unsigned int loops = 1;
8 static unsigned int bs = 4096;
9 static unsigned int nthreads = 1;
12 static char sz_idx[80], bs_idx[80], loop_idx[80], dir_idx[80], t_idx[80];
14 static const char *tb_opts[] = {
15 "buffered=0", sz_idx, bs_idx, loop_idx, dir_idx, t_idx,
16 "timeout=600", "group_reporting", "thread", "overwrite=1",
17 "filename=.fio.tio.1:.fio.tio.2:.fio.tio.3:.fio.tio.4",
19 "name=seqwrite", "rw=write", "end_fsync=1",
20 "name=randwrite", "stonewall", "rw=randwrite", "end_fsync=1",
21 "name=seqread", "stonewall", "rw=read",
22 "name=randread", "stonewall", "rw=randread", NULL,
25 struct tiobench_options {
27 unsigned long long size;
30 unsigned int nthreads;
34 static struct tiobench_options tiobench_options;
36 static struct fio_option options[] = {
39 .lname = "Tiobench size",
40 .type = FIO_OPT_STR_VAL,
41 .off1 = offsetof(struct tiobench_options, size),
42 .help = "Size in MiB",
43 .category = FIO_OPT_C_PROFILE,
44 .group = FIO_OPT_G_TIOBENCH,
48 .lname = "Tiobench block",
50 .off1 = offsetof(struct tiobench_options, bs),
51 .help = "Block size in bytes",
53 .category = FIO_OPT_C_PROFILE,
54 .group = FIO_OPT_G_TIOBENCH,
58 .lname = "Tiobench numruns",
60 .off1 = offsetof(struct tiobench_options, loops),
61 .help = "Number of runs",
62 .category = FIO_OPT_C_PROFILE,
63 .group = FIO_OPT_G_TIOBENCH,
67 .lname = "Tiobench directory",
68 .type = FIO_OPT_STR_STORE,
69 .off1 = offsetof(struct tiobench_options, dir),
70 .help = "Test directory",
71 .category = FIO_OPT_C_PROFILE,
72 .group = FIO_OPT_G_TIOBENCH,
77 .lname = "Tiobench threads",
79 .off1 = offsetof(struct tiobench_options, nthreads),
80 .help = "Number of Threads",
81 .category = FIO_OPT_C_PROFILE,
82 .group = FIO_OPT_G_TIOBENCH,
90 * Fill our private options into the command line
92 static int tb_prep_cmdline(void)
95 * tiobench uses size as MiB, so multiply up
97 size *= 1024 * 1024ULL;
99 sprintf(sz_idx, "size=%llu", size);
101 strcpy(sz_idx, "size=4*1024*$mb_memory");
103 sprintf(bs_idx, "bs=%u", bs);
104 sprintf(loop_idx, "loops=%u", loops);
107 sprintf(dir_idx, "directory=%s", dir);
109 sprintf(dir_idx, "directory=./");
111 sprintf(t_idx, "numjobs=%u", nthreads);
115 static struct profile_ops tiobench_profile = {
117 .desc = "tiotest/tiobench benchmark",
118 .prep_cmd = tb_prep_cmdline,
121 .opt_data = &tiobench_options,
124 static void fio_init tiobench_register(void)
126 if (register_profile(&tiobench_profile))
127 log_err("fio: failed to register profile 'tiobench'\n");
130 static void fio_exit tiobench_unregister(void)
132 unregister_profile(&tiobench_profile);