Commit | Line | Data |
---|---|---|
79d16311 JA |
1 | #include "../fio.h" |
2 | #include "../profile.h" | |
e2de69da JA |
3 | #include "../parse.h" |
4 | ||
2363d8df JA |
5 | static unsigned long long size; |
6 | static unsigned int loops = 1; | |
7 | static unsigned int bs = 4096; | |
8 | static unsigned int nthreads = 1; | |
e2de69da | 9 | static char *dir; |
79d16311 | 10 | |
2363d8df JA |
11 | char sz_idx[80], bs_idx[80], loop_idx[80], dir_idx[80], t_idx[80]; |
12 | ||
79d16311 | 13 | static const char *tb_opts[] = { |
2363d8df JA |
14 | "buffered=0", sz_idx, bs_idx, loop_idx, dir_idx, t_idx, |
15 | "timeout=600", "group_reporting", "thread", "overwrite=1", | |
79d16311 JA |
16 | "filename=.fio.tio.1:.fio.tio.2:.fio.tio.3:.fio.tio.4", |
17 | "name=seqwrite", "rw=write", "end_fsync=1", | |
18 | "name=randwrite", "stonewall", "rw=randwrite", "end_fsync=1", | |
19 | "name=seqread", "stonewall", "rw=read", | |
20 | "name=randread", "stonewall", "rw=randread", NULL, | |
21 | }; | |
22 | ||
e2de69da JA |
23 | static struct fio_option options[] = { |
24 | { | |
25 | .name = "size", | |
2363d8df | 26 | .type = FIO_OPT_STR_VAL, |
e2de69da JA |
27 | .roff1 = &size, |
28 | .help = "Size in MB", | |
e90a0adf | 29 | .category = FIO_OPT_C_PROFILE, |
0ed766f6 | 30 | .group = FIO_OPT_G_TIOBENCH, |
e2de69da JA |
31 | }, |
32 | { | |
33 | .name = "block", | |
34 | .type = FIO_OPT_INT, | |
35 | .roff1 = &bs, | |
36 | .help = "Block size in bytes", | |
37 | .def = "4k", | |
e90a0adf | 38 | .category = FIO_OPT_C_PROFILE, |
0ed766f6 | 39 | .group = FIO_OPT_G_TIOBENCH, |
e2de69da JA |
40 | }, |
41 | { | |
42 | .name = "numruns", | |
43 | .type = FIO_OPT_INT, | |
44 | .roff1 = &loops, | |
45 | .help = "Number of runs", | |
e90a0adf | 46 | .category = FIO_OPT_C_PROFILE, |
0ed766f6 | 47 | .group = FIO_OPT_G_TIOBENCH, |
e2de69da JA |
48 | }, |
49 | { | |
50 | .name = "dir", | |
51 | .type = FIO_OPT_STR_STORE, | |
52 | .roff1 = &dir, | |
53 | .help = "Test directory", | |
e90a0adf | 54 | .category = FIO_OPT_C_PROFILE, |
0ed766f6 | 55 | .group = FIO_OPT_G_TIOBENCH, |
e2de69da | 56 | }, |
2363d8df JA |
57 | { |
58 | .name = "threads", | |
59 | .type = FIO_OPT_INT, | |
60 | .roff1 = &nthreads, | |
61 | .help = "Number of Threads", | |
e90a0adf | 62 | .category = FIO_OPT_C_PROFILE, |
0ed766f6 | 63 | .group = FIO_OPT_G_TIOBENCH, |
2363d8df | 64 | }, |
e2de69da JA |
65 | { |
66 | .name = NULL, | |
67 | }, | |
68 | }; | |
69 | ||
2363d8df JA |
70 | /* |
71 | * Fill our private options into the command line | |
72 | */ | |
73 | static void tb_prep_cmdline(void) | |
74 | { | |
75 | ||
76 | /* | |
77 | * tiobench uses size as MB, so multiply up | |
78 | */ | |
79 | size *= 1024 * 1024ULL; | |
80 | if (size) | |
81 | sprintf(sz_idx, "size=%llu", size); | |
82 | else | |
83 | strcpy(sz_idx, "size=4*1024*$mb_memory"); | |
84 | ||
85 | sprintf(bs_idx, "bs=%u", bs); | |
86 | sprintf(loop_idx, "loops=%u", loops); | |
87 | ||
88 | if (dir) | |
89 | sprintf(dir_idx, "directory=%s", dir); | |
90 | else | |
91 | sprintf(dir_idx, "directory=./"); | |
92 | ||
93 | sprintf(t_idx, "numjobs=%u", nthreads); | |
94 | } | |
95 | ||
79d16311 JA |
96 | static struct profile_ops tiobench_profile = { |
97 | .name = "tiobench", | |
f5b6bb85 | 98 | .desc = "tiotest/tiobench benchmark", |
e2de69da | 99 | .options = options, |
2363d8df JA |
100 | .prep_cmd = tb_prep_cmdline, |
101 | .cmdline = tb_opts, | |
79d16311 JA |
102 | }; |
103 | ||
104 | static void fio_init tiobench_register(void) | |
105 | { | |
07b3232d JA |
106 | if (register_profile(&tiobench_profile)) |
107 | log_err("fio: failed to register profile 'tiobench'\n"); | |
79d16311 JA |
108 | } |
109 | ||
110 | static void fio_exit tiobench_unregister(void) | |
111 | { | |
112 | unregister_profile(&tiobench_profile); | |
113 | } |