* isn't a worry. Also note that this does not work for NaN values.
*/
if (len > 1)
- qsort((void *)plist, len, sizeof(plist[0]), double_cmp);
+ qsort(plist, len, sizeof(plist[0]), double_cmp);
ovals = malloc(len * sizeof(*ovals));
if (!ovals)
}
out:
- if (ovals)
- free(ovals);
+ free(ovals);
}
bool calc_lat(struct io_stat *is, unsigned long long *min,
* isn't a worry. Also note that this does not work for NaN values.
*/
if (len > 1)
- qsort((void *)plist, len, sizeof(plist[0]), double_cmp);
+ qsort(plist, len, sizeof(plist[0]), double_cmp);
/* Start only after the uninit entries end */
for (nr_uninit = 0;
else
log_buf(out, ";%llu;%llu;%f;%f", 0ULL, 0ULL, 0.0, 0.0);
- if (ovals)
- free(ovals);
+ free(ovals);
bw_stat = calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev);
if (bw_stat) {
double mean, dev, iops;
unsigned int len;
int i;
- struct json_object *dir_object, *tmp_object, *percentile_object, *clat_bins_object = NULL;
+ struct json_object *dir_object, *tmp_object, *percentile_object = NULL,
+ *clat_bins_object = NULL;
char buf[120];
double p_of_agg = 100.0;
} else
len = 0;
- percentile_object = json_create_object();
- if (ts->clat_percentiles)
+ if (ts->clat_percentiles) {
+ percentile_object = json_create_object();
json_object_add_value_object(tmp_object, "percentile", percentile_object);
- 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]);
+ for (i = 0; i < len; i++) {
+ snprintf(buf, sizeof(buf), "%f",
+ ts->percentile_list[i].u.f);
+ json_object_add_value_int(percentile_object, buf,
+ ovals[i]);
+ }
}
- if (output_format & FIO_OUTPUT_JSON_PLUS) {
+ free(ovals);
+
+ if (output_format & FIO_OUTPUT_JSON_PLUS && ts->clat_percentiles) {
clat_bins_object = json_create_object();
- if (ts->clat_percentiles)
- json_object_add_value_object(tmp_object, "bins", clat_bins_object);
+ json_object_add_value_object(tmp_object, "bins",
+ clat_bins_object);
for(i = 0; i < FIO_IO_U_PLAT_NR; i++) {
if (ddir_rw(ddir)) {
if (ts->io_u_plat[ddir][i]) {
snprintf(buf, sizeof(buf), "%llu", plat_idx_to_val(i));
- json_object_add_value_int(clat_bins_object, (const char *)buf, ts->io_u_plat[ddir][i]);
+ json_object_add_value_int(clat_bins_object, buf, ts->io_u_plat[ddir][i]);
}
} else {
if (ts->io_u_sync_plat[i]) {
snprintf(buf, sizeof(buf), "%llu", plat_idx_to_val(i));
- json_object_add_value_int(clat_bins_object, (const char *)buf, ts->io_u_sync_plat[i]);
+ json_object_add_value_int(clat_bins_object, buf, ts->io_u_sync_plat[i]);
}
}
}
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);
-
if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
if (rs->agg[ddir]) {
p_of_agg = mean * 100 / (double) (rs->agg[ddir] / 1024);
snprintf(buf, sizeof(buf), "%f",
ts->percentile_list[i].u.f);
json_object_add_value_int(percentile_object,
- (const char *)buf,
+ buf,
percentiles[i]);
}