-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
John Salem
authored
Jul 14, 2021
1 parent
d86a382
commit 21a7632
Showing
24 changed files
with
464 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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)); | ||
} | ||
} | ||
} |
This file contains 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 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.