]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c
Initial import.
[mirror_edk2.git] / MdePkg / Library / BasePerformanceLibNull / PerformanceLib.c
CommitLineData
878ddf1f 1/** @file\r
2 Base Performance Library which provides no service.\r
3\r
4 Copyright (c) 2006, Intel Corporation<BR>\r
5 All rights reserved. This program and the accompanying materials\r
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
9\r
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
12\r
13 Module Name: PerformanceLib.c\r
14\r
15**/\r
16\r
17/**\r
18 Creates a record for the beginning of a performance measurement. \r
19 \r
20 Creates a record that contains the Handle, Token, and Module.\r
21 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.\r
22 If TimeStamp is zero, then this function reads the current time stamp\r
23 and adds that time stamp value to the record as the start time.\r
24\r
25 @param Handle Pointer to environment specific context used\r
26 to identify the component being measured.\r
27 @param Token Pointer to a Null-terminated ASCII string\r
28 that identifies the component being measured.\r
29 @param Module Pointer to a Null-terminated ASCII string\r
30 that identifies the module being measured.\r
31 @param TimeStamp 64-bit time stamp.\r
32\r
33 @retval RETURN_SUCCESS The start of the measurement was recorded.\r
34 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
35\r
36**/\r
37RETURN_STATUS\r
38EFIAPI\r
39StartPerformanceMeasurement (\r
40 IN CONST VOID *Handle, OPTIONAL\r
41 IN CONST CHAR8 *Token,\r
42 IN CONST CHAR8 *Module,\r
43 IN UINT64 TimeStamp\r
44 )\r
45{\r
46 return RETURN_SUCCESS;\r
47}\r
48\r
49/**\r
50 Fills in the end time of a performance measurement. \r
51 \r
52 Looks up the record that matches Handle, Token, and Module.\r
53 If the record can not be found then return RETURN_NOT_FOUND.\r
54 If the record is found and TimeStamp is not zero,\r
55 then TimeStamp is added to the record as the end time.\r
56 If the record is found and TimeStamp is zero, then this function reads\r
57 the current time stamp and adds that time stamp value to the record as the end time.\r
58 If this function is called multiple times for the same record, then the end time is overwritten.\r
59\r
60 @param Handle Pointer to environment specific context used\r
61 to identify the component being measured.\r
62 @param Token Pointer to a Null-terminated ASCII string\r
63 that identifies the component being measured.\r
64 @param Module Pointer to a Null-terminated ASCII string\r
65 that identifies the module being measured.\r
66 @param TimeStamp 64-bit time stamp.\r
67\r
68 @retval RETURN_SUCCESS The end of the measurement was recorded.\r
69 @retval RETURN_NOT_FOUND The specified measurement record could not be found.\r
70\r
71**/\r
72RETURN_STATUS\r
73EFIAPI\r
74EndPerformanceMeasurement (\r
75 IN CONST VOID *Handle, OPTIONAL\r
76 IN CONST CHAR8 *Token,\r
77 IN CONST CHAR8 *Module,\r
78 IN UINT64 TimeStamp\r
79 )\r
80{\r
81 return RETURN_SUCCESS;\r
82}\r
83\r
84/**\r
85 Retrieves a previously logged performance measurement. \r
86 \r
87 Retrieves the performance log entry from the performance log\r
88 that immediately follows the log entry specified by LogEntryKey.\r
89 If LogEntryKey is zero, then the first entry from the performance log is returned.\r
90 If the log entry specified by LogEntryKey is the last entry in the performance log,\r
91 then 0 is returned. Otherwise, the performance log entry is returned in Handle,\r
92 Token, Module, StartTimeStamp, and EndTimeStamp.\r
93 The key for the current performance log entry is returned. \r
94\r
95 @param LogEntryKey The key for the previous performance measurement log entry.\r
96 If 0, then the first performance measurement log entry is retrieved.\r
97 @param Handle Pointer to environment specific context used\r
98 to identify the component being measured.\r
99 @param Token Pointer to a Null-terminated ASCII string\r
100 that identifies the component being measured.\r
101 @param Module Pointer to a Null-terminated ASCII string\r
102 that identifies the module being measured.\r
103 @param StartTimeStamp The 64-bit time stamp that was recorded when the measurement was started.\r
104 @param EndTimeStamp The 64-bit time stamp that was recorded when the measurement was ended.\r
105\r
106 @return The key for the current performance log entry.\r
107\r
108**/\r
109UINTN\r
110EFIAPI\r
111GetPerformanceMeasurement (\r
112 UINTN LogEntryKey, \r
113 OUT CONST VOID **Handle,\r
114 OUT CONST CHAR8 **Token,\r
115 OUT CONST CHAR8 **Module,\r
116 OUT UINT64 *StartTimeStamp,\r
117 OUT UINT64 *EndTimeStamp\r
118 )\r
119{\r
120 ASSERT (Handle != NULL);\r
121 ASSERT (Token != NULL);\r
122 ASSERT (Module != NULL);\r
123 ASSERT (StartTimeStamp != NULL);\r
124 ASSERT (EndTimeStamp != NULL);\r
125\r
126 return 0;\r
127}\r
128\r
129/**\r
130 Returns TRUE if the performance measurement macros are enabled. \r
131 \r
132 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of\r
133 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.\r
134\r
135 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of\r
136 PcdPerformanceLibraryPropertyMask is set.\r
137 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of\r
138 PcdPerformanceLibraryPropertyMask is clear.\r
139\r
140**/\r
141BOOLEAN\r
142EFIAPI\r
143PerformanceMeasurementEnabled (\r
144 VOID\r
145 )\r
146{\r
147 return ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);\r
148}\r