[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/fio.c b/fio.c
index 78dca9a..ff169f8 100644
--- a/fio.c
+++ b/fio.c
@@ -466,8 +466,16 @@
unsigned long long b;
b = td->io_blocks[0] + td->io_blocks[1];
- if (!(b % td->thinktime_blocks))
- usec_sleep(td, td->thinktime);
+ if (!(b % td->thinktime_blocks)) {
+ int left;
+
+ if (td->thinktime_spin)
+ __usec_sleep(td->thinktime_spin);
+
+ left = td->thinktime - td->thinktime_spin;
+ if (left)
+ usec_sleep(td, left);
+ }
}
}