Add gtod_cpu option for pinning gettimeofday() to a single CPU
Similar to what real life products sometimes do, offload gettimeofday()
calls to a single CPU and have that update the current time into a shared
memory location. This option pins a specific CPU for that job, and excludes
it from participating in any of the IO jobs.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/options.c b/options.c
index 1953e3d..5bbeb34 100644
--- a/options.c
+++ b/options.c
@@ -497,6 +497,16 @@
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)
@@ -1389,6 +1399,12 @@
.def = "0",
},
{
+ .name = "gtod_cpu",
+ .type = FIO_OPT_INT,
+ .cb = str_gtod_cpu_cb,
+ .help = "Setup dedicated gettimeofday() thread on this CPU",
+ },
+ {
.name = NULL,
},
};