- 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;
+ }