Add support for idletime profiling

Idletime profiling allows a benchmark to run while filling the
idle cycles on the server, hence giving you some metric of how
much pressure the system is under. This is useful to be able
to profile and compare changes in a setup or driver, for instance.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/backend.c b/backend.c
index 87810e8..218ae25 100644
--- a/backend.c
+++ b/backend.c
@@ -51,6 +51,7 @@
 #include "memalign.h"
 #include "server.h"
 #include "lib/getrusage.h"
+#include "idletime.h"
 
 static pthread_t disk_util_thread;
 static struct fio_mutex *disk_thread_mutex;
@@ -1499,6 +1500,8 @@
 
 	if (fio_gtod_offload && fio_start_gtod_thread())
 		return;
+	
+	fio_idle_prof_init();
 
 	set_sig_handlers();
 
@@ -1556,6 +1559,9 @@
 		}
 	}
 
+	/* start idle threads before io threads start to run */
+	fio_idle_prof_start();
+
 	set_genesis_time();
 
 	while (todo) {
@@ -1718,6 +1724,8 @@
 			usleep(10000);
 	}
 
+	fio_idle_prof_stop();
+
 	update_io_ticks();
 	fio_unpin_memory();
 }