summaryrefslogtreecommitdiff
path: root/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'options.c')
-rw-r--r--options.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/options.c b/options.c
index 40f60ff3..bdb56d3e 100644
--- a/options.c
+++ b/options.c
@@ -225,6 +225,15 @@ static int str_mem_cb(void *data, const char *mem)
return 0;
}
+static int fio_clock_source_cb(void *data, const char *str)
+{
+ struct thread_data *td = data;
+
+ fio_clock_source = td->o.clocksource;
+ fio_time_init();
+ return 0;
+}
+
static int str_lockmem_cb(void fio_unused *data, unsigned long *val)
{
mlock_size = *val;
@@ -1217,6 +1226,30 @@ static struct fio_option options[FIO_MAX_OPTS] = {
.help = "Ramp up time before measuring performance",
},
{
+ .name = "clocksource",
+ .type = FIO_OPT_STR,
+ .cb = fio_clock_source_cb,
+ .off1 = td_var_offset(clocksource),
+ .help = "What type of timing source to use",
+ .def = "gettimeofday",
+ .posval = {
+ { .ival = "gettimeofday",
+ .oval = CS_GTOD,
+ .help = "Use gettimeofday(2) for timing",
+ },
+ { .ival = "clock_gettime",
+ .oval = CS_CGETTIME,
+ .help = "Use clock_gettime(2) for timing",
+ },
+#ifdef ARCH_HAVE_CPU_CLOCK
+ { .ival = "cpu",
+ .oval = CS_CPUCLOCK,
+ .help = "Use CPU private clock",
+ },
+#endif
+ },
+ },
+ {
.name = "mem",
.alias = "iomem",
.type = FIO_OPT_STR,