diff --git a/src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs b/src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs new file mode 100644 index 0000000000000000000000000000000000000000..ddc9797e5f2a81776c641fe390c3f0455772977a --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Kernel32 + { + // The actual native signature is: + // BOOL WINAPI QueryPerformanceCounter( + // _Out_ LARGE_INTEGER* lpPerformanceCount + // ); + // + // We take a long* (rather than a out long) to avoid the pinning overhead. + // We don't set last error since we don't need the extended error info. + + [DllImport(Libraries.Kernel32, ExactSpelling = true)] + internal static extern unsafe BOOL QueryPerformanceCounter(long* lpPerformanceCount); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs b/src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs new file mode 100644 index 0000000000000000000000000000000000000000..72a48ba208be644c14fd76dc2a6e5b58fcda619f --- /dev/null +++ b/src/libraries/System.Private.CoreLib/src/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Kernel32 + { + // The actual native signature is: + // BOOL WINAPI QueryPerformanceFrequency( + // _Out_ LARGE_INTEGER* lpFrequency + // ); + // + // We take a long* (rather than a out long) to avoid the pinning overhead. + // We don't set last error since we don't need the extended error info. + + [DllImport(Libraries.Kernel32, ExactSpelling = true)] + internal static extern unsafe BOOL QueryPerformanceFrequency(long* lpFrequency); + } +} diff --git a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems index 3cd36e0f275e0c1094809123725536eeb68a428b..3b56c77fd58c76013f8499efee47901314cd37c9 100644 --- a/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems +++ b/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems @@ -1027,6 +1027,8 @@ + +