The most variation is usually seen at startup, so don't start tracking
latencies until we've done the first reporting run. Things should be
nice and stable at that point.
To make this cheaper on the fast path, clock_index is only valid if
it's non-zero. This makes checking for stats cheap in the reap path.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
static struct submitter *submitter;
static volatile int finish;
static struct submitter *submitter;
static volatile int finish;
+static int stats_running;
static int depth = DEPTH;
static int batch_submit = BATCH_SUBMIT;
static int depth = DEPTH;
static int batch_submit = BATCH_SUBMIT;
sqe->ioprio = 0;
sqe->off = offset;
sqe->user_data = (unsigned long) f->fileno;
sqe->ioprio = 0;
sqe->off = offset;
sqe->user_data = (unsigned long) f->fileno;
+ if (stats && stats_running)
sqe->user_data |= ((unsigned long)s->clock_index << 32);
}
sqe->user_data |= ((unsigned long)s->clock_index << 32);
}
stat_nr = 0;
}
last_idx = clock_index;
stat_nr = 0;
}
last_idx = clock_index;
+ } else if (clock_index)
+ stat_nr++;
if (stats) {
nr_batch = roundup_pow2(depth / batch_submit);
s->clock_batch = calloc(nr_batch, sizeof(unsigned long));
if (stats) {
nr_batch = roundup_pow2(depth / batch_submit);
s->clock_batch = calloc(nr_batch, sizeof(unsigned long));
s->plat = calloc(PLAT_NR, sizeof(unsigned long));
} else {
s->plat = calloc(PLAT_NR, sizeof(unsigned long));
} else {
s->iovecs[index].iov_len, offset);
data = f->fileno;
s->iovecs[index].iov_len, offset);
data = f->fileno;
+ if (stats && stats_running)
data |= ((unsigned long) s->clock_index << 32);
iocb->data = (void *) (uintptr_t) data;
index++;
data |= ((unsigned long) s->clock_index << 32);
iocb->data = (void *) (uintptr_t) data;
index++;
stat_nr = 0;
}
last_idx = clock_index;
stat_nr = 0;
}
last_idx = clock_index;
+ } else if (clock_index)
+ stat_nr++;
/* don't print partial run, if interrupted by signal */
if (finish)
break;
/* don't print partial run, if interrupted by signal */
if (finish)
break;
+
+ /* one second in to the run, enable stats */
+ if (stats)
+ stats_running = 1;
+
for (j = 0; j < nthreads; j++) {
this_done += s->done;
this_call += s->calls;
for (j = 0; j < nthreads; j++) {
this_done += s->done;
this_call += s->calls;