@@ -1205,6 +1205,27 @@ static void show_disk_util(int terse, struct json_object *parent,
12051205 }
12061206}
12071207
1208+ static double scale_down_ns (unsigned long long val , const char * * unit )
1209+ {
1210+ double retval ;
1211+
1212+ if (val >= 2000000000 ) {
1213+ retval = (double ) val / 1000000000.0 ;
1214+ * unit = "s" ;
1215+ } else if (val >= 2000000 ) {
1216+ retval = (double ) val / 1000000.0 ;
1217+ * unit = "ms" ;
1218+ } else if (val >= 2000 ) {
1219+ retval = (double ) val / 1000.0 ;
1220+ * unit = "us" ;
1221+ } else {
1222+ retval = (double ) val ;
1223+ * unit = "ns" ;
1224+ }
1225+
1226+ return retval ;
1227+ }
1228+
12081229static void show_thread_status_normal (struct thread_stat * ts ,
12091230 const struct group_run_stats * rs ,
12101231 struct buf_output * out )
@@ -1306,9 +1327,14 @@ static void show_thread_status_normal(struct thread_stat *ts,
13061327 strerror (ts -> first_error ));
13071328 }
13081329 if (ts -> latency_depth ) {
1309- log_buf (out , " latency : target=%llu, window=%llu, percentile=%.2f%%, depth=%u\n" ,
1310- (unsigned long long )ts -> latency_target ,
1311- (unsigned long long )ts -> latency_window ,
1330+ double target , window ;
1331+ const char * target_unit , * window_unit ;
1332+
1333+ target = scale_down_ns (ts -> latency_target , & target_unit );
1334+ window = scale_down_ns (ts -> latency_window * 1000 , & window_unit );
1335+ log_buf (out , " latency : target=%.2f%s, window=%.2f%s, percentile=%.2f%%, depth=%u\n" ,
1336+ target , target_unit ,
1337+ window , window_unit ,
13121338 ts -> latency_percentile .u .f ,
13131339 ts -> latency_depth );
13141340 }
@@ -1869,8 +1895,10 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts,
18691895 if (ts -> latency_depth ) {
18701896 json_object_add_value_int (root , "latency_depth" , ts -> latency_depth );
18711897 json_object_add_value_int (root , "latency_target" , ts -> latency_target );
1898+ json_object_add_value_int (root , "latency_target_ns" , ts -> latency_target );
18721899 json_object_add_value_float (root , "latency_percentile" , ts -> latency_percentile .u .f );
18731900 json_object_add_value_int (root , "latency_window" , ts -> latency_window );
1901+ json_object_add_value_int (root , "latency_window_us" , ts -> latency_window );
18741902 }
18751903
18761904 /* Additional output if description is set */
0 commit comments