From: Jens Axboe Date: Tue, 16 Aug 2016 20:51:41 +0000 (-0600) Subject: histogram: style and list fixups X-Git-Tag: fio-2.14~29 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=d730bc584efd96359ecc838ee7316a2127100b68 histogram: style and list fixups Signed-off-by: Jens Axboe --- diff --git a/iolog.c b/iolog.c index 3cb12aba..d4213dbe 100644 --- a/iolog.c +++ b/iolog.c @@ -596,7 +596,7 @@ void setup_log(struct io_log **log, struct log_params *p, * with initial io_u_plat of all zeros: */ for (i = 0; i < DDIR_RWDIR_CNT; i++) { - list = &l->hist_window[i].list.list; + list = &l->hist_window[i].list; INIT_FLIST_HEAD(list); entry = calloc(1, sizeof(struct io_u_plat_entry)); flist_add(&entry->list, list); @@ -708,22 +708,23 @@ static void flush_hist_samples(FILE *f, int hist_coarseness, void *samples, for (i = 0; i < nr_samples; i++) { s = __get_sample(samples, log_offset, i); - + entry = (struct io_u_plat_entry *) s->val; io_u_plat = entry->io_u_plat; - + entry_before = flist_first_entry(&entry->list, struct io_u_plat_entry, list); io_u_plat_before = entry_before->io_u_plat; - - fprintf(f, "%lu, %u, %u, ", (unsigned long)s->time, - io_sample_ddir(s), s->bs); + + fprintf(f, "%lu, %u, %u, ", (unsigned long) s->time, + io_sample_ddir(s), s->bs); for (j = 0; j < FIO_IO_U_PLAT_NR - stride; j += stride) { - fprintf(f, "%lu, ", hist_sum(j, stride, io_u_plat, io_u_plat_before)); + fprintf(f, "%lu, ", hist_sum(j, stride, io_u_plat, + io_u_plat_before)); } - fprintf(f, "%lu\n", (unsigned long) + fprintf(f, "%lu\n", (unsigned long) hist_sum(FIO_IO_U_PLAT_NR - stride, stride, io_u_plat, - io_u_plat_before)); - + io_u_plat_before)); + flist_del(&entry_before->list); free(entry_before); } diff --git a/iolog.h b/iolog.h index 93a9536f..ca344f19 100644 --- a/iolog.h +++ b/iolog.h @@ -18,14 +18,10 @@ struct io_stat { fio_fp64_t S; }; -struct io_u_plat_list { - struct flist_head list; -}; - struct io_hist { uint64_t samples; unsigned long hist_last; - struct io_u_plat_list list; + struct flist_head list; }; /* diff --git a/stat.c b/stat.c index a3fa8363..5e7c593f 100644 --- a/stat.c +++ b/stat.c @@ -2234,7 +2234,7 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir, dst = malloc(sizeof(struct io_u_plat_entry)); memcpy(&(dst->io_u_plat), io_u_plat, FIO_IO_U_PLAT_NR * sizeof(unsigned int)); - flist_add(&dst->list, &hw->list.list); + flist_add(&dst->list, &hw->list); __add_log_sample(iolog, (unsigned long)dst, ddir, bs, elapsed, offset);