*/
int load_blktrace(struct thread_data *td, const char *filename)
{
- unsigned long long ttime;
+ unsigned long long ttime, delay;
struct blk_io_trace t;
unsigned long ios[2];
+ unsigned int cpu;
int fd;
fd = open(filename, O_RDONLY);
ios[0] = ios[1] = 0;
ttime = 0;
+ cpu = 0;
do {
/*
* Once this is working fully, I'll add a layer between
td_verror(td, ret, "blktrace lseek");
goto err;
}
- if (!ttime)
+ if (!ttime) {
ttime = t.time;
- handle_trace(td, &t, t.time - ttime, ios);
+ cpu = t.cpu;
+ }
+ delay = 0;
+ if (cpu == t.cpu)
+ delay = t.time - ttime;
+ handle_trace(td, &t, delay, ios);
ttime = t.time;
+ cpu = t.cpu;
} while (1);
close(fd);
struct timeval start; /* start of this loop */
struct timeval epoch; /* time job was started */
struct timeval rw_end[2];
+ struct timeval last_issue;
unsigned int rw_end_set[2];
/*
if (td->io_ops->flags & FIO_SYNCIO) {
fio_gettime(&io_u->issue_time, NULL);
+ memcpy(&td->last_issue, &io_u->issue_time, sizeof(struct timeval));
/*
* for a sync engine, set the timeout upfront
if ((td->io_ops->flags & FIO_SYNCIO) == 0) {
fio_gettime(&io_u->issue_time, NULL);
+ memcpy(&td->last_issue, &io_u->issue_time, sizeof(struct timeval));
/*
* async engine, set the timeout here
fprintf(td->iolog_f, "%u,%llu,%lu\n", io_u->ddir, io_u->offset, io_u->buflen);
}
+static void iolog_delay(struct thread_data *td, unsigned long delay)
+{
+ unsigned long usec = utime_since_now(&td->last_issue);
+
+ if (delay < usec)
+ return;
+
+ delay -= usec;
+
+ /*
+ * less than 100 usec delay, just regard it as noise
+ */
+ if (delay < 100)
+ return;
+
+ usec_sleep(td, delay);
+}
+
int read_iolog_get(struct thread_data *td, struct io_u *io_u)
{
struct io_piece *ipo;
io_u->buflen = ipo->len;
io_u->ddir = ipo->ddir;
io_u->file = ipo->file;
+
+ if (ipo->delay)
+ iolog_delay(td, ipo->delay);
+
/*
* work around, this needs a format change to work for > 1 file
*/