act: fixes

- Use libaio to be able to drive higher loads.

- Fix error in latency calculation.

- Fix 5ms vs 8ms typo.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/profiles/act.c b/profiles/act.c
index d10e70e..e5b31d7 100644
--- a/profiles/act.c
+++ b/profiles/act.c
@@ -22,7 +22,7 @@
 		.max_perm =	50,
 	},
 	{
-		.max_usec =	5000,
+		.max_usec =	8000,
 		.max_perm =	10,
 	},
 	{
@@ -42,13 +42,14 @@
 
 static const char *act_opts[128] = {
 	"direct=1",
-	"ioengine=sync",
+	"ioengine=libaio",
+	"iodepth=32",
 	"random_generator=lfsr",
 	"runtime=24h",
 	"time_based=1",
 	NULL,
 };
-static unsigned int opt_idx = 5;
+static unsigned int opt_idx = 6;
 static unsigned int org_idx;
 
 static void act_add_opt(const char *format, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
@@ -138,25 +139,20 @@
 
 	apd->total_ios++;
 
-	for (i = 0; i < ACT_MAX_CRIT; i++) {
-		if (usec <= act_pass[i].max_usec) {
+	for (i = ACT_MAX_CRIT - 1; i >= 0; i--) {
+		if (usec > act_pass[i].max_usec) {
 			apd->lat_buckets[i]++;
 			break;
 		}
 	}
 
-	if (i == ACT_MAX_CRIT) {
-		log_err("act: max latency exceeded!\n");
-		return 1;
-	}
-
 	if (time_since_now(&apd->sample_tv) < SAMPLE_SEC)
 		return 0;
 
 	/* SAMPLE_SEC has passed, check criteria for pass */
 	for (i = 0; i < ACT_MAX_CRIT; i++) {
 		perm = (1000.0 * apd->lat_buckets[i]) / apd->total_ios;
-		if (perm <= act_pass[i].max_perm)
+		if (perm < act_pass[i].max_perm)
 			continue;
 
 		log_err("act: %f%% exceeds pass criteria of %f%%\n", perm / 10.0, (double) act_pass[i].max_perm / 10.0);
@@ -164,6 +160,9 @@
 		break;
 	}
 
+	memset(apd->lat_buckets, 0, sizeof(apd->lat_buckets));
+	apd->total_ios = 0;
+
 	fio_gettime(&apd->sample_tv, NULL);
 	return ret;
 }