projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
windows: update EULA
[fio.git]
/
blktrace.c
diff --git
a/blktrace.c
b/blktrace.c
index 2d4dc1b9fbca3724e47c7285e7fcdab277b82bc3..6e4d0a4c9620bdabb9000ff45e6bff60e67a2c5f 100644
(file)
--- a/
blktrace.c
+++ b/
blktrace.c
@@
-3,15
+3,14
@@
*/
#include <stdio.h>
#include <stdlib.h>
*/
#include <stdio.h>
#include <stdlib.h>
-#include <sys/stat.h>
#include <sys/ioctl.h>
#include <linux/fs.h>
#include <sys/ioctl.h>
#include <linux/fs.h>
-#include <dirent.h>
#include "flist.h"
#include "fio.h"
#include "flist.h"
#include "fio.h"
+#include "blktrace.h"
#include "blktrace_api.h"
#include "blktrace_api.h"
-#include "lib/linux-dev-lookup.h"
+#include "
os
lib/linux-dev-lookup.h"
#define TRACE_FIFO_SIZE 8192
#define TRACE_FIFO_SIZE 8192
@@
-208,6
+207,14
@@
out:
return last_fileno;
}
return last_fileno;
}
+static void t_bytes_align(struct thread_options *o, struct blk_io_trace *t)
+{
+ if (!o->replay_align)
+ return;
+
+ t->bytes = (t->bytes + o->replay_align - 1) & ~(o->replay_align - 1);
+}
+
/*
* Store blk_io_trace data in an ipo for later retrieval.
*/
/*
* Store blk_io_trace data in an ipo for later retrieval.
*/
@@
-220,6
+227,9
@@
static void store_ipo(struct thread_data *td, unsigned long long offset,
init_ipo(ipo);
ipo->offset = offset * bs;
init_ipo(ipo);
ipo->offset = offset * bs;
+ if (td->o.replay_scale)
+ ipo->offset = ipo->offset / td->o.replay_scale;
+ ipo_bytes_align(td->o.replay_align, ipo);
ipo->len = bytes;
ipo->delay = ttime / 1000;
if (rw)
ipo->len = bytes;
ipo->delay = ttime / 1000;
if (rw)
@@
-275,6
+285,9
@@
static void handle_trace_discard(struct thread_data *td,
INIT_FLIST_HEAD(&ipo->list);
ipo->offset = t->sector * bs;
INIT_FLIST_HEAD(&ipo->list);
ipo->offset = t->sector * bs;
+ if (td->o.replay_scale)
+ ipo->offset = ipo->offset / td->o.replay_scale;
+ ipo_bytes_align(td->o.replay_align, ipo);
ipo->len = t->bytes;
ipo->delay = ttime / 1000;
ipo->ddir = DDIR_TRIM;
ipo->len = t->bytes;
ipo->delay = ttime / 1000;
ipo->ddir = DDIR_TRIM;
@@
-314,7
+327,7
@@
static void handle_trace(struct thread_data *td, struct blk_io_trace *t,
unsigned long *ios, unsigned int *bs)
{
static unsigned long long last_ttime;
unsigned long *ios, unsigned int *bs)
{
static unsigned long long last_ttime;
- unsigned long long delay;
+ unsigned long long delay
= 0
;
if ((t->action & 0xffff) != __BLK_TA_QUEUE)
return;
if ((t->action & 0xffff) != __BLK_TA_QUEUE)
return;
@@
-329,6
+342,8
@@
static void handle_trace(struct thread_data *td, struct blk_io_trace *t,
}
}
}
}
+ t_bytes_align(&td->o, t);
+
if (t->action & BLK_TC_ACT(BLK_TC_NOTIFY))
handle_trace_notify(t);
else if (t->action & BLK_TC_ACT(BLK_TC_DISCARD))
if (t->action & BLK_TC_ACT(BLK_TC_NOTIFY))
handle_trace_notify(t);
else if (t->action & BLK_TC_ACT(BLK_TC_DISCARD))
@@
-483,10
+498,8
@@
int load_blktrace(struct thread_data *td, const char *filename, int need_swap)
handle_trace(td, &t, ios, rw_bs);
} while (1);
handle_trace(td, &t, ios, rw_bs);
} while (1);
- for (i = 0; i < td->files_index; i++) {
- f = td->files[i];
+ for_each_file(td, f, i)
trace_add_open_close_event(td, f->fileno, FIO_LOG_CLOSE_FILE);
trace_add_open_close_event(td, f->fileno, FIO_LOG_CLOSE_FILE);
- }
fifo_free(fifo);
close(fd);
fifo_free(fifo);
close(fd);