+ if (lat_ts_has_stats(ts)) {
+ tmp = json_create_object();
+ json_object_add_value_object(root, "lat_step", tmp);
+ }
+
+ for (i = 0; i < DDIR_RWDIR_CNT; i++) {
+ struct json_object *val;
+
+ if (!__lat_ts_has_stats(ts, i))
+ continue;
+
+ val = json_create_object();
+ json_object_add_value_object(tmp, io_ddir_name(i), val);
+
+ for (j = 0; j < ARRAY_SIZE(ts->step_stats); j++) {
+ struct lat_step_stats *ls = &ts->step_stats[j];
+ char name[32];
+
+ if (!ls->iops[i])
+ continue;
+
+ sprintf(name, "%llu", (unsigned long long) ls->iops[i]);
+ json_object_add_value_float(val, name, ls->avg[i].u.f);
+ }
+ }
+