-
Notifications
You must be signed in to change notification settings - Fork 103
Snapshot using perf ctlfd #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
06c7943
to
3011cd4
Compare
Signed-off-by: Ilana Brooks <[email protected]>
3011cd4
to
a66e21b
Compare
@@ -0,0 +1,80 @@ | |||
open Core |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open Core | |
open! Core |
|
||
let close_perf_side_fds t = | ||
Core_unix.close ~restart:true t.ctl_rx; | ||
t.ctl_rx <- Core_unix.File_descr.of_int (-1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: let's make these option
s.
if should_take_snapshot | ||
then ( | ||
match t.snapshot_behavior with | ||
| Never -> failwith "unreachable" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: lift this block into a let snapshot () = ...
, then have the -> (true|false)
branches above be -> (() | snapshot ())
. That way we don't have to double-state the Never
case.
(String.equal | ||
ack_msg | ||
(Bytes.unsafe_to_string ~no_mutation_while_string_reachable:t.ack_buf)) | ||
then failwith "Receive malformed ack from perf"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be very hard to debug if it ever raises. Let's turn this into a raise_s
and include the ack we did get.
else ( | ||
match when_to_snapshot with | ||
| Magic_trace_or_the_application_terminates -> | ||
if perf_supports_snapshot_on_exit then `at_exit `sigint else `at_exit `sigusr2 | ||
| Application_calls_a_function _ -> `function_call) | ||
if perf_supports_snapshot_on_exit then At_exit Sigint else At_exit Sigusr2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the ctrlfd here too?
This logic is also used for triggering on ^C; it'd be nice to get away from the buggy signal handling where we can.
No description provided.