Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion lib/olly_common/launch.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
let lost_event_count = ref 0
let update_lost_event_count num = lost_event_count := !lost_event_count + num

let lost_events ring_id num =
update_lost_event_count num;
Printf.eprintf "[ring_id=%d] Lost %d events\n%!" ring_id num

let print_warning_if_lost_events =
fun () ->
if !lost_event_count <> 0 then
Printf.eprintf
"\n\
Warning: Results may be inaccurate since some runtime events were lost \
before they could be read.\n\
Refer to 'Missed events' section in repo README\n\n\
%!"

type subprocess = {
alive : unit -> bool;
cursor : Runtime_events.cursor;
Expand Down Expand Up @@ -138,8 +152,12 @@ let empty_config =
}

let olly config (exec_args : exec_config) =
let cleanup () =
config.cleanup ();
print_warning_if_lost_events ()
in
config.init ();
Fun.protect ~finally:config.cleanup (fun () ->
Fun.protect ~finally:cleanup (fun () ->
let runtime_config =
{
dir = config.runtime_events_dir;
Expand Down
Loading