Add gtod_cpu option for pinning gettimeofday() to a single CPU
[fio.git] / options.c
index 1953e3d604216c53a1a12c86493d73e18cb75fb1..5bbeb34276e622cd9f1fc2f88d14664f619b8dcf 100644 (file)
--- a/options.c
+++ b/options.c
@@ -497,6 +497,16 @@ static int str_gtod_reduce_cb(void *data, int *il)
        return 0;
 }
 
+static int str_gtod_cpu_cb(void *data, int *il)
+{
+       struct thread_data *td = data;
+       int val = *il;
+
+       td->o.gtod_cpu = val;
+       td->o.gtod_offload = 1;
+       return 0;
+}
+
 #define __stringify_1(x)       #x
 #define __stringify(x)         __stringify_1(x)
 
@@ -1388,6 +1398,12 @@ static struct fio_option options[] = {
                .parent = "gtod_reduce",
                .def    = "0",
        },
+       {
+               .name   = "gtod_cpu",
+               .type   = FIO_OPT_INT,
+               .cb     = str_gtod_cpu_cb,
+               .help   = "Setup dedicated gettimeofday() thread on this CPU",
+       },
        {
                .name = NULL,
        },