X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=stat.c;h=c8a45dbd4ce05e962659245be13e67e0251adcc6;hb=0a93fb3e08bf8957b782b80b4d5487852f0c81ce;hp=09afa5bdd8f5bb0fb3c771d01bae2fa1f491dc1e;hpb=9acb08a9957b1111a06fbca6af113fa0c98dbd7c;p=fio.git diff --git a/stat.c b/stat.c index 09afa5bd..c8a45dbd 100644 --- a/stat.c +++ b/stat.c @@ -135,11 +135,11 @@ static int double_cmp(const void *a, const void *b) return cmp; } -unsigned int calc_clat_percentiles(unsigned int *io_u_plat, unsigned long nr, +unsigned int calc_clat_percentiles(unsigned int *io_u_plat, unsigned long long nr, fio_fp64_t *plist, unsigned long long **output, unsigned long long *maxv, unsigned long long *minv) { - unsigned long sum = 0; + unsigned long long sum = 0; unsigned int len, i, j = 0; unsigned int oval_len = 0; unsigned long long *ovals = NULL; @@ -198,7 +198,7 @@ unsigned int calc_clat_percentiles(unsigned int *io_u_plat, unsigned long nr, /* * Find and display the p-th percentile of clat */ -static void show_clat_percentiles(unsigned int *io_u_plat, unsigned long nr, +static void show_clat_percentiles(unsigned int *io_u_plat, unsigned long long nr, fio_fp64_t *plist, unsigned int precision, bool is_clat, struct buf_output *out) { @@ -962,7 +962,7 @@ static void add_ddir_status_json(struct thread_stat *ts, unsigned int len; int i; const char *ddirname[] = {"read", "write", "trim"}; - struct json_object *dir_object, *tmp_object, *percentile_object, *clat_bins_object; + struct json_object *dir_object, *tmp_object, *percentile_object, *clat_bins_object = NULL; char buf[120]; double p_of_agg = 100.0; @@ -1036,7 +1036,9 @@ static void add_ddir_status_json(struct thread_stat *ts, if (output_format & FIO_OUTPUT_JSON_PLUS) { clat_bins_object = json_create_object(); - json_object_add_value_object(tmp_object, "bins", clat_bins_object); + if (ts->clat_percentiles) + json_object_add_value_object(tmp_object, "bins", clat_bins_object); + for(i = 0; i < FIO_IO_U_PLAT_NR; i++) { if (ts->io_u_plat[ddir][i]) { snprintf(buf, sizeof(buf), "%llu", plat_idx_to_val(i)); @@ -1055,6 +1057,9 @@ static void add_ddir_status_json(struct thread_stat *ts, json_object_add_value_int(tmp_object, "max", max); json_object_add_value_float(tmp_object, "mean", mean); json_object_add_value_float(tmp_object, "stddev", dev); + if (output_format & FIO_OUTPUT_JSON_PLUS && ts->lat_percentiles) + json_object_add_value_object(tmp_object, "bins", clat_bins_object); + if (ovals) free(ovals);