summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
57a61cd)
For some reason the initial commit always filled all
entries with zeroes, when it should just stop printing.
I suspect this was carried over from the terse/csv output,
where we do the same. But there it's actually valid, as we
have to have a fixed number of fields. For json we both
don't need it, and it's causing us to create invalid json
when we have duplicate keys.
Fixes: https://github.com/axboe/fio/issues/511
Signed-off-by: Jens Axboe <axboe@kernel.dk>
ts->clat_stat[ddir].samples,
ts->percentile_list, &ovals, &maxv,
&minv);
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);
} 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]);
}
snprintf(buf, sizeof(buf), "%f", ts->percentile_list[i].u.f);
json_object_add_value_int(percentile_object, (const char *)buf, ovals[i]);
}