act: fixes
authorJens Axboe <axboe@kernel.dk>
Wed, 22 May 2013 22:29:38 +0000 (00:29 +0200)
committerJens Axboe <axboe@kernel.dk>
Wed, 22 May 2013 22:29:38 +0000 (00:29 +0200)
- 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>
profiles/act.c

index d10e70e056451937921c941aa5d113c4dfe40d10..e5b31d7d2e1dceb3181a8f90e4e1ca730b07d293 100644 (file)
@@ -22,7 +22,7 @@ static struct act_pass_criteria act_pass[ACT_MAX_CRIT] = {
                .max_perm =     50,
        },
        {
-               .max_usec =     5000,
+               .max_usec =     8000,
                .max_perm =     10,
        },
        {
@@ -42,13 +42,14 @@ static unsigned int load = 1;
 
 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 @@ static int act_io_u_lat(struct thread_data *td, uint64_t usec)
 
        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 @@ static int act_io_u_lat(struct thread_data *td, uint64_t usec)
                break;
        }
 
+       memset(apd->lat_buckets, 0, sizeof(apd->lat_buckets));
+       apd->total_ios = 0;
+
        fio_gettime(&apd->sample_tv, NULL);
        return ret;
 }