]>
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 |
9344f092 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
fb3df220 | 6 | \r |
fb3df220 | 7 | **/\r |
8 | \r | |
9 | #ifndef __TIMER_LIB__\r | |
10 | #define __TIMER_LIB__\r | |
11 | \r | |
12 | /**\r | |
71871514 | 13 | Stalls the CPU for at least the given number of microseconds.\r |
14 | \r | |
fb3df220 | 15 | Stalls the CPU for the number of microseconds specified by MicroSeconds.\r |
16 | \r | |
17 | @param MicroSeconds The minimum number of microseconds to delay.\r | |
18 | \r | |
8cefc2ee | 19 | @return The value of MicroSeconds inputted.\r |
fb3df220 | 20 | \r |
21 | **/\r | |
22 | UINTN\r | |
23 | EFIAPI\r | |
24 | MicroSecondDelay (\r | |
25 | IN UINTN MicroSeconds\r | |
26 | );\r | |
27 | \r | |
28 | /**\r | |
71871514 | 29 | Stalls the CPU for at least the given number of nanoseconds.\r |
30 | \r | |
fb3df220 | 31 | Stalls the CPU for the number of nanoseconds specified by NanoSeconds.\r |
32 | \r | |
33 | @param NanoSeconds The minimum number of nanoseconds to delay.\r | |
34 | \r | |
8cefc2ee | 35 | @return The value of NanoSeconds inputted.\r |
fb3df220 | 36 | \r |
37 | **/\r | |
38 | UINTN\r | |
39 | EFIAPI\r | |
40 | NanoSecondDelay (\r | |
41 | IN UINTN NanoSeconds\r | |
42 | );\r | |
43 | \r | |
44 | /**\r | |
71871514 | 45 | Retrieves the current value of a 64-bit free running performance counter.\r |
46 | \r | |
2c8547ab | 47 | The counter can either count up by 1 or count down by 1. If the physical\r |
fb3df220 | 48 | performance counter counts by a larger increment, then the counter values\r |
49 | must be translated. The properties of the counter can be retrieved from\r | |
50 | GetPerformanceCounterProperties().\r | |
51 | \r | |
52 | @return The current value of the free running performance counter.\r | |
53 | \r | |
54 | **/\r | |
55 | UINT64\r | |
56 | EFIAPI\r | |
57 | GetPerformanceCounter (\r | |
58 | VOID\r | |
59 | );\r | |
60 | \r | |
61 | /**\r | |
62 | Retrieves the 64-bit frequency in Hz and the range of performance counter\r | |
63 | values.\r | |
64 | \r | |
65 | If StartValue is not NULL, then the value that the performance counter starts\r | |
66 | with immediately after is it rolls over is returned in StartValue. If\r | |
67 | EndValue is not NULL, then the value that the performance counter end with\r | |
68 | immediately before it rolls over is returned in EndValue. The 64-bit\r | |
69 | frequency of the performance counter in Hz is always returned. If StartValue\r | |
70 | is less than EndValue, then the performance counter counts up. If StartValue\r | |
71 | is greater than EndValue, then the performance counter counts down. For\r | |
72 | example, a 64-bit free running counter that counts up would have a StartValue\r | |
73 | of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter\r | |
74 | that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.\r | |
75 | \r | |
76 | @param StartValue The value the performance counter starts with when it\r | |
77 | rolls over.\r | |
78 | @param EndValue The value that the performance counter ends with before\r | |
79 | it rolls over.\r | |
80 | \r | |
81 | @return The frequency in Hz.\r | |
82 | \r | |
83 | **/\r | |
84 | UINT64\r | |
85 | EFIAPI\r | |
86 | GetPerformanceCounterProperties (\r | |
87 | OUT UINT64 *StartValue, OPTIONAL\r | |
88 | OUT UINT64 *EndValue OPTIONAL\r | |
89 | );\r | |
90 | \r | |
b9610b9c | 91 | /**\r |
92 | Converts elapsed ticks of performance counter to time in nanoseconds.\r | |
93 | \r | |
94 | This function converts the elapsed ticks of running performance counter to\r | |
95 | time value in unit of nanoseconds.\r | |
96 | \r | |
97 | @param Ticks The number of elapsed ticks of running performance counter.\r | |
98 | \r | |
99 | @return The elapsed time in nanoseconds.\r | |
100 | \r | |
101 | **/\r | |
102 | UINT64\r | |
103 | EFIAPI\r | |
104 | GetTimeInNanoSecond (\r | |
105 | IN UINT64 Ticks\r | |
106 | );\r | |
107 | \r | |
fb3df220 | 108 | #endif\r |