If we cut a data direction short, log that time so we don't
account the full runtime.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
td->zone_bytes = 0;
td->rate_bytes = 0;
td->rate_blocks = 0;
td->zone_bytes = 0;
td->rate_bytes = 0;
td->rate_blocks = 0;
+ td->rw_end_set[0] = td->rw_end_set[1] = 0;
{
unsigned long long runtime[2];
struct thread_data *td = data;
{
unsigned long long runtime[2];
struct thread_data *td = data;
int clear_state;
if (!td->o.use_thread)
int clear_state;
if (!td->o.use_thread)
- if (td_read(td) && td->io_bytes[DDIR_READ])
- runtime[DDIR_READ] += utime_since_now(&td->start);
- if (td_write(td) && td->io_bytes[DDIR_WRITE])
- runtime[DDIR_WRITE] += utime_since_now(&td->start);
+ if (td_read(td) && td->io_bytes[DDIR_READ]) {
+ if (td->rw_end_set[DDIR_READ])
+ elapsed = utime_since(&td->start, &td->rw_end[DDIR_READ]);
+ else
+ elapsed = utime_since_now(&td->start);
+
+ runtime[DDIR_READ] += elapsed;
+ }
+ if (td_write(td) && td->io_bytes[DDIR_WRITE]) {
+ if (td->rw_end_set[DDIR_WRITE])
+ elapsed = utime_since(&td->start, &td->rw_end[DDIR_WRITE]);
+ else
+ elapsed = utime_since_now(&td->start);
+
+ runtime[DDIR_WRITE] += elapsed;
+ }
if (td->error || td->terminate)
break;
if (td->error || td->terminate)
break;
struct timeval start; /* start of this loop */
struct timeval epoch; /* time job was started */
struct timeval start; /* start of this loop */
struct timeval epoch; /* time job was started */
+ struct timeval rw_end[2];
+ unsigned int rw_end_set[2];
/*
* read/write mixed workload state
/*
* read/write mixed workload state
*/
ddir = get_rand_ddir(td);
max_bytes = td->this_io_bytes[ddir];
*/
ddir = get_rand_ddir(td);
max_bytes = td->this_io_bytes[ddir];
- if (max_bytes >= (td->io_size * td->o.rwmix[ddir] / 100))
+ if (max_bytes >= (td->io_size * td->o.rwmix[ddir] / 100)) {
+ if (!td->rw_end_set[ddir]) {
+ td->rw_end_set[ddir] = 1;
+ memcpy(&td->rw_end[ddir], &now, sizeof(now));
+ }
if (ddir != td->rwmix_ddir)
set_rwmix_bytes(td);
if (ddir != td->rwmix_ddir)
set_rwmix_bytes(td);