X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=iolog.c;h=137c1e9889c8e025a59d8ab71df7378b767ef996;hb=1e5324e723116a5faf9da686993cc79c14d62d4b;hp=f962864d912d9b5cdc3bfbc39286241fdd717665;hpb=ac9b9101f1ef57965d6ffd51f143274a1eb665ef;p=fio.git diff --git a/iolog.c b/iolog.c index f962864d..137c1e98 100644 --- a/iolog.c +++ b/iolog.c @@ -110,7 +110,7 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u) { struct io_piece *ipo; unsigned long elapsed; - + while (!flist_empty(&td->io_log_list)) { int ret; @@ -141,11 +141,10 @@ int read_iolog_get(struct thread_data *td, struct io_u *io_u) elapsed = mtime_since_genesis(); if (ipo->delay > elapsed) usec_sleep(td, (ipo->delay - elapsed) * 1000); - } free(ipo); - + if (io_u->ddir != DDIR_WAIT) return 0; } @@ -239,7 +238,9 @@ restart: else if (ipo->offset > __ipo->offset) p = &(*p)->rb_right; else { - assert(ipo->len == __ipo->len); + dprint(FD_IO, "iolog: overlap %llu/%lu, %llu/%lu", + __ipo->offset, __ipo->len, + ipo->offset, ipo->len); td->io_hist_len--; rb_erase(parent, &td->io_hist_tree); remove_trim_entry(td, __ipo); @@ -370,7 +371,7 @@ static int read_iolog2(struct thread_data *td, FILE *f) ipo->fileno = fileno; ipo->file_action = file_action; } - + queue_io_piece(td, ipo); } @@ -492,13 +493,16 @@ int init_iolog(struct thread_data *td) return ret; } -void setup_log(struct io_log **log) +void setup_log(struct io_log **log, unsigned long avg_msec, int log_type) { struct io_log *l = malloc(sizeof(*l)); + memset(l, 0, sizeof(*l)); l->nr_samples = 0; l->max_samples = 1024; + l->log_type = log_type; l->log = malloc(l->max_samples * sizeof(struct io_sample)); + l->avg_msec = avg_msec; *log = l; } @@ -514,10 +518,10 @@ void __finish_log(struct io_log *log, const char *name) } for (i = 0; i < log->nr_samples; i++) { - fprintf(f, "%lu, %lu, %u, %u\n", log->log[i].time, - log->log[i].val, - log->log[i].ddir, - log->log[i].bs); + fprintf(f, "%lu, %lu, %u, %u\n", + (unsigned long) log->log[i].time, + (unsigned long) log->log[i].val, + log->log[i].ddir, log->log[i].bs); } fclose(f); @@ -532,7 +536,13 @@ void finish_log_named(struct thread_data *td, struct io_log *log, snprintf(file_name, 200, "%s_%s.log", prefix, postfix); p = basename(file_name); - __finish_log(log, p); + + if (td->client_type == FIO_CLIENT_TYPE_GUI) { + fio_send_iolog(td, log, p); + free(log->log); + free(log); + } else + __finish_log(log, p); } void finish_log(struct thread_data *td, struct io_log *log, const char *name)