-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Implement JitInfo API #55046
Implement JitInfo API #55046
Conversation
* add per thread privately * add test for counter * add test for priuvate metric (currently failing due to linker I think)
Tagging subscribers to this area: @dotnet/area-system-runtime Issue DetailsImplements #54444 TODO:
Putting this up in draft form for some early feedback. CC @tommcdon @benmwatson @lateralusX
|
* Fix mono build by adding mono partial class to csproj * PR feedback * no interlocked* for thread_local * use CLR_BOOL * use LARGE_INTEGER and only static_cast once * correct ticks calculation * convert Stopwatch methods to internal * use same conversion as S.D.Stopwatch
src/libraries/System.Private.CoreLib/src/System/Runtime/JitInfo.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/JitInfo.CoreCLR.cs
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/JitInfo.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Runtime/JitInfo.cs
Outdated
Show resolved
Hide resolved
src/coreclr/System.Private.CoreLib/src/System/Runtime/JitInfo.CoreCLR.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Runtime/JitInfo.cs
Outdated
Show resolved
Hide resolved
* normalize ticks to 100ns in native code * add NormalizedTimer class * added source ref * change ret value to long
* use double for frequency in case clock resolution is larger than 100ns
* test was attempting to parse ints when the interval can be a double
* skip on aot platforms * add current thread test for coreclr
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.
Made a few suggestions on the tests, but overall lgtm!
I take it you have looked at some generated numbers manually to confirm the results look reasonable?
src/libraries/System.Runtime/tests/System/Runtime/JitInfoTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System/Runtime/JitInfoTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System/Runtime/JitInfoTests.cs
Outdated
Show resolved
Hide resolved
* Removed Volatile<T> from globals since they are all accessed either via InterlockedExchange or VolatileLoad * Added no tearing helper function for 32 bit systems * updated tests to compare before and after * added tests for AOT and Mono specific behaviors * furether simplified NormalizedTimer class with asserts
Does anyone know a way to detect whether a test is being run under the Mono interpreter? If not, I'm going to modify the Mono flavor of the test to accept 0 and (after-before)==0. |
|
src/libraries/System.Runtime/tests/System/Runtime/JitInfoTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Runtime/tests/System/Runtime/JitInfoTests.cs
Outdated
Show resolved
Hide resolved
* use ref emit dynamic method * adds IsNotMonoAot platform detection
Barring any CI failures, I'm hoping to merge this later today. |
Remaining failure seems to be #55536. |
/azp run runtime |
Azure Pipelines successfully started running 1 pipeline(s). |
I have a successful CI run; I'm intending to merge this PR this morning. |
Implements #54444
This PR adds the
System.Runtime.JitInfo
static class and static methods. These are used for collecting information about the Just In Time compiler. As implemented, the API allows you retrieve:Some side-effects to this patch:
NormalizedTimer
class to the CoreCLR utils for collecting time differences in 100ns ticks (the same ticks used byTimeSpan.FromTicks()
). This should help avoid discrepancies in tick definitions between managed and native code.CC @tommcdon @benmwatson @lateralusX