Add group reporting

Still needs some testing, so the option isn't documented yet. The
standard deviation averaging also isn't mathematically sound.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/fio.c b/fio.c
index ab84b60..48d65e0 100644
--- a/fio.c
+++ b/fio.c
@@ -661,7 +661,7 @@
 	struct fio_file *f;
 	int i;
 
-	td->ts->stat_io_bytes[0] = td->ts->stat_io_bytes[1] = 0;
+	td->ts.stat_io_bytes[0] = td->ts.stat_io_bytes[1] = 0;
 	td->this_io_bytes[0] = td->this_io_bytes[1] = 0;
 	td->zone_bytes = 0;
 
@@ -751,15 +751,15 @@
 
 	fio_gettime(&td->epoch, NULL);
 	memcpy(&td->timeout_end, &td->epoch, sizeof(td->epoch));
-	getrusage(RUSAGE_SELF, &td->ts->ru_start);
+	getrusage(RUSAGE_SELF, &td->ts.ru_start);
 
 	runtime[0] = runtime[1] = 0;
 	while (td->loops--) {
 		fio_gettime(&td->start, NULL);
-		memcpy(&td->ts->stat_sample_time, &td->start, sizeof(td->start));
+		memcpy(&td->ts.stat_sample_time, &td->start, sizeof(td->start));
 
 		if (td->ratemin)
-			memcpy(&td->lastrate, &td->ts->stat_sample_time, sizeof(td->lastrate));
+			memcpy(&td->lastrate, &td->ts.stat_sample_time, sizeof(td->lastrate));
 
 		clear_io_state(td);
 		prune_io_piece_log(td);
@@ -792,16 +792,18 @@
 	}
 
 	update_rusage_stat(td);
-	fio_gettime(&td->end_time, NULL);
-	td->runtime[0] = runtime[0] / 1000;
-	td->runtime[1] = runtime[1] / 1000;
+	td->ts.runtime[0] = runtime[0] / 1000;
+	td->ts.runtime[1] = runtime[1] / 1000;
+	td->ts.total_run_time = mtime_since_now(&td->epoch);
+	td->ts.io_bytes[0] = td->io_bytes[0];
+	td->ts.io_bytes[1] = td->io_bytes[1];
 
-	if (td->ts->bw_log)
-		finish_log(td, td->ts->bw_log, "bw");
-	if (td->ts->slat_log)
-		finish_log(td, td->ts->slat_log, "slat");
-	if (td->ts->clat_log)
-		finish_log(td, td->ts->clat_log, "clat");
+	if (td->ts.bw_log)
+		finish_log(td, td->ts.bw_log, "bw");
+	if (td->ts.slat_log)
+		finish_log(td, td->ts.slat_log, "slat");
+	if (td->ts.clat_log)
+		finish_log(td, td->ts.clat_log, "clat");
 	if (td->write_iolog_file)
 		write_iolog_close(td);
 	if (td->exec_postrun) {