]>
Commit | Line | Data |
---|---|---|
fb3df220 | 1 | /** @file\r |
50a64e5b | 2 | Provides calibrated delay and performance counter services.\r |
fb3df220 | 3 | \r |
b9610b9c | 4 | Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r |
9df063a0 | 5 | This program and the accompanying materials\r |
50a64e5b | 6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
fb3df220 | 9 | \r |
50a64e5b | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
fb3df220 | 12 | \r |
fb3df220 | 13 | **/\r |
14 | \r | |
15 | #ifndef __TIMER_LIB__\r | |
16 | #define __TIMER_LIB__\r | |
17 | \r | |
18 | /**\r | |
71871514 | 19 | Stalls the CPU for at least the given number of microseconds.\r |
20 | \r | |
fb3df220 | 21 | Stalls the CPU for the number of microseconds specified by MicroSeconds.\r |
22 | \r | |
23 | @param MicroSeconds The minimum number of microseconds to delay.\r | |
24 | \r | |
8cefc2ee | 25 | @return The value of MicroSeconds inputted.\r |
fb3df220 | 26 | \r |
27 | **/\r | |
28 | UINTN\r | |
29 | EFIAPI\r | |
30 | MicroSecondDelay (\r | |
31 | IN UINTN MicroSeconds\r | |
32 | );\r | |
33 | \r | |
34 | /**\r | |
71871514 | 35 | Stalls the CPU for at least the given number of nanoseconds.\r |
36 | \r | |
fb3df220 | 37 | Stalls the CPU for the number of nanoseconds specified by NanoSeconds.\r |
38 | \r | |
39 | @param NanoSeconds The minimum number of nanoseconds to delay.\r | |
40 | \r | |
8cefc2ee | 41 | @return The value of NanoSeconds inputted.\r |
fb3df220 | 42 | \r |
43 | **/\r | |
44 | UINTN\r | |
45 | EFIAPI\r | |
46 | NanoSecondDelay (\r | |
47 | IN UINTN NanoSeconds\r | |
48 | );\r | |
49 | \r | |
50 | /**\r | |
71871514 | 51 | Retrieves the current value of a 64-bit free running performance counter.\r |
52 | \r | |
2c8547ab | 53 | The counter can either count up by 1 or count down by 1. If the physical\r |
fb3df220 | 54 | performance counter counts by a larger increment, then the counter values\r |
55 | must be translated. The properties of the counter can be retrieved from\r | |
56 | GetPerformanceCounterProperties().\r | |
57 | \r | |
58 | @return The current value of the free running performance counter.\r | |
59 | \r | |
60 | **/\r | |
61 | UINT64\r | |
62 | EFIAPI\r | |
63 | GetPerformanceCounter (\r | |
64 | VOID\r | |
65 | );\r | |
66 | \r | |
67 | /**\r | |
68 | Retrieves the 64-bit frequency in Hz and the range of performance counter\r | |
69 | values.\r | |
70 | \r | |
71 | If StartValue is not NULL, then the value that the performance counter starts\r | |
72 | with immediately after is it rolls over is returned in StartValue. If\r | |
73 | EndValue is not NULL, then the value that the performance counter end with\r | |
74 | immediately before it rolls over is returned in EndValue. The 64-bit\r | |
75 | frequency of the performance counter in Hz is always returned. If StartValue\r | |
76 | is less than EndValue, then the performance counter counts up. If StartValue\r | |
77 | is greater than EndValue, then the performance counter counts down. For\r | |
78 | example, a 64-bit free running counter that counts up would have a StartValue\r | |
79 | of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter\r | |
80 | that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.\r | |
81 | \r | |
82 | @param StartValue The value the performance counter starts with when it\r | |
83 | rolls over.\r | |
84 | @param EndValue The value that the performance counter ends with before\r | |
85 | it rolls over.\r | |
86 | \r | |
87 | @return The frequency in Hz.\r | |
88 | \r | |
89 | **/\r | |
90 | UINT64\r | |
91 | EFIAPI\r | |
92 | GetPerformanceCounterProperties (\r | |
93 | OUT UINT64 *StartValue, OPTIONAL\r | |
94 | OUT UINT64 *EndValue OPTIONAL\r | |
95 | );\r | |
96 | \r | |
b9610b9c | 97 | /**\r |
98 | Converts elapsed ticks of performance counter to time in nanoseconds.\r | |
99 | \r | |
100 | This function converts the elapsed ticks of running performance counter to\r | |
101 | time value in unit of nanoseconds.\r | |
102 | \r | |
103 | @param Ticks The number of elapsed ticks of running performance counter.\r | |
104 | \r | |
105 | @return The elapsed time in nanoseconds.\r | |
106 | \r | |
107 | **/\r | |
108 | UINT64\r | |
109 | EFIAPI\r | |
110 | GetTimeInNanoSecond (\r | |
111 | IN UINT64 Ticks\r | |
112 | );\r | |
113 | \r | |
fb3df220 | 114 | #endif\r |