+ assert(ddir_rw(ddir));
+
+ dir_object = json_create_object();
+ json_object_add_value_object(parent, ddirname[ddir], dir_object);
+
+ iops = bw = 0;
+ if (ts->runtime[ddir]) {
+ uint64_t runt = ts->runtime[ddir];
+
+ bw = ((1000 * ts->io_bytes[ddir]) / runt) / 1024;
+ iops = (1000 * (uint64_t) ts->total_io_u[ddir]) / runt;
+ }
+
+ json_object_add_value_int(dir_object, "io_bytes", ts->io_bytes[ddir] >> 10);
+ json_object_add_value_int(dir_object, "bw", bw);
+ json_object_add_value_int(dir_object, "iops", iops);
+ json_object_add_value_int(dir_object, "runtime", ts->runtime[ddir]);
+
+ if (!calc_lat(&ts->slat_stat[ddir], &min, &max, &mean, &dev)) {
+ min = max = 0;
+ mean = dev = 0.0;
+ }
+ tmp_object = json_create_object();
+ json_object_add_value_object(dir_object, "slat", tmp_object);
+ json_object_add_value_int(tmp_object, "min", min);
+ 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 (!calc_lat(&ts->clat_stat[ddir], &min, &max, &mean, &dev)) {
+ min = max = 0;
+ mean = dev = 0.0;
+ }
+ tmp_object = json_create_object();
+ json_object_add_value_object(dir_object, "clat", tmp_object);
+ json_object_add_value_int(tmp_object, "min", min);
+ 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 (ts->clat_percentiles) {
+ len = calc_clat_percentiles(ts->io_u_plat[ddir],
+ ts->clat_stat[ddir].samples,
+ ts->percentile_list, &ovals, &maxv,
+ &minv);
+ } 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;
+ }
+ snprintf(buf, sizeof(buf) - 1, "%2.2f", ts->percentile_list[i].u.f);
+ json_object_add_value_int(percentile_object, (const char *)buf, ovals[i]);
+ }
+
+ if (!calc_lat(&ts->lat_stat[ddir], &min, &max, &mean, &dev)) {
+ min = max = 0;
+ mean = dev = 0.0;
+ }
+ tmp_object = json_create_object();
+ json_object_add_value_object(dir_object, "lat", tmp_object);
+ json_object_add_value_int(tmp_object, "min", min);
+ 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 (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];
+ if (p_of_agg > 100.0)
+ p_of_agg = 100.0;
+ }
+ } else {
+ min = max = 0;
+ p_of_agg = mean = dev = 0.0;
+ }
+ json_object_add_value_int(dir_object, "bw_min", min);
+ json_object_add_value_int(dir_object, "bw_max", max);
+ json_object_add_value_float(dir_object, "bw_agg", mean);
+ json_object_add_value_float(dir_object, "bw_mean", mean);
+ json_object_add_value_float(dir_object, "bw_dev", dev);
+}
+
+static void show_thread_status_terse_v2(struct thread_stat *ts,
+ struct group_run_stats *rs)
+{
+ double io_u_dist[FIO_IO_U_MAP_NR];
+ double io_u_lat_u[FIO_IO_U_LAT_U_NR];
+ double io_u_lat_m[FIO_IO_U_LAT_M_NR];
+ double usr_cpu, sys_cpu;
+ int i;
+
+ /* General Info */
+ log_info("2;%s;%d;%d", ts->name, ts->groupid, ts->error);
+ /* Log Read Status */
+ show_ddir_status_terse(ts, rs, DDIR_READ);
+ /* Log Write Status */
+ show_ddir_status_terse(ts, rs, DDIR_WRITE);
+ /* Log Trim Status */
+ show_ddir_status_terse(ts, rs, DDIR_TRIM);
+
+ /* CPU Usage */
+ if (ts->total_run_time) {
+ double runt = (double) ts->total_run_time;
+
+ usr_cpu = (double) ts->usr_time * 100 / runt;
+ sys_cpu = (double) ts->sys_time * 100 / runt;
+ } else {
+ usr_cpu = 0;
+ sys_cpu = 0;
+ }
+
+ log_info(";%f%%;%f%%;%lu;%lu;%lu", usr_cpu, sys_cpu, ts->ctx, ts->majf,
+ ts->minf);
+
+ /* Calc % distribution of IO depths, usecond, msecond latency */
+ stat_calc_dist(ts->io_u_map, ts_total_io_u(ts), io_u_dist);
+ stat_calc_lat_u(ts, io_u_lat_u);
+ stat_calc_lat_m(ts, io_u_lat_m);
+
+ /* Only show fixed 7 I/O depth levels*/
+ log_info(";%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%;%3.1f%%",
+ io_u_dist[0], io_u_dist[1], io_u_dist[2], io_u_dist[3],
+ io_u_dist[4], io_u_dist[5], io_u_dist[6]);
+
+ /* Microsecond latency */
+ for (i = 0; i < FIO_IO_U_LAT_U_NR; i++)
+ log_info(";%3.2f%%", io_u_lat_u[i]);
+ /* Millisecond latency */
+ for (i = 0; i < FIO_IO_U_LAT_M_NR; i++)
+ log_info(";%3.2f%%", io_u_lat_m[i]);
+ /* Additional output if continue_on_error set - default off*/
+ if (ts->continue_on_error)
+ log_info(";%lu;%d", ts->total_err_count, ts->first_error);
+ log_info("\n");
+
+ /* Additional output if description is set */
+ if (ts->description)
+ log_info(";%s", ts->description);
+
+ log_info("\n");
+}
+
+static void show_thread_status_terse_v3_v4(struct thread_stat *ts,
+ struct group_run_stats *rs, int ver)