Skip to content
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

Try to ensure measureme output is valid when the interpreter is interrupted #2899

Merged
merged 1 commit into from
May 21, 2023

Conversation

saethlin
Copy link
Member

Dropping our measureme::Profiler will have the profiler flush its output buffer and write out its string table. If the profiler's Drop impl does not run, the output file is not usable.

This approach has zero runtime overhead.

// immediately. In our interpreter loop we try to consult this value often, but if for
// whatever reason we don't get to that check or the cleanup we do upon finding that
// this bool has become true takes a long time, the exit here will promptly exit the
// process.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// process.
// process on the 2nd Ctrl-C.

That's assuming I understood the code correctly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup.


/// Called when the interpreter is going to shut down abnormally, such as due to a ctrl+c.
pub(crate) fn handle_abnormal_termination(&mut self) {
drop(self.profiler.take());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to have a comment explaining why this is important.

@RalfJung
Copy link
Member

r=me after squashing

@saethlin
Copy link
Member Author

@bors r=RalfJung

@bors
Copy link
Collaborator

bors commented May 21, 2023

📌 Commit e0080bf has been approved by RalfJung

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented May 21, 2023

⌛ Testing commit e0080bf with merge d4dfbea...

@bors
Copy link
Collaborator

bors commented May 21, 2023

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing d4dfbea to master...

@bors bors merged commit d4dfbea into rust-lang:master May 21, 2023
@bors bors mentioned this pull request May 21, 2023
@saethlin saethlin deleted the measureme-cleanup branch September 24, 2023 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants