]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
Add new extension PerformanceLib APIs to store ID info.
[mirror_edk2.git] / MdeModulePkg / Library / PeiPerformanceLib / PeiPerformanceLib.c
CommitLineData
8dbae30d 1/** @file\r
857dfc45 2 Performance library instance used in PEI phase.\r
3\r
4 This file implements all APIs in Performance Library class in MdePkg. It creates\r
5 performance logging GUIDed HOB on the first performance logging and then logs the\r
6 performance data to the GUIDed HOB. Due to the limitation of temporary RAM, the maximum\r
7 number of performance logging entry is specified by PcdMaxPeiPerformanceLogEntries. \r
a0afd019 8\r
3dffec12 9Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
cd5ebaa0 10This program and the accompanying materials\r
a0afd019 11are licensed and made available under the terms and conditions of the BSD License\r
12which accompanies this distribution. The full text of the license may be found at\r
13http://opensource.org/licenses/bsd-license.php\r
14\r
15THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
16WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17\r
8dbae30d 18**/\r
a0afd019 19\r
ed7748fe 20\r
a0afd019 21#include <PiPei.h>\r
ed7748fe 22\r
ee0961f7 23#include <Guid/Performance.h>\r
ed7748fe 24\r
a0afd019 25#include <Library/PerformanceLib.h>\r
26#include <Library/DebugLib.h>\r
27#include <Library/HobLib.h>\r
28#include <Library/BaseLib.h>\r
29#include <Library/TimerLib.h>\r
30#include <Library/PcdLib.h>\r
31#include <Library/BaseMemoryLib.h>\r
32\r
33\r
34/**\r
f0da4d7d 35 Gets the GUID HOB for PEI performance.\r
a0afd019 36\r
37 This internal function searches for the GUID HOB for PEI performance.\r
38 If that GUID HOB is not found, it will build a new one.\r
f0da4d7d 39 It outputs the data area of that GUID HOB to record performance log.\r
a0afd019 40\r
f0da4d7d
SZ
41 @param PeiPerformanceLog Pointer to Pointer to PEI performance log header.\r
42 @param PeiPerformanceIdArray Pointer to Pointer to PEI performance identifier array.\r
a0afd019 43\r
44**/\r
f0da4d7d 45VOID\r
a0afd019 46InternalGetPerformanceHobLog (\r
f0da4d7d
SZ
47 OUT PEI_PERFORMANCE_LOG_HEADER **PeiPerformanceLog,\r
48 OUT UINT32 **PeiPerformanceIdArray\r
a0afd019 49 )\r
50{\r
51 EFI_HOB_GUID_TYPE *GuidHob;\r
f0da4d7d
SZ
52 UINTN PeiPerformanceSize;\r
53\r
54 ASSERT (PeiPerformanceLog != NULL);\r
55 ASSERT (PeiPerformanceIdArray != NULL);\r
a0afd019 56\r
ee0961f7 57 GuidHob = GetFirstGuidHob (&gPerformanceProtocolGuid);\r
a0afd019 58\r
59 if (GuidHob != NULL) {\r
60 //\r
61 // PEI Performance HOB was found, then return the existing one.\r
62 //\r
f0da4d7d
SZ
63 *PeiPerformanceLog = GET_GUID_HOB_DATA (GuidHob);\r
64\r
65 GuidHob = GetFirstGuidHob (&gPerformanceExProtocolGuid);\r
66 ASSERT (GuidHob != NULL);\r
67 *PeiPerformanceIdArray = GET_GUID_HOB_DATA (GuidHob);\r
a0afd019 68 } else {\r
69 //\r
70 // PEI Performance HOB was not found, then build one.\r
71 //\r
f0da4d7d
SZ
72 PeiPerformanceSize = sizeof (PEI_PERFORMANCE_LOG_HEADER) +\r
73 sizeof (PEI_PERFORMANCE_LOG_ENTRY) * PcdGet8 (PcdMaxPeiPerformanceLogEntries);\r
74 *PeiPerformanceLog = BuildGuidHob (&gPerformanceProtocolGuid, PeiPerformanceSize);\r
75 *PeiPerformanceLog = ZeroMem (*PeiPerformanceLog, PeiPerformanceSize);\r
76\r
77 PeiPerformanceSize = sizeof (UINT32) * PcdGet8 (PcdMaxPeiPerformanceLogEntries);\r
78 *PeiPerformanceIdArray = BuildGuidHob (&gPerformanceExProtocolGuid, PeiPerformanceSize);\r
79 *PeiPerformanceIdArray = ZeroMem (*PeiPerformanceIdArray, PeiPerformanceSize);\r
a0afd019 80 }\r
a0afd019 81}\r
82\r
83/**\r
f0da4d7d 84 Searches in the log array with keyword Handle, Token, Module and Identifier.\r
a0afd019 85\r
86 This internal function searches for the log entry in the log array.\r
f0da4d7d 87 If there is an entry that exactly matches the given keywords\r
a0afd019 88 and its end time stamp is zero, then the index of that log entry is returned;\r
89 otherwise, the the number of log entries in the array is returned.\r
90\r
74935bd7 91 @param PeiPerformanceLog Pointer to the data structure containing PEI \r
92 performance data.\r
a0afd019 93 @param Handle Pointer to environment specific context used\r
94 to identify the component being measured.\r
95 @param Token Pointer to a Null-terminated ASCII string\r
96 that identifies the component being measured.\r
97 @param Module Pointer to a Null-terminated ASCII string\r
98 that identifies the module being measured.\r
f0da4d7d 99 @param Identifier 32-bit identifier.\r
a0afd019 100\r
101 @retval The index of log entry in the array.\r
102\r
103**/\r
a0afd019 104UINT32\r
105InternalSearchForLogEntry (\r
106 IN PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog,\r
f0da4d7d 107 IN UINT32 *PeiPerformanceIdArray,\r
a0afd019 108 IN CONST VOID *Handle, OPTIONAL\r
109 IN CONST CHAR8 *Token, OPTIONAL\r
f0da4d7d
SZ
110 IN CONST CHAR8 *Module, OPTIONAL\r
111 IN UINT32 Identifier\r
a0afd019 112 )\r
113{\r
114 UINT32 Index;\r
115 UINT32 NumberOfEntries;\r
116 PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;\r
117\r
118\r
119 if (Token == NULL) {\r
120 Token = "";\r
121 }\r
122 if (Module == NULL) {\r
123 Module = "";\r
124 }\r
125 NumberOfEntries = PeiPerformanceLog->NumberOfEntries;\r
126 LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);\r
127\r
128 for (Index = 0; Index < NumberOfEntries; Index++) {\r
129 if ((LogEntryArray[Index].Handle == (EFI_PHYSICAL_ADDRESS) (UINTN) Handle) &&\r
130 AsciiStrnCmp (LogEntryArray[Index].Token, Token, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&\r
131 AsciiStrnCmp (LogEntryArray[Index].Module, Module, PEI_PERFORMANCE_STRING_LENGTH) == 0 &&\r
f0da4d7d 132 (PeiPerformanceIdArray[Index] == Identifier) &&\r
a0afd019 133 LogEntryArray[Index].EndTimeStamp == 0\r
134 ) {\r
135 break;\r
136 }\r
137 }\r
138 return Index;\r
139}\r
140\r
141/**\r
142 Creates a record for the beginning of a performance measurement.\r
143\r
f0da4d7d 144 Creates a record that contains the Handle, Token, Module and Identifier.\r
a0afd019 145 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.\r
146 If TimeStamp is zero, then this function reads the current time stamp\r
147 and adds that time stamp value to the record as the start time.\r
148\r
149 @param Handle Pointer to environment specific context used\r
150 to identify the component being measured.\r
151 @param Token Pointer to a Null-terminated ASCII string\r
152 that identifies the component being measured.\r
153 @param Module Pointer to a Null-terminated ASCII string\r
154 that identifies the module being measured.\r
155 @param TimeStamp 64-bit time stamp.\r
f0da4d7d
SZ
156 @param Identifier 32-bit identifier. If the value is 0, the created record\r
157 is same as the one created by StartPerformanceMeasurement.\r
a0afd019 158\r
159 @retval RETURN_SUCCESS The start of the measurement was recorded.\r
160 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
161\r
162**/\r
163RETURN_STATUS\r
164EFIAPI\r
f0da4d7d 165StartPerformanceMeasurementEx (\r
a0afd019 166 IN CONST VOID *Handle, OPTIONAL\r
167 IN CONST CHAR8 *Token, OPTIONAL\r
168 IN CONST CHAR8 *Module, OPTIONAL\r
f0da4d7d
SZ
169 IN UINT64 TimeStamp,\r
170 IN UINT32 Identifier\r
a0afd019 171 )\r
172{\r
173 PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;\r
f0da4d7d 174 UINT32 *PeiPerformanceIdArray;\r
a0afd019 175 PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;\r
176 UINT32 Index;\r
177\r
f0da4d7d 178 InternalGetPerformanceHobLog (&PeiPerformanceLog, &PeiPerformanceIdArray);\r
a0afd019 179\r
180 if (PeiPerformanceLog->NumberOfEntries >= PcdGet8 (PcdMaxPeiPerformanceLogEntries)) {\r
181 return RETURN_OUT_OF_RESOURCES;\r
182 }\r
183 Index = PeiPerformanceLog->NumberOfEntries++;\r
184 LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);\r
185 LogEntryArray[Index].Handle = (EFI_PHYSICAL_ADDRESS) (UINTN) Handle;\r
186\r
187 if (Token != NULL) {\r
188 AsciiStrnCpy (LogEntryArray[Index].Token, Token, PEI_PERFORMANCE_STRING_LENGTH);\r
189 }\r
190 if (Module != NULL) {\r
191 AsciiStrnCpy (LogEntryArray[Index].Module, Module, PEI_PERFORMANCE_STRING_LENGTH);\r
192 }\r
193\r
f0da4d7d
SZ
194 LogEntryArray[Index].EndTimeStamp = 0;\r
195 PeiPerformanceIdArray[Index] = Identifier;\r
196\r
a0afd019 197 if (TimeStamp == 0) {\r
198 TimeStamp = GetPerformanceCounter ();\r
199 }\r
200 LogEntryArray[Index].StartTimeStamp = TimeStamp;\r
201\r
202 return RETURN_SUCCESS;\r
203}\r
204\r
205/**\r
206 Fills in the end time of a performance measurement.\r
207\r
f0da4d7d 208 Looks up the record that matches Handle, Token, Module and Identifier.\r
a0afd019 209 If the record can not be found then return RETURN_NOT_FOUND.\r
210 If the record is found and TimeStamp is not zero,\r
211 then TimeStamp is added to the record as the end time.\r
212 If the record is found and TimeStamp is zero, then this function reads\r
213 the current time stamp and adds that time stamp value to the record as the end time.\r
a0afd019 214\r
215 @param Handle Pointer to environment specific context used\r
216 to identify the component being measured.\r
217 @param Token Pointer to a Null-terminated ASCII string\r
218 that identifies the component being measured.\r
219 @param Module Pointer to a Null-terminated ASCII string\r
220 that identifies the module being measured.\r
221 @param TimeStamp 64-bit time stamp.\r
f0da4d7d
SZ
222 @param Identifier 32-bit identifier. If the value is 0, the found record\r
223 is same as the one found by EndPerformanceMeasurement.\r
a0afd019 224\r
225 @retval RETURN_SUCCESS The end of the measurement was recorded.\r
226 @retval RETURN_NOT_FOUND The specified measurement record could not be found.\r
227\r
228**/\r
229RETURN_STATUS\r
230EFIAPI\r
f0da4d7d 231EndPerformanceMeasurementEx (\r
a0afd019 232 IN CONST VOID *Handle, OPTIONAL\r
233 IN CONST CHAR8 *Token, OPTIONAL\r
234 IN CONST CHAR8 *Module, OPTIONAL\r
f0da4d7d
SZ
235 IN UINT64 TimeStamp,\r
236 IN UINT32 Identifier\r
a0afd019 237 )\r
238{\r
239 PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;\r
f0da4d7d 240 UINT32 *PeiPerformanceIdArray;\r
a0afd019 241 PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;\r
242 UINT32 Index;\r
243\r
244 if (TimeStamp == 0) {\r
245 TimeStamp = GetPerformanceCounter ();\r
246 }\r
247\r
f0da4d7d
SZ
248 InternalGetPerformanceHobLog (&PeiPerformanceLog, &PeiPerformanceIdArray);\r
249 Index = InternalSearchForLogEntry (PeiPerformanceLog, PeiPerformanceIdArray, Handle, Token, Module, Identifier);\r
a0afd019 250 if (Index >= PeiPerformanceLog->NumberOfEntries) {\r
251 return RETURN_NOT_FOUND;\r
252 }\r
253 LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);\r
254 LogEntryArray[Index].EndTimeStamp = TimeStamp;\r
255\r
256 return RETURN_SUCCESS;\r
257}\r
258\r
259/**\r
260 Attempts to retrieve a performance measurement log entry from the performance measurement log.\r
f0da4d7d
SZ
261 It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement,\r
262 and then assign the Identifier with 0.\r
a0afd019 263\r
264 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is\r
265 zero on entry, then an attempt is made to retrieve the first entry from the performance log,\r
266 and the key for the second entry in the log is returned. If the performance log is empty,\r
267 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance\r
268 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is\r
269 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is\r
270 retrieved and an implementation specific non-zero key value that specifies the end of the performance\r
271 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry\r
272 is retrieved and zero is returned. In the cases where a performance log entry can be returned,\r
f0da4d7d 273 the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier.\r
a0afd019 274 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().\r
275 If Handle is NULL, then ASSERT().\r
276 If Token is NULL, then ASSERT().\r
277 If Module is NULL, then ASSERT().\r
278 If StartTimeStamp is NULL, then ASSERT().\r
279 If EndTimeStamp is NULL, then ASSERT().\r
f0da4d7d 280 If Identifier is NULL, then ASSERT().\r
a0afd019 281\r
282 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.\r
283 0, then the first performance measurement log entry is retrieved.\r
f0da4d7d 284 On exit, the key of the next performance of entry entry.\r
a0afd019 285 @param Handle Pointer to environment specific context used to identify the component\r
286 being measured.\r
287 @param Token Pointer to a Null-terminated ASCII string that identifies the component\r
288 being measured.\r
289 @param Module Pointer to a Null-terminated ASCII string that identifies the module\r
290 being measured.\r
291 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement\r
292 was started.\r
293 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement\r
294 was ended.\r
f0da4d7d 295 @param Identifier Pointer to the 32-bit identifier that was recorded.\r
a0afd019 296\r
297 @return The key for the next performance log entry (in general case).\r
298\r
299**/\r
300UINTN\r
301EFIAPI\r
f0da4d7d 302GetPerformanceMeasurementEx (\r
a0afd019 303 IN UINTN LogEntryKey,\r
304 OUT CONST VOID **Handle,\r
305 OUT CONST CHAR8 **Token,\r
306 OUT CONST CHAR8 **Module,\r
307 OUT UINT64 *StartTimeStamp,\r
f0da4d7d
SZ
308 OUT UINT64 *EndTimeStamp,\r
309 OUT UINT32 *Identifier\r
a0afd019 310 )\r
311{\r
312 PEI_PERFORMANCE_LOG_HEADER *PeiPerformanceLog;\r
f0da4d7d 313 UINT32 *PeiPerformanceIdArray;\r
a0afd019 314 PEI_PERFORMANCE_LOG_ENTRY *CurrentLogEntry;\r
315 PEI_PERFORMANCE_LOG_ENTRY *LogEntryArray;\r
316 UINTN NumberOfEntries;\r
317\r
318 ASSERT (Handle != NULL);\r
319 ASSERT (Token != NULL);\r
320 ASSERT (Module != NULL);\r
321 ASSERT (StartTimeStamp != NULL);\r
322 ASSERT (EndTimeStamp != NULL);\r
f0da4d7d 323 ASSERT (Identifier != NULL);\r
a0afd019 324\r
f0da4d7d 325 InternalGetPerformanceHobLog (&PeiPerformanceLog, &PeiPerformanceIdArray);\r
a0afd019 326\r
327 NumberOfEntries = (UINTN) (PeiPerformanceLog->NumberOfEntries);\r
328 LogEntryArray = (PEI_PERFORMANCE_LOG_ENTRY *) (PeiPerformanceLog + 1);\r
329 //\r
330 // Make sure that LogEntryKey is a valid log entry key.\r
331 //\r
332 ASSERT (LogEntryKey <= NumberOfEntries);\r
333\r
334 if (LogEntryKey == NumberOfEntries) {\r
335 return 0;\r
336 }\r
337\r
f0da4d7d 338 CurrentLogEntry = &(LogEntryArray[LogEntryKey]);\r
a0afd019 339\r
340 *Handle = (VOID *) (UINTN) (CurrentLogEntry->Handle);\r
341 *Token = CurrentLogEntry->Token;\r
342 *Module = CurrentLogEntry->Module;\r
343 *StartTimeStamp = CurrentLogEntry->StartTimeStamp;\r
344 *EndTimeStamp = CurrentLogEntry->EndTimeStamp;\r
f0da4d7d 345 *Identifier = PeiPerformanceIdArray[LogEntryKey++];\r
a0afd019 346\r
347 return LogEntryKey;\r
348}\r
349\r
f0da4d7d
SZ
350/**\r
351 Creates a record for the beginning of a performance measurement.\r
352\r
353 Creates a record that contains the Handle, Token, and Module.\r
354 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.\r
355 If TimeStamp is zero, then this function reads the current time stamp\r
356 and adds that time stamp value to the record as the start time.\r
357\r
358 @param Handle Pointer to environment specific context used\r
359 to identify the component being measured.\r
360 @param Token Pointer to a Null-terminated ASCII string\r
361 that identifies the component being measured.\r
362 @param Module Pointer to a Null-terminated ASCII string\r
363 that identifies the module being measured.\r
364 @param TimeStamp 64-bit time stamp.\r
365\r
366 @retval RETURN_SUCCESS The start of the measurement was recorded.\r
367 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
368\r
369**/\r
370RETURN_STATUS\r
371EFIAPI\r
372StartPerformanceMeasurement (\r
373 IN CONST VOID *Handle, OPTIONAL\r
374 IN CONST CHAR8 *Token, OPTIONAL\r
375 IN CONST CHAR8 *Module, OPTIONAL\r
376 IN UINT64 TimeStamp\r
377 )\r
378{\r
379 return StartPerformanceMeasurementEx (Handle, Token, Module, TimeStamp, 0);\r
380}\r
381\r
382/**\r
383 Fills in the end time of a performance measurement.\r
384\r
385 Looks up the record that matches Handle, Token, and Module.\r
386 If the record can not be found then return RETURN_NOT_FOUND.\r
387 If the record is found and TimeStamp is not zero,\r
388 then TimeStamp is added to the record as the end time.\r
389 If the record is found and TimeStamp is zero, then this function reads\r
390 the current time stamp and adds that time stamp value to the record as the end time.\r
391\r
392 @param Handle Pointer to environment specific context used\r
393 to identify the component being measured.\r
394 @param Token Pointer to a Null-terminated ASCII string\r
395 that identifies the component being measured.\r
396 @param Module Pointer to a Null-terminated ASCII string\r
397 that identifies the module being measured.\r
398 @param TimeStamp 64-bit time stamp.\r
399\r
400 @retval RETURN_SUCCESS The end of the measurement was recorded.\r
401 @retval RETURN_NOT_FOUND The specified measurement record could not be found.\r
402\r
403**/\r
404RETURN_STATUS\r
405EFIAPI\r
406EndPerformanceMeasurement (\r
407 IN CONST VOID *Handle, OPTIONAL\r
408 IN CONST CHAR8 *Token, OPTIONAL\r
409 IN CONST CHAR8 *Module, OPTIONAL\r
410 IN UINT64 TimeStamp\r
411 )\r
412{\r
413 return EndPerformanceMeasurementEx (Handle, Token, Module, TimeStamp, 0);\r
414}\r
415\r
416/**\r
417 Attempts to retrieve a performance measurement log entry from the performance measurement log.\r
418 It can also retrieve the log created by StartPerformanceMeasurementEx and EndPerformanceMeasurementEx,\r
419 and then eliminate the Identifier.\r
420\r
421 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is\r
422 zero on entry, then an attempt is made to retrieve the first entry from the performance log,\r
423 and the key for the second entry in the log is returned. If the performance log is empty,\r
424 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance\r
425 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is\r
426 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is\r
427 retrieved and an implementation specific non-zero key value that specifies the end of the performance\r
428 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry\r
429 is retrieved and zero is returned. In the cases where a performance log entry can be returned,\r
430 the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.\r
431 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().\r
432 If Handle is NULL, then ASSERT().\r
433 If Token is NULL, then ASSERT().\r
434 If Module is NULL, then ASSERT().\r
435 If StartTimeStamp is NULL, then ASSERT().\r
436 If EndTimeStamp is NULL, then ASSERT().\r
437\r
438 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.\r
439 0, then the first performance measurement log entry is retrieved.\r
440 On exit, the key of the next performance of entry entry.\r
441 @param Handle Pointer to environment specific context used to identify the component\r
442 being measured.\r
443 @param Token Pointer to a Null-terminated ASCII string that identifies the component\r
444 being measured.\r
445 @param Module Pointer to a Null-terminated ASCII string that identifies the module\r
446 being measured.\r
447 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement\r
448 was started.\r
449 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement\r
450 was ended.\r
451\r
452 @return The key for the next performance log entry (in general case).\r
453\r
454**/\r
455UINTN\r
456EFIAPI\r
457GetPerformanceMeasurement (\r
458 IN UINTN LogEntryKey,\r
459 OUT CONST VOID **Handle,\r
460 OUT CONST CHAR8 **Token,\r
461 OUT CONST CHAR8 **Module,\r
462 OUT UINT64 *StartTimeStamp,\r
463 OUT UINT64 *EndTimeStamp\r
464 )\r
465{\r
466 UINT32 Identifier;\r
467 return GetPerformanceMeasurementEx (LogEntryKey, Handle, Token, Module, StartTimeStamp, EndTimeStamp, &Identifier);\r
468}\r
469\r
a0afd019 470/**\r
471 Returns TRUE if the performance measurement macros are enabled.\r
472\r
473 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of\r
474 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.\r
475\r
476 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of\r
477 PcdPerformanceLibraryPropertyMask is set.\r
478 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of\r
479 PcdPerformanceLibraryPropertyMask is clear.\r
480\r
481**/\r
482BOOLEAN\r
483EFIAPI\r
484PerformanceMeasurementEnabled (\r
485 VOID\r
486 )\r
487{\r
488 return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);\r
489}\r