Merge pull request #3386 from alexanderkyte/nunit_lite_return_status
[mono.git] / mcs / class / referencesource / System.Web / Util / counter.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="counter.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>                                                                
5 //------------------------------------------------------------------------------
6
7 namespace System.Web.Util {
8     using System;
9     using System.Web;
10     using System.Runtime.InteropServices;
11
12
13     /// <devdoc>
14     ///    <para>Provides access to system timers.</para>
15     /// </devdoc>
16     internal sealed class Counter {           
17
18         /// <devdoc>
19         ///     not creatable
20         /// </devdoc>
21         private Counter() {
22         }
23
24
25         /// <devdoc>
26         ///    Gets the current system counter value.
27         /// </devdoc>
28         internal static long Value {
29             get {
30                 long count = 0;
31                 SafeNativeMethods.QueryPerformanceCounter(ref count);
32                 return count;
33             }
34         }
35
36
37         /// <devdoc>
38         ///    Gets the frequency of the system counter in counts per second.
39         /// </devdoc>
40         internal static long Frequency {
41             get {
42                 long freq = 0;
43                 SafeNativeMethods.QueryPerformanceFrequency(ref freq);
44                 return freq;
45             }
46         }
47     }
48 }