-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Implement JitInfo API #55046
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
josalem
merged 22 commits into
dotnet:main
from
josalem:dev/josalem/per-thread-jit-metrics
Jul 14, 2021
Merged
Implement JitInfo API #55046
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
264a74f
Add JIT time metric
8c2ef38
implement coreclr side
e63ed01
implement mono side
06633f6
Merge branch 'main' into dev/josalem/per-thread-jit-metrics
38459be
fix merge error breaking build
85bfac9
PR feedback
0e16d4a
Feedback and build fix
064fd0c
PR feedback + adding ref source
780d8a9
* use constructor instead of intiializer
1471a64
fix helper function visibility
0dd2832
Fix test failure
a7aa30a
Improve test:
5df31df
Further test improvements
450296c
Fix mismatched variable sizes:
ca806ad
* Simplify NormalizedTimer
dcfdfb7
PR feedback
61f90db
Fix typo in mono icalls
39e8859
fix typo
3546750
remove unneeded cast
108d64d
Force interpretation of T as int64_t on x86
6ff8b30
update test to special case interpreter
45d846b
Update tests based on PR feedback
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/coreclr/System.Private.CoreLib/src/System/Runtime/JitInfo.CoreCLR.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using Internal.Runtime.CompilerServices; | ||
|
||
namespace System.Runtime | ||
{ | ||
public static partial class JitInfo | ||
{ | ||
/// <summary> | ||
/// Get the number of bytes of IL that have been compiled. If <paramref name="currentThread"/> is true, | ||
/// then this value is scoped to the current thread, otherwise, this is a global value. | ||
/// </summary> | ||
/// <param name="currentThread">Whether the returned value should be specific to the current thread. Default: false</param> | ||
/// <returns>The number of bytes of IL the JIT has compiled.</returns> | ||
[MethodImpl(MethodImplOptions.InternalCall)] | ||
public static extern long GetCompiledILBytes(bool currentThread = false); | ||
|
||
/// <summary> | ||
/// Get the number of methods that have been compiled. If <paramref name="currentThread"/> is true, | ||
/// then this value is scoped to the current thread, otherwise, this is a global value. | ||
/// </summary> | ||
/// <param name="currentThread">Whether the returned value should be specific to the current thread. Default: false</param> | ||
/// <returns>The number of methods the JIT has compiled.</returns> | ||
[MethodImpl(MethodImplOptions.InternalCall)] | ||
public static extern long GetCompiledMethodCount(bool currentThread = false); | ||
|
||
// Normalized to 100ns ticks on vm side | ||
[MethodImpl(MethodImplOptions.InternalCall)] | ||
private static extern long GetCompilationTimeInTicks(bool currentThread = false); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/libraries/System.Private.CoreLib/src/System/Runtime/JitInfo.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Runtime | ||
{ | ||
/// <summary> | ||
/// A static class for getting information about the Just In Time compiler. | ||
/// </summary> | ||
public static partial class JitInfo | ||
{ | ||
/// <summary> | ||
/// Get the amount of time the JIT Compiler has spent compiling methods. If <paramref name="currentThread"/> is true, | ||
/// then this value is scoped to the current thread, otherwise, this is a global value. | ||
/// </summary> | ||
/// <param name="currentThread">Whether the returned value should be specific to the current thread. Default: false</param> | ||
/// <returns>The amount of time the JIT Compiler has spent compiling methods.</returns> | ||
public static TimeSpan GetCompilationTime(bool currentThread = false) | ||
{ | ||
// TimeSpan.FromTicks() takes 100ns ticks | ||
return TimeSpan.FromTicks(GetCompilationTimeInTicks(currentThread)); | ||
josalem marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.