2 #include "../profile.h"
5 static unsigned long long size;
6 static unsigned int loops = 1;
7 static unsigned int bs = 4096;
8 static unsigned int nthreads = 1;
11 char sz_idx[80], bs_idx[80], loop_idx[80], dir_idx[80], t_idx[80];
13 static const char *tb_opts[] = {
14 "buffered=0", sz_idx, bs_idx, loop_idx, dir_idx, t_idx,
15 "timeout=600", "group_reporting", "thread", "overwrite=1",
16 "filename=.fio.tio.1:.fio.tio.2:.fio.tio.3:.fio.tio.4",
18 "name=seqwrite", "rw=write", "end_fsync=1",
19 "name=randwrite", "stonewall", "rw=randwrite", "end_fsync=1",
20 "name=seqread", "stonewall", "rw=read",
21 "name=randread", "stonewall", "rw=randread", NULL,
24 struct tiobench_options {
26 unsigned long long size;
29 unsigned int nthreads;
33 static struct tiobench_options tiobench_options;
35 static struct fio_option options[] = {
38 .lname = "Tiobench size",
39 .type = FIO_OPT_STR_VAL,
40 .off1 = offsetof(struct tiobench_options, size),
42 .category = FIO_OPT_C_PROFILE,
43 .group = FIO_OPT_G_TIOBENCH,
47 .lname = "Tiobench block",
49 .off1 = offsetof(struct tiobench_options, bs),
50 .help = "Block size in bytes",
52 .category = FIO_OPT_C_PROFILE,
53 .group = FIO_OPT_G_TIOBENCH,
57 .lname = "Tiobench numruns",
59 .off1 = offsetof(struct tiobench_options, loops),
60 .help = "Number of runs",
61 .category = FIO_OPT_C_PROFILE,
62 .group = FIO_OPT_G_TIOBENCH,
66 .lname = "Tiobench directory",
67 .type = FIO_OPT_STR_STORE,
68 .off1 = offsetof(struct tiobench_options, dir),
69 .help = "Test directory",
70 .category = FIO_OPT_C_PROFILE,
71 .group = FIO_OPT_G_TIOBENCH,
75 .lname = "Tiobench threads",
77 .off1 = offsetof(struct tiobench_options, nthreads),
78 .help = "Number of Threads",
79 .category = FIO_OPT_C_PROFILE,
80 .group = FIO_OPT_G_TIOBENCH,
88 * Fill our private options into the command line
90 static int tb_prep_cmdline(void)
93 * tiobench uses size as MB, so multiply up
95 size *= 1024 * 1024ULL;
97 sprintf(sz_idx, "size=%llu", size);
99 strcpy(sz_idx, "size=4*1024*$mb_memory");
101 sprintf(bs_idx, "bs=%u", bs);
102 sprintf(loop_idx, "loops=%u", loops);
105 sprintf(dir_idx, "directory=%s", dir);
107 sprintf(dir_idx, "directory=./");
109 sprintf(t_idx, "numjobs=%u", nthreads);
113 static struct profile_ops tiobench_profile = {
115 .desc = "tiotest/tiobench benchmark",
116 .prep_cmd = tb_prep_cmdline,
119 .opt_data = &tiobench_options,
122 static void fio_init tiobench_register(void)
124 if (register_profile(&tiobench_profile))
125 log_err("fio: failed to register profile 'tiobench'\n");
128 static void fio_exit tiobench_unregister(void)
130 unregister_profile(&tiobench_profile);