X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=iolog.c;h=975ce6f7a481c438025992f4b828b6d69378b290;hb=17df7023156b50ee7288eea0f118f1ac20b21ea2;hp=8eef93258199dc9070adb47ca5b5ff8631ae216a;hpb=1e613c9c23932006263dd8334007865f32891a0c;p=fio.git diff --git a/iolog.c b/iolog.c index 8eef9325..975ce6f7 100644 --- a/iolog.c +++ b/iolog.c @@ -661,16 +661,19 @@ void free_log(struct io_log *log) sfree(log); } -static inline int hist_sum(int j, int stride, unsigned int *io_u_plat) { - int sum = 0; - for (int k = 0; k < stride; k++) { +static inline unsigned long hist_sum(int j, int stride, unsigned int *io_u_plat) +{ + unsigned long sum; + int k; + + for (k = sum = 0; k < stride; k++) sum += io_u_plat[j + k]; - } + return sum; } void flush_hist_samples(FILE *f, int hist_coarseness, void *samples, - uint64_t sample_size) + uint64_t sample_size) { struct io_sample *s; int log_offset; @@ -689,11 +692,11 @@ 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); - io_u_plat = (unsigned int *)(s->val); + io_u_plat = (unsigned int *) (uintptr_t) s->val; 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, ", (unsigned long) hist_sum(j, stride, io_u_plat)); + fprintf(f, "%lu, ", hist_sum(j, stride, io_u_plat)); } fprintf(f, "%lu\n", (unsigned long) hist_sum(FIO_IO_U_PLAT_NR - stride, stride, io_u_plat));