X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=iolog.c;h=feda9ed68fbcc0414556d91c307378300c00d966;hp=d4a101766076f7a83b2da1ea0ac33a455bbd5ea2;hb=a3f001f5f679ae4efc5f34f682b16a2673ec2bac;hpb=2466096336bd0fbc1a94811aa338926af6baf42f diff --git a/iolog.c b/iolog.c index d4a10176..feda9ed6 100644 --- a/iolog.c +++ b/iolog.c @@ -634,7 +634,7 @@ void free_log(struct io_log *log) free(log); } -static void flush_samples(FILE *f, void *samples, uint64_t sample_size) +void flush_samples(FILE *f, void *samples, uint64_t sample_size) { struct io_sample *s; int log_offset; @@ -682,13 +682,6 @@ struct iolog_flush_data { uint64_t nr_samples; }; -struct iolog_compress { - struct flist_head list; - void *buf; - size_t len; - unsigned int seq; -}; - #define GZ_CHUNK 131072 static struct iolog_compress *get_new_chunk(unsigned int seq) @@ -984,7 +977,7 @@ static int finish_log(struct thread_data *td, struct io_log *log, int trylock) } else fio_lock_file(log->filename); - if (td->client_type == FIO_CLIENT_TYPE_GUI) + if (td->client_type == FIO_CLIENT_TYPE_GUI || is_backend) fio_send_iolog(td, log, log->filename); else flush_log(log, !td->o.per_job_logs); @@ -994,6 +987,26 @@ static int finish_log(struct thread_data *td, struct io_log *log, int trylock) return 0; } +size_t log_chunk_sizes(struct io_log *log) +{ + struct flist_head *entry; + size_t ret; + + if (flist_empty(&log->chunk_list)) + return 0; + + ret = 0; + pthread_mutex_lock(&log->chunk_lock); + flist_for_each(entry, &log->chunk_list) { + struct iolog_compress *c; + + c = flist_entry(entry, struct iolog_compress, list); + ret += c->len; + } + pthread_mutex_unlock(&log->chunk_lock); + return ret; +} + #ifdef CONFIG_ZLIB static void drop_data_unlock(struct iolog_flush_data *data)