Skip to content

Revise perfjitdump #229

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

Merged
merged 6 commits into from
Nov 26, 2019
Merged

Revise perfjitdump #229

merged 6 commits into from
Nov 26, 2019

Conversation

sdmaclea
Copy link
Contributor

@sdmaclea sdmaclea commented Nov 22, 2019

Remove unnecessary fsync() call
Use writev() instead of write() to reduce OS calls
Handle partial write cases

Fixes dotnet/coreclr#27912 (aka #13812)

Remove unnecessary fsync() call
Use writev() instead of write() to reduce OS calls
Handle partial write cases
@sdmaclea sdmaclea added this to the 5.0 milestone Nov 22, 2019
@sdmaclea sdmaclea self-assigned this Nov 22, 2019
@sdmaclea sdmaclea added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Nov 22, 2019
Use initializer list
Fix unexpected failure handling
Fix typo
Simplify logic
@sdmaclea
Copy link
Contributor Author

Thanks @lpereira

Rename item/items
Use _ASSERTE
Increment codeIndex while locked
Fix copy/paste error
Mark enabled volatile
Add codeIndex comment with respect to locking
@sdmaclea sdmaclea removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Nov 25, 2019
Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@@ -136,7 +136,7 @@ struct PerfJitDumpState
codeIndex(0)
{}

bool enabled;
volatile bool enabled;
Copy link
Contributor

Choose a reason for hiding this comment

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

Use of volatile in C++ always make me uneasy that it's actually hiding something else. I haven't read the code for PerfJitDumpState yet, but what's the reason to qualify enabled as volatile here?

Copy link
Contributor Author

@sdmaclea sdmaclea Nov 25, 2019

Choose a reason for hiding this comment

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

It is a variable that is expected to be written by another thread during Finish.

Before we lock the mutex, we read enabled. After locking I want to make sure enabled is read again in case Finish disabled it. I marked it as volatile to prevent the optimizer from using the value it had initially read. Given that the locking is a function call it might not be needed, but I don't fully understand the nuances of the C++ optimization rules.

@sdmaclea sdmaclea merged commit c50eae5 into dotnet:master Nov 26, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants