X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.c;h=6e47c34cbbcaf528a4951519c8383b0e8e6b9c96;hp=f3b82cfbe86add3727b254301f204a348dcee166;hb=71cb78c10a80f448b912dc20d24ea731f6a102d9;hpb=4843277a98cf78be6a28fc72348ac02b33fe7f32 diff --git a/stat.c b/stat.c index f3b82cfb..6e47c34c 100644 --- a/stat.c +++ b/stat.c @@ -98,7 +98,7 @@ static unsigned int plat_val_to_idx(unsigned int val) * Convert the given index of the bucket array to the value * represented by the bucket */ -static unsigned int plat_idx_to_val(unsigned int idx) +static unsigned long long plat_idx_to_val(unsigned int idx) { unsigned int error_bits, k, base; @@ -972,12 +972,11 @@ static void add_ddir_status_json(struct thread_stat *ts, clat_bins_object = json_create_object(); json_object_add_value_object(tmp_object, "bins", clat_bins_object); for(i = 0; i < FIO_IO_U_PLAT_NR; i++) { - snprintf(buf, sizeof(buf), "%d", i); - json_object_add_value_int(clat_bins_object, (const char *)buf, ts->io_u_plat[ddir][i]); + 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, "FIO_IO_U_PLAT_BITS", FIO_IO_U_PLAT_BITS); - json_object_add_value_int(clat_bins_object, "FIO_IO_U_PLAT_VAL", FIO_IO_U_PLAT_VAL); - json_object_add_value_int(clat_bins_object, "FIO_IO_U_PLAT_NR", FIO_IO_U_PLAT_NR); } if (!calc_lat(&ts->lat_stat[ddir], &min, &max, &mean, &dev)) { @@ -2172,6 +2171,9 @@ void reset_io_stats(struct thread_data *td) ts->io_bytes[i] = 0; ts->runtime[i] = 0; + ts->total_io_u[i] = 0; + ts->short_io_u[i] = 0; + ts->drop_io_u[i] = 0; for (j = 0; j < FIO_IO_U_PLAT_NR; j++) ts->io_u_plat[i][j] = 0; @@ -2181,17 +2183,15 @@ void reset_io_stats(struct thread_data *td) ts->io_u_map[i] = 0; ts->io_u_submit[i] = 0; ts->io_u_complete[i] = 0; + } + + for (i = 0; i < FIO_IO_U_LAT_U_NR; i++) ts->io_u_lat_u[i] = 0; + for (i = 0; i < FIO_IO_U_LAT_M_NR; i++) ts->io_u_lat_m[i] = 0; - ts->total_submit = 0; - ts->total_complete = 0; - } - for (i = 0; i < 3; i++) { - ts->total_io_u[i] = 0; - ts->short_io_u[i] = 0; - ts->drop_io_u[i] = 0; - } + ts->total_submit = 0; + ts->total_complete = 0; } static void __add_stat_to_log(struct io_log *iolog, enum fio_ddir ddir,