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

ETW Event for InitializeYieldProcessorNormalized #52177

Closed
wants to merge 1 commit into from

Conversation

brianrob
Copy link
Member

@brianrob brianrob commented May 3, 2021

Emit an ETW event containing the values computed by InitializeYieldProcessorNormalized when:

  1. InitializeYieldProcessorNormalized calculates its values.
  2. An ETW session is started that requests the values computed by InitializeYieldProcessorNormalized

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@@ -87,6 +87,8 @@
message="$(string.RuntimePublisher.TypeDiagnosticKeywordMessage)" symbol="CLR_TYPEDIAGNOSTIC_KEYWORD" />
<keyword name="JitInstrumentationDataKeyword" mask="0x10000000000"
message="$(string.RuntimePublisher.JitInstrumentationDataKeywordMessage)" symbol="CLR_JITINSTRUMENTEDDATA_KEYWORD" />
<keyword name="YieldProcessorNormalizedKeyword" mask="0x20000000000"
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't seem worth using a different keyword for this, can it go into the Threading keyword? The event may or may not be sent after relevant fixes are made.

@@ -1430,6 +1438,20 @@
</UserData>
</template>

<template tid="InitializeYieldProcessorNormalized">
<data name="YieldsPerNormalizedYield" inType="win:UInt32" />
<data name="OptimalMaxNormalizedYieldsPerSpinIteration" inType="win:UInt32" />
Copy link
Member

Choose a reason for hiding this comment

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

The values computed in .NET Framework are different. I suggest sending just the nsPerYield value as an 8-byte float, that is commonly measured in .NET Framework and .NET Core, and the rest of the values can be calculated from it.

@stephentoub
Copy link
Member

My understanding is we no longer have faith in the methodology employed by InitializeYieldProcessorNormalized. If that's true, shouldn't we be removing it / replacing it rather than adding an ETW event that tracks its result?

@brianrob
Copy link
Member Author

The general idea here is that we're not necessarily going to replace InitializeYieldProcessorNormalized everywhere, and so anywhere that we don't remove it, we should add this event. This allows us to use it as a canary when investigating performance issues that might be due to the values that were calculated here. Also until we do replace the implementation, this allows us to do the same thing in .NET 6 builds.

@stephentoub
Copy link
Member

so anywhere that we don't remove it, we should add this event

Does that mean we don't plan to remove it from .NET 6?

@brianrob
Copy link
Member Author

I do believe that we plan to replace this in .NET 6. I have not seen a timeline yet, and so my default path is to create a PR into main, and then backport. Totally fine to pull this out of .NET 6 when we replace the functionality, but until then, it's a useful event to have. Also, we'll want to make sure that we reserve the event ID in .NET 6 and beyond so that we don't overload the event ID in the future. So we will need at least some portion of this PR (the manifest change) to do that.

@stephentoub
Copy link
Member

What do we plan to do with the data if we're not going to use this approach in .NET 6+? If we really believe it's useful, I'm ok adding it. It just seems like it's going to be instant legacy, and I'm not clear what we're going to do with data we get from a backport.

@kouvel
Copy link
Member

kouvel commented Jul 7, 2021

An event is being added along with a fix in #55295

@kouvel kouvel closed this Jul 7, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 6, 2021
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.

4 participants