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", | |
e8b0e958 | 26 | .lname = "Tiobench size", |
2363d8df | 27 | .type = FIO_OPT_STR_VAL, |
e2de69da JA |
28 | .roff1 = &size, |
29 | .help = "Size in MB", | |
13fca827 JA |
30 | .category = FIO_OPT_C_PROFILE, |
31 | .group = FIO_OPT_G_TIOBENCH, | |
e2de69da JA |
32 | }, |
33 | { | |
34 | .name = "block", | |
e8b0e958 | 35 | .lname = "Tiobench block", |
e2de69da JA |
36 | .type = FIO_OPT_INT, |
37 | .roff1 = &bs, | |
38 | .help = "Block size in bytes", | |
39 | .def = "4k", | |
13fca827 JA |
40 | .category = FIO_OPT_C_PROFILE, |
41 | .group = FIO_OPT_G_TIOBENCH, | |
e2de69da JA |
42 | }, |
43 | { | |
44 | .name = "numruns", | |
e8b0e958 | 45 | .lname = "Tiobench numruns", |
e2de69da JA |
46 | .type = FIO_OPT_INT, |
47 | .roff1 = &loops, | |
48 | .help = "Number of runs", | |
13fca827 JA |
49 | .category = FIO_OPT_C_PROFILE, |
50 | .group = FIO_OPT_G_TIOBENCH, | |
e2de69da JA |
51 | }, |
52 | { | |
53 | .name = "dir", | |
e8b0e958 | 54 | .lname = "Tiobench directory", |
e2de69da JA |
55 | .type = FIO_OPT_STR_STORE, |
56 | .roff1 = &dir, | |
57 | .help = "Test directory", | |
13fca827 JA |
58 | .category = FIO_OPT_C_PROFILE, |
59 | .group = FIO_OPT_G_TIOBENCH, | |
e2de69da | 60 | }, |
2363d8df JA |
61 | { |
62 | .name = "threads", | |
e8b0e958 | 63 | .lname = "Tiobench threads", |
2363d8df JA |
64 | .type = FIO_OPT_INT, |
65 | .roff1 = &nthreads, | |
66 | .help = "Number of Threads", | |
13fca827 JA |
67 | .category = FIO_OPT_C_PROFILE, |
68 | .group = FIO_OPT_G_TIOBENCH, | |
2363d8df | 69 | }, |
e2de69da JA |
70 | { |
71 | .name = NULL, | |
72 | }, | |
73 | }; | |
74 | ||
2363d8df JA |
75 | /* |
76 | * Fill our private options into the command line | |
77 | */ | |
d4afedfd | 78 | static int tb_prep_cmdline(void) |
2363d8df | 79 | { |
2363d8df JA |
80 | /* |
81 | * tiobench uses size as MB, so multiply up | |
82 | */ | |
83 | size *= 1024 * 1024ULL; | |
84 | if (size) | |
85 | sprintf(sz_idx, "size=%llu", size); | |
86 | else | |
87 | strcpy(sz_idx, "size=4*1024*$mb_memory"); | |
88 | ||
89 | sprintf(bs_idx, "bs=%u", bs); | |
90 | sprintf(loop_idx, "loops=%u", loops); | |
91 | ||
92 | if (dir) | |
93 | sprintf(dir_idx, "directory=%s", dir); | |
94 | else | |
95 | sprintf(dir_idx, "directory=./"); | |
96 | ||
97 | sprintf(t_idx, "numjobs=%u", nthreads); | |
d4afedfd | 98 | return 0; |
2363d8df JA |
99 | } |
100 | ||
79d16311 JA |
101 | static struct profile_ops tiobench_profile = { |
102 | .name = "tiobench", | |
f5b6bb85 | 103 | .desc = "tiotest/tiobench benchmark", |
e2de69da | 104 | .options = options, |
2363d8df JA |
105 | .prep_cmd = tb_prep_cmdline, |
106 | .cmdline = tb_opts, | |
79d16311 JA |
107 | }; |
108 | ||
109 | static void fio_init tiobench_register(void) | |
110 | { | |
07b3232d JA |
111 | if (register_profile(&tiobench_profile)) |
112 | log_err("fio: failed to register profile 'tiobench'\n"); | |
79d16311 JA |
113 | } |
114 | ||
115 | static void fio_exit tiobench_unregister(void) | |
116 | { | |
117 | unregister_profile(&tiobench_profile); | |
118 | } |