X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.h;h=084724669bbb3ebed266933783d5a6478296af62;hp=bdb858efa96a8e80508eb24efaaf65653bd09653;hb=ec41265e81c70d8573d1359e27876c37c30c7d9d;hpb=3e47bd250cac5fb81a5c0ad578dfbe90c6ddf6de;ds=sidebyside diff --git a/stat.h b/stat.h index bdb858ef..08472466 100644 --- a/stat.h +++ b/stat.h @@ -1,6 +1,8 @@ #ifndef FIO_STAT_H #define FIO_STAT_H +#include "iolog.h" + struct group_run_stats { uint64_t max_run[2], min_run[2]; uint64_t max_bw[2], min_bw[2]; @@ -198,5 +200,26 @@ extern void sum_group_stats(struct group_run_stats *dst, struct group_run_stats extern void init_thread_stat(struct thread_stat *ts); extern void init_group_run_stat(struct group_run_stats *gs); extern void eta_to_str(char *str, unsigned long eta_sec); +extern int calc_lat(struct io_stat *is, unsigned long *min, unsigned long *max, double *mean, double *dev); +extern unsigned int calc_clat_percentiles(unsigned int *io_u_plat, unsigned long nr, fio_fp64_t *plist, unsigned int **output, unsigned int *maxv, unsigned int *minv); +extern void stat_calc_lat_m(struct thread_stat *ts, double *io_u_lat); +extern void stat_calc_lat_u(struct thread_stat *ts, double *io_u_lat); +extern void stat_calc_dist(unsigned int *map, unsigned long total, double *io_u_dist); + +#define ts_total_io_u(ts) ((ts)->total_io_u[0] + (ts)->total_io_u[1]) + +static inline int usec_to_msec(unsigned long *min, unsigned long *max, + double *mean, double *dev) +{ + if (*min > 1000 && *max > 1000 && *mean > 1000.0 && *dev > 1000.0) { + *min /= 1000; + *max /= 1000; + *mean /= 1000.0; + *dev /= 1000.0; + return 0; + } + + return 1; +} #endif