Define SIGUSR1 to inform fio to dump run stats while continuing to run
[fio.git] / profiles / tiobench.c
... / ...
CommitLineData
1#include "../fio.h"
2#include "../profile.h"
3#include "../parse.h"
4
5static unsigned long long size;
6static unsigned int loops = 1;
7static unsigned int bs = 4096;
8static unsigned int nthreads = 1;
9static char *dir;
10
11char sz_idx[80], bs_idx[80], loop_idx[80], dir_idx[80], t_idx[80];
12
13static 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",
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
23static struct fio_option options[] = {
24 {
25 .name = "size",
26 .lname = "Tiobench size",
27 .type = FIO_OPT_STR_VAL,
28 .roff1 = &size,
29 .help = "Size in MB",
30 .category = FIO_OPT_C_IO,
31 },
32 {
33 .name = "block",
34 .lname = "Tiobench block",
35 .type = FIO_OPT_INT,
36 .roff1 = &bs,
37 .help = "Block size in bytes",
38 .def = "4k",
39 .category = FIO_OPT_C_IO,
40 },
41 {
42 .name = "numruns",
43 .lname = "Tiobench numruns",
44 .type = FIO_OPT_INT,
45 .roff1 = &loops,
46 .help = "Number of runs",
47 .category = FIO_OPT_C_GENERAL,
48 },
49 {
50 .name = "dir",
51 .lname = "Tiobench directory",
52 .type = FIO_OPT_STR_STORE,
53 .roff1 = &dir,
54 .help = "Test directory",
55 .category = FIO_OPT_C_FILE,
56 },
57 {
58 .name = "threads",
59 .lname = "Tiobench threads",
60 .type = FIO_OPT_INT,
61 .roff1 = &nthreads,
62 .help = "Number of Threads",
63 .category = FIO_OPT_C_GENERAL,
64 },
65 {
66 .name = NULL,
67 },
68};
69
70/*
71 * Fill our private options into the command line
72 */
73static 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
96static struct profile_ops tiobench_profile = {
97 .name = "tiobench",
98 .desc = "tiotest/tiobench benchmark",
99 .options = options,
100 .prep_cmd = tb_prep_cmdline,
101 .cmdline = tb_opts,
102};
103
104static void fio_init tiobench_register(void)
105{
106 if (register_profile(&tiobench_profile))
107 log_err("fio: failed to register profile 'tiobench'\n");
108}
109
110static void fio_exit tiobench_unregister(void)
111{
112 unregister_profile(&tiobench_profile);
113}