summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-02-11 14:19:38 -0700
committerJens Axboe <axboe@fb.com>2014-02-11 14:19:38 -0700
commit7b504eddc4b039f2db3a0626bd08f880c5f4de27 (patch)
tree040a5c3c06a511da478253d95f9c31155cb3a1a8 /profiles
parenteb0c74ae74ce458dd55b7a7d11c5ba7ae59bf5ed (diff)
parse: get rid of raw option offsets
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'profiles')
-rw-r--r--profiles/act.c28
-rw-r--r--profiles/tiobench.c23
2 files changed, 39 insertions, 12 deletions
diff --git a/profiles/act.c b/profiles/act.c
index 7e2f8af..4d2ec5c 100644
--- a/profiles/act.c
+++ b/profiles/act.c
@@ -74,12 +74,25 @@ static unsigned int org_idx;
static int act_add_opt(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
+struct act_options {
+ unsigned int pad;
+ char *device_names;
+ unsigned int load;
+ unsigned int prep;
+ unsigned int threads_per_queue;
+ unsigned int num_read_blocks;
+ unsigned int write_size;
+ unsigned long long test_duration;
+};
+
+static struct act_options act_options;
+
static struct fio_option options[] = {
{
.name = "device-names",
.lname = "device-names",
.type = FIO_OPT_STR_STORE,
- .roff1 = &device_names,
+ .off1 = offsetof(struct act_options, device_names),
.help = "Devices to use",
.category = FIO_OPT_C_PROFILE,
.group = FIO_OPT_G_ACT,
@@ -88,7 +101,7 @@ static struct fio_option options[] = {
.name = "load",
.lname = "Load multiplier",
.type = FIO_OPT_INT,
- .roff1 = &load,
+ .off1 = offsetof(struct act_options, load),
.help = "ACT load multipler (default 1x)",
.def = "1",
.category = FIO_OPT_C_PROFILE,
@@ -98,7 +111,7 @@ static struct fio_option options[] = {
.name = "test-duration",
.lname = "Test duration",
.type = FIO_OPT_STR_VAL_TIME,
- .roff1 = &test_duration,
+ .off1 = offsetof(struct act_options, test_duration),
.help = "How long the entire test takes to run",
.def = "24h",
.category = FIO_OPT_C_PROFILE,
@@ -108,7 +121,7 @@ static struct fio_option options[] = {
.name = "threads-per-queue",
.lname = "Number of read IO threads per device",
.type = FIO_OPT_INT,
- .roff1 = &threads_per_queue,
+ .off1 = offsetof(struct act_options, threads_per_queue),
.help = "Number of read IO threads per device",
.def = "8",
.category = FIO_OPT_C_PROFILE,
@@ -118,7 +131,7 @@ static struct fio_option options[] = {
.name = "read-req-num-512-blocks",
.lname = "Number of 512b blocks to read",
.type = FIO_OPT_INT,
- .roff1 = &num_read_blocks,
+ .off1 = offsetof(struct act_options, num_read_blocks),
.help = "Number of 512b blocks to read at the time",
.def = "3",
.category = FIO_OPT_C_PROFILE,
@@ -128,7 +141,7 @@ static struct fio_option options[] = {
.name = "large-block-op-kbytes",
.lname = "Size of large block ops (writes)",
.type = FIO_OPT_INT,
- .roff1 = &write_size,
+ .off1 = offsetof(struct act_options, write_size),
.help = "Size of large block ops (writes)",
.def = "128k",
.category = FIO_OPT_C_PROFILE,
@@ -138,7 +151,7 @@ static struct fio_option options[] = {
.name = "prep",
.lname = "Run ACT prep phase",
.type = FIO_OPT_STR_SET,
- .roff1 = &prep,
+ .off1 = offsetof(struct act_options, prep),
.help = "Set to run ACT prep phase",
.category = FIO_OPT_C_PROFILE,
.group = FIO_OPT_G_ACT,
@@ -445,6 +458,7 @@ static struct profile_ops act_profile = {
.name = "act",
.desc = "ACT Aerospike like benchmark",
.options = options,
+ .opt_data = &act_options,
.prep_cmd = act_prep_cmdline,
.cmdline = act_opts,
.io_ops = &act_io_ops,
diff --git a/profiles/tiobench.c b/profiles/tiobench.c
index bdb5985..99c88c4 100644
--- a/profiles/tiobench.c
+++ b/profiles/tiobench.c
@@ -21,12 +21,23 @@ static const char *tb_opts[] = {
"name=randread", "stonewall", "rw=randread", NULL,
};
+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,
- .roff1 = &size,
+ .off1 = offsetof(struct tiobench_options, size),
.help = "Size in MB",
.category = FIO_OPT_C_PROFILE,
.group = FIO_OPT_G_TIOBENCH,
@@ -35,7 +46,7 @@ static struct fio_option options[] = {
.name = "block",
.lname = "Tiobench block",
.type = FIO_OPT_INT,
- .roff1 = &bs,
+ .off1 = offsetof(struct tiobench_options, bs),
.help = "Block size in bytes",
.def = "4k",
.category = FIO_OPT_C_PROFILE,
@@ -45,7 +56,7 @@ static struct fio_option options[] = {
.name = "numruns",
.lname = "Tiobench numruns",
.type = FIO_OPT_INT,
- .roff1 = &loops,
+ .off1 = offsetof(struct tiobench_options, loops),
.help = "Number of runs",
.category = FIO_OPT_C_PROFILE,
.group = FIO_OPT_G_TIOBENCH,
@@ -54,7 +65,7 @@ static struct fio_option options[] = {
.name = "dir",
.lname = "Tiobench directory",
.type = FIO_OPT_STR_STORE,
- .roff1 = &dir,
+ .off1 = offsetof(struct tiobench_options, dir),
.help = "Test directory",
.category = FIO_OPT_C_PROFILE,
.group = FIO_OPT_G_TIOBENCH,
@@ -63,7 +74,7 @@ static struct fio_option options[] = {
.name = "threads",
.lname = "Tiobench threads",
.type = FIO_OPT_INT,
- .roff1 = &nthreads,
+ .off1 = offsetof(struct tiobench_options, nthreads),
.help = "Number of Threads",
.category = FIO_OPT_C_PROFILE,
.group = FIO_OPT_G_TIOBENCH,
@@ -105,6 +116,8 @@ static struct profile_ops tiobench_profile = {
.options = options,
.prep_cmd = tb_prep_cmdline,
.cmdline = tb_opts,
+ .options = options,
+ .opt_data = &tiobench_options,
};
static void fio_init tiobench_register(void)