Add timestamps to all actions for iolog version 3. Fio now generates iolog
files using version 3 by default, and only supports writing using that
version. Reading iolog v2 still works as expected.
Signed-off-by: Mohamad Gebai <mogeb@fb.com>
Link: https://lore.kernel.org/r/20220407174031.599117-3-mogeb@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
unsigned int io_log_blktrace;
unsigned int io_log_blktrace_swap;
unsigned long long io_log_last_ttime;
unsigned int io_log_blktrace;
unsigned int io_log_blktrace_swap;
unsigned long long io_log_last_ttime;
+ struct timespec io_log_start_time;
unsigned int io_log_current;
unsigned int io_log_checkmark;
unsigned int io_log_highmark;
unsigned int io_log_current;
unsigned int io_log_checkmark;
unsigned int io_log_highmark;
void log_io_u(const struct thread_data *td, const struct io_u *io_u)
{
void log_io_u(const struct thread_data *td, const struct io_u *io_u)
{
if (!td->o.write_iolog_file)
return;
if (!td->o.write_iolog_file)
return;
- fprintf(td->iolog_f, "%s %s %llu %llu\n", io_u->file->file_name,
+ fio_gettime(&now, NULL);
+ fprintf(td->iolog_f, "%lu %s %s %llu %llu\n", utime_since_now(&td->io_log_start_time),
+ io_u->file->file_name,
io_ddir_name(io_u->ddir),
io_u->offset, io_u->buflen);
io_ddir_name(io_u->ddir),
io_u->offset, io_u->buflen);
}
void log_file(struct thread_data *td, struct fio_file *f,
enum file_log_act what)
{
const char *act[] = { "add", "open", "close" };
}
void log_file(struct thread_data *td, struct fio_file *f,
enum file_log_act what)
{
const char *act[] = { "add", "open", "close" };
if (!td->iolog_f)
return;
if (!td->iolog_f)
return;
- fprintf(td->iolog_f, "%s %s\n", f->file_name, act[what]);
+ fio_gettime(&now, NULL);
+ fprintf(td->iolog_f, "%lu %s %s\n", utime_since_now(&td->io_log_start_time),
+ f->file_name, act[what]);
}
static void iolog_delay(struct thread_data *td, unsigned long delay)
}
static void iolog_delay(struct thread_data *td, unsigned long delay)
td->iolog_f = f;
td->iolog_buf = malloc(8192);
setvbuf(f, td->iolog_buf, _IOFBF, 8192);
td->iolog_f = f;
td->iolog_buf = malloc(8192);
setvbuf(f, td->iolog_buf, _IOFBF, 8192);
+ fio_gettime(&td->io_log_start_time, NULL);
/*
* write our version line
*/
/*
* write our version line
*/
- if (fprintf(f, "%s\n", iolog_ver2) < 0) {
+ if (fprintf(f, "%s\n", iolog_ver3) < 0) {
perror("iolog init\n");
return false;
}
perror("iolog init\n");
return false;
}