stat: don't add duplicate clat entries for json
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index cc171a4d52ff69dab7df15037a7b89996e05ecaa..80f804a19e0bd52ab2e790e07b8041938a50fa22 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1030,16 +1030,14 @@ static void add_ddir_status_json(struct thread_stat *ts,
                                        ts->clat_stat[ddir].samples,
                                        ts->percentile_list, &ovals, &maxv,
                                        &minv);
+               if (len > FIO_IO_U_LIST_MAX_LEN)
+                       len = FIO_IO_U_LIST_MAX_LEN;
        } else
                len = 0;
 
        percentile_object = json_create_object();
        json_object_add_value_object(tmp_object, "percentile", percentile_object);
-       for (i = 0; i < FIO_IO_U_LIST_MAX_LEN; i++) {
-               if (i >= len) {
-                       json_object_add_value_int(percentile_object, "0.00", 0);
-                       continue;
-               }
+       for (i = 0; i < len; i++) {
                snprintf(buf, sizeof(buf), "%f", ts->percentile_list[i].u.f);
                json_object_add_value_int(percentile_object, (const char *)buf, ovals[i]);
        }
@@ -1490,6 +1488,8 @@ void sum_group_stats(struct group_run_stats *dst, struct group_run_stats *src)
                dst->kb_base = src->kb_base;
        if (!dst->unit_base)
                dst->unit_base = src->unit_base;
+       if (!dst->sig_figs)
+               dst->sig_figs = src->sig_figs;
 }
 
 void sum_thread_stats(struct thread_stat *dst, struct thread_stat *src,