[PATCH] Add thinktime_spin parameter

If you specify thinktime currently, fio will sleep for the duration.
Apps will typically do some data processing before sleeping, so add
a thinktime_spin parameter to control how much CPU to burn before
sleeping.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/init.c b/init.c
index 1dec2bb..9e7fb2c 100644
--- a/init.c
+++ b/init.c
@@ -331,6 +331,13 @@
 		.def	= "0",
 	},
 	{
+		.name	= "thinktime_spin",
+		.type	= FIO_OPT_INT,
+		.off1	= td_var_offset(thinktime_spin),
+		.help	= "Start thinktime by spinning this amount (usec)",
+		.def	= "0",
+	},
+	{
 		.name	= "thinktime_blocks",
 		.type	= FIO_OPT_INT,
 		.off1	= td_var_offset(thinktime_blocks),
@@ -631,6 +638,12 @@
 	 */
 	if (td->filetype == FIO_TYPE_CHAR && td->odirect)
 		td->odirect = 0;
+
+	/*
+	 * thinktime_spin must be less than thinktime
+	 */
+	if (td->thinktime_spin > td->thinktime)
+		td->thinktime_spin = td->thinktime;
 }
 
 /*