@@ -52,9 +52,13 @@ let print_per_domain_stats oc =
5252 |> Array. combine domain_major_words);
5353 print_table oc ! data
5454
55- let print_percentiles json output hist =
55+ let print_percentiles json output hist outliers =
5656 let to_sec x = float_of_int x /. 1_000_000_000. in
5757 let ms ns = ns /. 1_000_000. in
58+ let outlier_mean_ms =
59+ if outliers.count = 0 then 0.
60+ else float_of_int outliers.total /. float_of_int outliers.count |> ms
61+ in
5862
5963 let mean_latency = H. mean hist |> ms
6064 and max_latency = float_of_int (H. max hist) |> ms in
@@ -155,10 +159,12 @@ let print_percentiles json output hist =
155159 Buffer. contents buf
156160 in
157161 Printf. fprintf oc
158- {| {" version" : 1 , " wall_time" : %. 2 f, " cpu_time" : %. 2 f, " gc_time" : %. 2 f, " gc_overhead" : %. 2 f, " max_rss_kb" : % d, " domain_stats" : {% s}, " mean_latency" : % f, " stddev_latency" : % f, " min_latency" : %. 2 f, " max_latency" : % f, " distr_latency" : {% s}, " allocations" : {" total_heap" : %. 0 f, " minor_heap" : %. 0 f, " major_heap" : %. 0 f, " promoted_words" : %. 0 f, " promoted_pct" : %. 2 f}, " domain_alloc_stats" : {% s}, " collections" : {" minor" : % i, " major" : % i, " forced_major" : % i, " compactions" : % i}}| }
162+ {| {" version" : 2 , " wall_time" : %. 2 f, " cpu_time" : %. 2 f, " gc_time" : %. 2 f, " gc_overhead" : %. 2 f, " max_rss_kb" : % d, " domain_stats" : {% s}, " mean_latency" : % f, " stddev_latency" : % f, " min_latency" : %. 2 f, " max_latency" : % f, " distr_latency" : {% s}, " outliers " : { " count " : % d, " mean_latency " : % f, " max_latency " : % f }, " allocations" : {" total_heap" : %. 0 f, " minor_heap" : %. 0 f, " major_heap" : %. 0 f, " promoted_words" : %. 0 f, " promoted_pct" : %. 2 f}, " domain_alloc_stats" : {% s}, " collections" : {" minor" : % i, " major" : % i, " forced_major" : % i, " compactions" : % i}}| }
159163 real_time ! total_cpu_time total_gc_time gc_overhead
160164 (Olly_common.Max_rss. max_rss_kb rss_collector)
161165 domain_stats mean_latency stddev_latency min_latency max_latency distribs
166+ outliers.count outlier_mean_ms
167+ (float_of_int outliers.max |> ms)
162168 total_heap ! minor_words ! major_words ! promoted_words promoted_pct
163169 domain_alloc_stats ! minor_collections ! major_collections
164170 ! forced_major_collections ! compactions
@@ -201,6 +207,13 @@ let print_percentiles json output hist =
201207 Fun. flip Array. iter percentiles (fun p ->
202208 Printf. fprintf oc " %.4f \t %.2f\n " p
203209 (float_of_int (H. value_at_percentile hist p) |> ms));
210+ if outliers.count > 0 then
211+ Printf. fprintf oc
212+ " #[Beyond histogram (> %.0f ms):\t %d events,\t mean (ms):\t %.2f,\t \
213+ max (ms):\t %.2f]\n "
214+ (float_of_int highest_trackable_value |> ms)
215+ outliers.count outlier_mean_ms
216+ (float_of_int outliers.max |> ms);
204217 Printf. fprintf oc " \n " ;
205218 print_global_allocation_stats oc;
206219 print_per_domain_stats oc;
@@ -213,9 +226,10 @@ let gc_stats poll_sleep json output runtime_events_dir runtime_events_log_wsize
213226 exec_args =
214227 let current_event = Hashtbl. create 13 in
215228 let hist =
216- H. init ~lowest_discernible_value: 10 ~highest_trackable_value: 10_000_000_000
229+ H. init ~lowest_discernible_value: 10 ~highest_trackable_value
217230 ~significant_figures: 3
218231 in
232+ let outliers = make_outliers () in
219233 let is_gc_phase phase =
220234 match phase with
221235 | Runtime_events. EV_MAJOR | Runtime_events. EV_STW_LEADER
@@ -252,7 +266,7 @@ let gc_stats poll_sleep json output runtime_events_dir runtime_events_log_wsize
252266 | Some (saved_phase , saved_ts ) when saved_phase = phase ->
253267 Hashtbl. remove current_event ring_id;
254268 let latency = Int64. to_int (Int64. sub (Ts. to_int64 ts) saved_ts) in
255- assert ( H. record_value hist latency) ;
269+ record_latency hist outliers latency;
256270 domain_gc_times.(ring_id) < - domain_gc_times.(ring_id) + latency
257271 | _ -> ()
258272 in
@@ -278,7 +292,7 @@ let gc_stats poll_sleep json output runtime_events_dir runtime_events_log_wsize
278292 in
279293
280294 let init = Fun. id in
281- let cleanup () = print_percentiles json output hist in
295+ let cleanup () = print_percentiles json output hist outliers in
282296 let on_poll = Olly_common.Max_rss. sample rss_collector in
283297 let open Olly_common.Launch in
284298 try
0 commit comments