Moving StopWatch to `src\Common\src\Corelib` (dotnet/corefx#42072)
[mono-project.git] / netcore / System.Private.CoreLib / shared / System / Diagnostics / Stopwatch.Windows.cs
blob20f5656cbf14f091e08676c4fb53272b3eba4ba8
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 namespace System.Diagnostics
7 public partial class Stopwatch
9 private static unsafe long QueryPerformanceFrequency()
11 long resolution;
13 Interop.BOOL result = Interop.Kernel32.QueryPerformanceFrequency(&resolution);
14 // The P/Invoke is documented to never fail on Windows XP or later
15 Debug.Assert(result != Interop.BOOL.FALSE);
17 return resolution;
20 private static unsafe long QueryPerformanceCounter()
22 long timestamp;
24 Interop.BOOL result = Interop.Kernel32.QueryPerformanceCounter(&timestamp);
25 // The P/Invoke is documented to never fail on Windows XP or later
26 Debug.Assert(result != Interop.BOOL.FALSE);
28 return timestamp;