+struct tiobench_options {
+ unsigned int pad;
+ unsigned long long size;
+ unsigned int loops;
+ unsigned int bs;
+ unsigned int nthreads;
+ char *dir;
+};
+
+static struct tiobench_options tiobench_options;
+
+static struct fio_option options[] = {
+ {
+ .name = "size",
+ .lname = "Tiobench size",
+ .type = FIO_OPT_STR_VAL,
+ .off1 = offsetof(struct tiobench_options, size),
+ .help = "Size in MB",
+ .category = FIO_OPT_C_PROFILE,
+ .group = FIO_OPT_G_TIOBENCH,
+ },
+ {
+ .name = "block",
+ .lname = "Tiobench block",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct tiobench_options, bs),
+ .help = "Block size in bytes",
+ .def = "4096",
+ .category = FIO_OPT_C_PROFILE,
+ .group = FIO_OPT_G_TIOBENCH,
+ },
+ {
+ .name = "numruns",
+ .lname = "Tiobench numruns",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct tiobench_options, loops),
+ .help = "Number of runs",
+ .category = FIO_OPT_C_PROFILE,
+ .group = FIO_OPT_G_TIOBENCH,
+ },
+ {
+ .name = "dir",
+ .lname = "Tiobench directory",
+ .type = FIO_OPT_STR_STORE,
+ .off1 = offsetof(struct tiobench_options, dir),
+ .help = "Test directory",
+ .category = FIO_OPT_C_PROFILE,
+ .group = FIO_OPT_G_TIOBENCH,
+ },
+ {
+ .name = "threads",
+ .lname = "Tiobench threads",
+ .type = FIO_OPT_INT,
+ .off1 = offsetof(struct tiobench_options, nthreads),
+ .help = "Number of Threads",
+ .category = FIO_OPT_C_PROFILE,
+ .group = FIO_OPT_G_TIOBENCH,
+ },
+ {
+ .name = NULL,
+ },
+};
+
+/*
+ * Fill our private options into the command line
+ */
+static int tb_prep_cmdline(void)
+{
+ /*
+ * tiobench uses size as MB, so multiply up
+ */
+ size *= 1024 * 1024ULL;
+ if (size)
+ sprintf(sz_idx, "size=%llu", size);
+ else
+ strcpy(sz_idx, "size=4*1024*$mb_memory");
+
+ sprintf(bs_idx, "bs=%u", bs);
+ sprintf(loop_idx, "loops=%u", loops);
+
+ if (dir)
+ sprintf(dir_idx, "directory=%s", dir);
+ else
+ sprintf(dir_idx, "directory=./");
+
+ sprintf(t_idx, "numjobs=%u", nthreads);
+ return 0;
+}
+