projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
blktrace support: adjust largest io_u buffer size to match trace
[fio.git]
/
blktrace.c
diff --git
a/blktrace.c
b/blktrace.c
index 864e9dc7900bf4971fcc70dc7720a0b89be7b42e..afa699cd1a3f7f4225e4b220654d347c9641397a 100644
(file)
--- a/
blktrace.c
+++ b/
blktrace.c
@@
-83,7
+83,8
@@
static void store_ipo(struct thread_data *td, unsigned long long offset,
* due to internal workings of the block layer.
*/
static void handle_trace(struct thread_data *td, struct blk_io_trace *t,
* due to internal workings of the block layer.
*/
static void handle_trace(struct thread_data *td, struct blk_io_trace *t,
- unsigned long long ttime, unsigned long *ios)
+ unsigned long long ttime, unsigned long *ios,
+ unsigned int *bs)
{
int rw;
{
int rw;
@@
-99,7
+100,12
@@
static void handle_trace(struct thread_data *td, struct blk_io_trace *t,
return;
rw = (t->action & BLK_TC_ACT(BLK_TC_WRITE)) != 0;
return;
rw = (t->action & BLK_TC_ACT(BLK_TC_WRITE)) != 0;
+
+ if (t->bytes > bs[rw])
+ bs[rw] = t->bytes;
+
ios[rw]++;
ios[rw]++;
+ td->o.size += t->bytes;
store_ipo(td, t->sector, t->bytes, rw, ttime);
}
store_ipo(td, t->sector, t->bytes, rw, ttime);
}
@@
-109,9
+115,11
@@
static void handle_trace(struct thread_data *td, struct blk_io_trace *t,
*/
int load_blktrace(struct thread_data *td, const char *filename)
{
*/
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];
struct blk_io_trace t;
unsigned long ios[2];
+ unsigned int cpu;
+ unsigned int rw_bs[2];
int fd;
fd = open(filename, O_RDONLY);
int fd;
fd = open(filename, O_RDONLY);
@@
-120,8
+128,12
@@
int load_blktrace(struct thread_data *td, const char *filename)
return 1;
}
return 1;
}
- ios[0] = ios[1] = 0;
+ td->o.size = 0;
+
+ cpu = 0;
ttime = 0;
ttime = 0;
+ ios[0] = ios[1] = 0;
+ rw_bs[0] = rw_bs[1] = 0;
do {
/*
* Once this is working fully, I'll add a layer between
do {
/*
* Once this is working fully, I'll add a layer between
@@
-154,10
+166,16
@@
int load_blktrace(struct thread_data *td, const char *filename)
td_verror(td, ret, "blktrace lseek");
goto err;
}
td_verror(td, ret, "blktrace lseek");
goto err;
}
- if (!ttime)
+ if (!ttime)
{
ttime = t.time;
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, rw_bs);
ttime = t.time;
ttime = t.time;
+ cpu = t.cpu;
} while (1);
close(fd);
} while (1);
close(fd);
@@
-165,12
+183,17
@@
int load_blktrace(struct thread_data *td, const char *filename)
if (!ios[DDIR_READ] && !ios[DDIR_WRITE]) {
log_err("fio: found no ios in blktrace data\n");
return 1;
if (!ios[DDIR_READ] && !ios[DDIR_WRITE]) {
log_err("fio: found no ios in blktrace data\n");
return 1;
- } else if (ios[DDIR_READ] && !ios[DDIR_READ])
+ } else if (ios[DDIR_READ] && !ios[DDIR_READ])
{
td->o.td_ddir = TD_DDIR_READ;
td->o.td_ddir = TD_DDIR_READ;
- else if (!ios[DDIR_READ] && ios[DDIR_WRITE])
+ td->o.max_bs[DDIR_READ] = rw_bs[DDIR_READ];
+ } else if (!ios[DDIR_READ] && ios[DDIR_WRITE]) {
td->o.td_ddir = TD_DDIR_WRITE;
td->o.td_ddir = TD_DDIR_WRITE;
- else
+ td->o.max_bs[DDIR_WRITE] = rw_bs[DDIR_WRITE];
+ } else {
td->o.td_ddir = TD_DDIR_RW;
td->o.td_ddir = TD_DDIR_RW;
+ td->o.max_bs[DDIR_READ] = rw_bs[DDIR_READ];
+ td->o.max_bs[DDIR_WRITE] = rw_bs[DDIR_WRITE];
+ }
/*
* We need to do direct/raw ios to the device, to avoid getting
/*
* We need to do direct/raw ios to the device, to avoid getting