Add tracing spans to borrow tracker functions #4452
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I should have added tracing spans to all relevant functions in
borrow_tracker/mod.rs
. So e.g. I skipped simple constructors (e.g.new_ptr
) and debugging stuff (give_pointer_debug_name
andprint_borrow_state
). I didn't go deeper into the tree/stacked subfolders, as it seems like all calls to the borrow checkers pass throughborrow_tracker/mod.rs
(let me know if I'm wrong on this, or if you need some more specific statistics about the functions in the checkers implementations).Here are two traces for
./tests/pass/hello.rs
(the latter was obtained with-Zmiri-tree-borrows
). The tracing spans still only account for ~40% of the total time, so I will have to investigate where the rest of the time is spent. trace-stacked-borrows.zip trace-tree-borrows.zipThis PR also adds an alternative
enter_trace_span!
that does not depend on the Machine trait (unlikerustc_const_eval::enter_trace_span!
) and that instead relies on#[cfg(feature = "tracing")]
. I can open a separate PR just with that commit if that's preferred.