]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/DxeSmmPerformanceLib/DxeSmmPerformanceLib.c
MdeModulePkg: Provide EfiBootManagerRegisterBootDescriptionHandler
[mirror_edk2.git] / MdeModulePkg / Library / DxeSmmPerformanceLib / DxeSmmPerformanceLib.c
CommitLineData
d042c6e8 1/** @file\r
2 Performance library instance used in DXE phase to dump SMM performance data.\r
3\r
4 This library instance allows a DXE driver or UEFI application to dump the SMM performance data.\r
f0da4d7d
SZ
5 StartPerformanceMeasurement(), EndPerformanceMeasurement(), StartPerformanceMeasurementEx()\r
6 and EndPerformanceMeasurementEx() are not implemented.\r
d042c6e8 7\r
3dffec12 8 Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
d042c6e8 9This program and the accompanying materials\r
10are licensed and made available under the terms and conditions of the BSD License\r
11which accompanies this distribution. The full text of the license may be found at\r
12http://opensource.org/licenses/bsd-license.php\r
13\r
14THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16\r
17**/\r
18\r
19\r
20#include <PiDxe.h>\r
21\r
22#include <Guid/Performance.h>\r
23\r
24#include <Library/PerformanceLib.h>\r
25#include <Library/DebugLib.h>\r
26#include <Library/UefiBootServicesTableLib.h>\r
27#include <Library/UefiRuntimeServicesTableLib.h>\r
28#include <Library/PcdLib.h>\r
29#include <Library/BaseMemoryLib.h>\r
30#include <Library/BaseLib.h>\r
31#include <Library/MemoryAllocationLib.h>\r
32\r
33#include <Protocol/SmmCommunication.h>\r
34\r
35#define SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PERF_COMMUNICATE))\r
36//\r
37// The cached performance protocol interface.\r
38//\r
39EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;\r
40UINT8 mSmmPerformanceBuffer[SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE];\r
41GAUGE_DATA_ENTRY *mGaugeData = NULL;\r
42UINTN mGaugeNumberOfEntries = 0;\r
f0da4d7d
SZ
43GAUGE_DATA_ENTRY_EX *mGaugeDataEx = NULL;\r
44UINTN mGaugeNumberOfEntriesEx = 0;\r
d042c6e8 45\r
46/**\r
f0da4d7d 47 The function caches the pointer to SMM Communication protocol.\r
d042c6e8 48\r
f0da4d7d 49 The function locates SMM Communication protocol from protocol database.\r
d042c6e8 50\r
f0da4d7d
SZ
51 @retval EFI_SUCCESS SMM Communication protocol is successfully located.\r
52 @retval Other SMM Communication protocol is not located to log performance.\r
d042c6e8 53\r
54**/\r
55EFI_STATUS\r
56GetCommunicationProtocol (\r
57 VOID\r
58 )\r
59{\r
60 EFI_STATUS Status;\r
61 EFI_SMM_COMMUNICATION_PROTOCOL *Communication;\r
62\r
63 if (mSmmCommunication != NULL) {\r
64 return EFI_SUCCESS;\r
65 }\r
66\r
67 Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &Communication);\r
68 if (!EFI_ERROR (Status)) {\r
69 ASSERT (Communication != NULL);\r
70 //\r
71 // Cache SMM Communication protocol.\r
72 //\r
73 mSmmCommunication = Communication;\r
74 }\r
75\r
76 return Status;\r
77}\r
78\r
f0da4d7d
SZ
79/**\r
80 Creates a record for the beginning of a performance measurement.\r
81\r
82 Creates a record that contains the Handle, Token, Module and Identifier.\r
83 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.\r
84 If TimeStamp is zero, then this function reads the current time stamp\r
85 and adds that time stamp value to the record as the start time.\r
86\r
87 @param Handle Pointer to environment specific context used\r
88 to identify the component being measured.\r
89 @param Token Pointer to a Null-terminated ASCII string\r
90 that identifies the component being measured.\r
91 @param Module Pointer to a Null-terminated ASCII string\r
92 that identifies the module being measured.\r
93 @param TimeStamp 64-bit time stamp.\r
94 @param Identifier 32-bit identifier. If the value is 0, the created record\r
95 is same as the one created by StartPerformanceMeasurement.\r
96\r
97 @retval RETURN_SUCCESS The start of the measurement was recorded.\r
98 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
99\r
100**/\r
101RETURN_STATUS\r
102EFIAPI\r
103StartPerformanceMeasurementEx (\r
104 IN CONST VOID *Handle, OPTIONAL\r
105 IN CONST CHAR8 *Token, OPTIONAL\r
106 IN CONST CHAR8 *Module, OPTIONAL\r
107 IN UINT64 TimeStamp,\r
108 IN UINT32 Identifier\r
109 )\r
110{\r
111 return RETURN_SUCCESS;\r
112}\r
113\r
114/**\r
115 Fills in the end time of a performance measurement.\r
116\r
117 Looks up the record that matches Handle, Token, Module and Identifier.\r
118 If the record can not be found then return RETURN_NOT_FOUND.\r
119 If the record is found and TimeStamp is not zero,\r
120 then TimeStamp is added to the record as the end time.\r
121 If the record is found and TimeStamp is zero, then this function reads\r
122 the current time stamp and adds that time stamp value to the record as the end time.\r
123\r
124 @param Handle Pointer to environment specific context used\r
125 to identify the component being measured.\r
126 @param Token Pointer to a Null-terminated ASCII string\r
127 that identifies the component being measured.\r
128 @param Module Pointer to a Null-terminated ASCII string\r
129 that identifies the module being measured.\r
130 @param TimeStamp 64-bit time stamp.\r
131 @param Identifier 32-bit identifier. If the value is 0, the found record\r
132 is same as the one found by EndPerformanceMeasurement.\r
133\r
134 @retval RETURN_SUCCESS The end of the measurement was recorded.\r
135 @retval RETURN_NOT_FOUND The specified measurement record could not be found.\r
136\r
137**/\r
138RETURN_STATUS\r
139EFIAPI\r
140EndPerformanceMeasurementEx (\r
141 IN CONST VOID *Handle, OPTIONAL\r
142 IN CONST CHAR8 *Token, OPTIONAL\r
143 IN CONST CHAR8 *Module, OPTIONAL\r
144 IN UINT64 TimeStamp,\r
145 IN UINT32 Identifier\r
146 )\r
147{\r
148 return RETURN_SUCCESS;\r
149}\r
150\r
d042c6e8 151/**\r
152 Creates a record for the beginning of a performance measurement.\r
153\r
154 Creates a record that contains the Handle, Token, and Module.\r
155 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.\r
156 If TimeStamp is zero, then this function reads the current time stamp\r
157 and adds that time stamp value to the record as the start time.\r
158\r
159 @param Handle Pointer to environment specific context used\r
160 to identify the component being measured.\r
161 @param Token Pointer to a Null-terminated ASCII string\r
162 that identifies the component being measured.\r
163 @param Module Pointer to a Null-terminated ASCII string\r
164 that identifies the module being measured.\r
165 @param TimeStamp 64-bit time stamp.\r
166\r
167 @retval RETURN_SUCCESS The start of the measurement was recorded.\r
168 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
169\r
170**/\r
171RETURN_STATUS\r
172EFIAPI\r
173StartPerformanceMeasurement (\r
174 IN CONST VOID *Handle, OPTIONAL\r
175 IN CONST CHAR8 *Token, OPTIONAL\r
176 IN CONST CHAR8 *Module, OPTIONAL\r
177 IN UINT64 TimeStamp\r
178 )\r
179{\r
f0da4d7d 180 return RETURN_SUCCESS;\r
d042c6e8 181}\r
182\r
183/**\r
184 Fills in the end time of a performance measurement.\r
185\r
186 Looks up the record that matches Handle, Token, and Module.\r
187 If the record can not be found then return RETURN_NOT_FOUND.\r
188 If the record is found and TimeStamp is not zero,\r
189 then TimeStamp is added to the record as the end time.\r
190 If the record is found and TimeStamp is zero, then this function reads\r
191 the current time stamp and adds that time stamp value to the record as the end time.\r
d042c6e8 192\r
193 @param Handle Pointer to environment specific context used\r
194 to identify the component being measured.\r
195 @param Token Pointer to a Null-terminated ASCII string\r
196 that identifies the component being measured.\r
197 @param Module Pointer to a Null-terminated ASCII string\r
198 that identifies the module being measured.\r
199 @param TimeStamp 64-bit time stamp.\r
200\r
201 @retval RETURN_SUCCESS The end of the measurement was recorded.\r
202 @retval RETURN_NOT_FOUND The specified measurement record could not be found.\r
203\r
204**/\r
205RETURN_STATUS\r
206EFIAPI\r
207EndPerformanceMeasurement (\r
208 IN CONST VOID *Handle, OPTIONAL\r
209 IN CONST CHAR8 *Token, OPTIONAL\r
210 IN CONST CHAR8 *Module, OPTIONAL\r
211 IN UINT64 TimeStamp\r
212 )\r
213{\r
f0da4d7d 214 return RETURN_SUCCESS;\r
d042c6e8 215}\r
216\r
217/**\r
218 Retrieves all previous logged performance measurement.\r
219 Function will use SMM communicate protocol to get all previous SMM performance measurement data.\r
220 If success, data buffer will be returned. If fail function will return NULL.\r
221\r
222 @retval !NULL Get all gauge data success.\r
223 @retval NULL Get all guage data failed.\r
224**/\r
f0da4d7d 225GAUGE_DATA_ENTRY *\r
d042c6e8 226EFIAPI\r
227GetAllSmmGaugeData (VOID)\r
228{\r
229 EFI_STATUS Status;\r
230 EFI_SMM_COMMUNICATE_HEADER *SmmCommBufferHeader;\r
231 SMM_PERF_COMMUNICATE *SmmPerfCommData;\r
232 UINTN CommSize;\r
233 UINTN DataSize;\r
234\r
235 if (mGaugeData != NULL) {\r
236 return mGaugeData;\r
237 }\r
238\r
239 Status = GetCommunicationProtocol ();\r
240 if (EFI_ERROR (Status)) {\r
241 return NULL;\r
242 }\r
243\r
244 //\r
245 // Initialize communicate buffer \r
246 //\r
f0da4d7d
SZ
247 SmmCommBufferHeader = (EFI_SMM_COMMUNICATE_HEADER *)mSmmPerformanceBuffer;\r
248 SmmPerfCommData = (SMM_PERF_COMMUNICATE *)SmmCommBufferHeader->Data;\r
d042c6e8 249 ZeroMem((UINT8*)SmmPerfCommData, sizeof(SMM_PERF_COMMUNICATE));\r
250 \r
251 CopyGuid (&SmmCommBufferHeader->HeaderGuid, &gSmmPerformanceProtocolGuid);\r
252 SmmCommBufferHeader->MessageLength = sizeof(SMM_PERF_COMMUNICATE);\r
f0da4d7d 253 CommSize = SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE;\r
d042c6e8 254\r
255 //\r
256 // Get totol number of SMM gauge entries\r
257 //\r
258 SmmPerfCommData->Function = SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER;\r
259 Status = mSmmCommunication->Communicate (mSmmCommunication, mSmmPerformanceBuffer, &CommSize);\r
f0da4d7d 260 if (EFI_ERROR (Status) || EFI_ERROR (SmmPerfCommData->ReturnStatus) || SmmPerfCommData->NumberOfEntries == 0) {\r
d042c6e8 261 return NULL;\r
262 }\r
263\r
264 mGaugeNumberOfEntries = SmmPerfCommData->NumberOfEntries;\r
265 \r
266 DataSize = mGaugeNumberOfEntries * sizeof(GAUGE_DATA_ENTRY);\r
267 mGaugeData = AllocateZeroPool(DataSize);\r
f0da4d7d 268 ASSERT (mGaugeData != NULL);\r
d042c6e8 269 \r
270 //\r
271 // Get all SMM gauge data\r
272 // \r
273 SmmPerfCommData->Function = SMM_PERF_FUNCTION_GET_GAUGE_DATA;\r
274 SmmPerfCommData->LogEntryKey = 0;\r
275 SmmPerfCommData->NumberOfEntries = mGaugeNumberOfEntries;\r
276 SmmPerfCommData->GaugeData = mGaugeData;\r
277 Status = mSmmCommunication->Communicate (mSmmCommunication, mSmmPerformanceBuffer, &CommSize);\r
f0da4d7d
SZ
278 if (EFI_ERROR (Status) || EFI_ERROR (SmmPerfCommData->ReturnStatus)) {\r
279 FreePool (mGaugeData);\r
280 mGaugeData = NULL;\r
281 mGaugeNumberOfEntries = 0;\r
282 }\r
d042c6e8 283\r
f0da4d7d 284 return mGaugeData;\r
d042c6e8 285}\r
286\r
287/**\r
f0da4d7d
SZ
288 Retrieves all previous logged performance measurement.\r
289 Function will use SMM communicate protocol to get all previous SMM performance measurement data.\r
290 If success, data buffer will be returned. If fail function will return NULL.\r
d042c6e8 291\r
f0da4d7d
SZ
292 @retval !NULL Get all gauge data success.\r
293 @retval NULL Get all guage data failed.\r
d042c6e8 294**/\r
f0da4d7d 295GAUGE_DATA_ENTRY_EX *\r
d042c6e8 296EFIAPI\r
f0da4d7d 297GetAllSmmGaugeDataEx (VOID)\r
d042c6e8 298{\r
f0da4d7d
SZ
299 EFI_STATUS Status;\r
300 EFI_SMM_COMMUNICATE_HEADER *SmmCommBufferHeader;\r
301 SMM_PERF_COMMUNICATE_EX *SmmPerfCommData;\r
302 UINTN CommSize;\r
303 UINTN DataSize;\r
304\r
305 if (mGaugeDataEx != NULL) {\r
306 return mGaugeDataEx;\r
d042c6e8 307 }\r
f0da4d7d
SZ
308\r
309 Status = GetCommunicationProtocol ();\r
310 if (EFI_ERROR (Status)) {\r
311 return NULL;\r
d042c6e8 312 }\r
313\r
f0da4d7d
SZ
314 //\r
315 // Initialize communicate buffer \r
316 //\r
317 SmmCommBufferHeader = (EFI_SMM_COMMUNICATE_HEADER *)mSmmPerformanceBuffer;\r
318 SmmPerfCommData = (SMM_PERF_COMMUNICATE_EX *)SmmCommBufferHeader->Data;\r
319 ZeroMem((UINT8*)SmmPerfCommData, sizeof(SMM_PERF_COMMUNICATE_EX));\r
320 \r
321 CopyGuid (&SmmCommBufferHeader->HeaderGuid, &gSmmPerformanceExProtocolGuid);\r
322 SmmCommBufferHeader->MessageLength = sizeof(SMM_PERF_COMMUNICATE_EX);\r
323 CommSize = SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE;\r
324\r
325 //\r
326 // Get totol number of SMM gauge entries\r
327 //\r
328 SmmPerfCommData->Function = SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER;\r
329 Status = mSmmCommunication->Communicate (mSmmCommunication, mSmmPerformanceBuffer, &CommSize);\r
330 if (EFI_ERROR (Status) || EFI_ERROR (SmmPerfCommData->ReturnStatus) || SmmPerfCommData->NumberOfEntries == 0) {\r
331 return NULL;\r
d042c6e8 332 }\r
d042c6e8 333\r
f0da4d7d
SZ
334 mGaugeNumberOfEntriesEx = SmmPerfCommData->NumberOfEntries;\r
335 \r
336 DataSize = mGaugeNumberOfEntriesEx * sizeof(GAUGE_DATA_ENTRY_EX);\r
337 mGaugeDataEx = AllocateZeroPool(DataSize);\r
338 ASSERT (mGaugeDataEx != NULL);\r
339 \r
340 //\r
341 // Get all SMM gauge data\r
342 // \r
343 SmmPerfCommData->Function = SMM_PERF_FUNCTION_GET_GAUGE_DATA;\r
344 SmmPerfCommData->LogEntryKey = 0;\r
345 SmmPerfCommData->NumberOfEntries = mGaugeNumberOfEntriesEx;\r
346 SmmPerfCommData->GaugeDataEx = mGaugeDataEx;\r
347 Status = mSmmCommunication->Communicate (mSmmCommunication, mSmmPerformanceBuffer, &CommSize);\r
348 if (EFI_ERROR (Status) || EFI_ERROR (SmmPerfCommData->ReturnStatus)) {\r
349 FreePool (mGaugeDataEx);\r
350 mGaugeDataEx = NULL;\r
351 mGaugeNumberOfEntriesEx = 0;\r
352 }\r
353 \r
354 return mGaugeDataEx;\r
d042c6e8 355}\r
356\r
357/**\r
358 Attempts to retrieve a performance measurement log entry from the performance measurement log.\r
f0da4d7d
SZ
359 It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement,\r
360 and then assign the Identifier with 0.\r
d042c6e8 361\r
362 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is\r
363 zero on entry, then an attempt is made to retrieve the first entry from the performance log,\r
364 and the key for the second entry in the log is returned. If the performance log is empty,\r
365 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance\r
366 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is\r
367 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is\r
368 retrieved and an implementation specific non-zero key value that specifies the end of the performance\r
369 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry\r
370 is retrieved and zero is returned. In the cases where a performance log entry can be returned,\r
f0da4d7d 371 the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier.\r
d042c6e8 372 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().\r
373 If Handle is NULL, then ASSERT().\r
374 If Token is NULL, then ASSERT().\r
375 If Module is NULL, then ASSERT().\r
376 If StartTimeStamp is NULL, then ASSERT().\r
377 If EndTimeStamp is NULL, then ASSERT().\r
f0da4d7d 378 If Identifier is NULL, then ASSERT().\r
d042c6e8 379\r
380 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.\r
381 0, then the first performance measurement log entry is retrieved.\r
382 On exit, the key of the next performance log entry.\r
383 @param Handle Pointer to environment specific context used to identify the component\r
384 being measured.\r
385 @param Token Pointer to a Null-terminated ASCII string that identifies the component\r
386 being measured.\r
387 @param Module Pointer to a Null-terminated ASCII string that identifies the module\r
388 being measured.\r
389 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement\r
390 was started.\r
391 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement\r
392 was ended.\r
f0da4d7d 393 @param Identifier Pointer to the 32-bit identifier that was recorded.\r
d042c6e8 394\r
395 @return The key for the next performance log entry (in general case).\r
396\r
397**/\r
398UINTN\r
399EFIAPI\r
f0da4d7d
SZ
400GetPerformanceMeasurementEx (\r
401 IN UINTN LogEntryKey, \r
d042c6e8 402 OUT CONST VOID **Handle,\r
403 OUT CONST CHAR8 **Token,\r
404 OUT CONST CHAR8 **Module,\r
405 OUT UINT64 *StartTimeStamp,\r
f0da4d7d
SZ
406 OUT UINT64 *EndTimeStamp,\r
407 OUT UINT32 *Identifier\r
d042c6e8 408 )\r
409{\r
f0da4d7d 410 GAUGE_DATA_ENTRY_EX *GaugeData;\r
d042c6e8 411\r
412 GaugeData = NULL;\r
413\r
414 ASSERT (Handle != NULL);\r
415 ASSERT (Token != NULL);\r
416 ASSERT (Module != NULL);\r
417 ASSERT (StartTimeStamp != NULL);\r
418 ASSERT (EndTimeStamp != NULL);\r
f0da4d7d 419 ASSERT (Identifier != NULL);\r
d042c6e8 420\r
f0da4d7d
SZ
421 mGaugeDataEx = GetAllSmmGaugeDataEx();\r
422 if (mGaugeDataEx != NULL) {\r
d042c6e8 423 //\r
f0da4d7d 424 // Make sure that LogEntryKey is a valid log entry key.\r
d042c6e8 425 //\r
f0da4d7d
SZ
426 ASSERT (LogEntryKey <= mGaugeNumberOfEntriesEx);\r
427\r
428 if (LogEntryKey == mGaugeNumberOfEntriesEx) {\r
429 return 0;\r
430 }\r
431\r
432 GaugeData = &mGaugeDataEx[LogEntryKey++];\r
433 *Identifier = GaugeData->Identifier;\r
434 } else {\r
435 mGaugeData = GetAllSmmGaugeData();\r
436 if (mGaugeData != NULL) {\r
437 //\r
438 // Make sure that LogEntryKey is a valid log entry key.\r
439 //\r
440 ASSERT (LogEntryKey <= mGaugeNumberOfEntries);\r
441\r
442 if (LogEntryKey == mGaugeNumberOfEntries) {\r
443 return 0;\r
444 }\r
445\r
446 GaugeData = (GAUGE_DATA_ENTRY_EX *) &mGaugeData[LogEntryKey++];\r
447 *Identifier = 0;\r
448 } else {\r
449 return 0;\r
450 }\r
d042c6e8 451 }\r
452\r
d042c6e8 453 *Handle = (VOID *) (UINTN) GaugeData->Handle;\r
454 *Token = GaugeData->Token;\r
455 *Module = GaugeData->Module;\r
456 *StartTimeStamp = GaugeData->StartTimeStamp;\r
457 *EndTimeStamp = GaugeData->EndTimeStamp;\r
458\r
459 return LogEntryKey;\r
460}\r
461\r
f0da4d7d
SZ
462/**\r
463 Attempts to retrieve a performance measurement log entry from the performance measurement log.\r
464 It can also retrieve the log created by StartPerformanceMeasurementEx and EndPerformanceMeasurementEx,\r
465 and then eliminate the Identifier.\r
466\r
467 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is\r
468 zero on entry, then an attempt is made to retrieve the first entry from the performance log,\r
469 and the key for the second entry in the log is returned. If the performance log is empty,\r
470 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance\r
471 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is\r
472 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is\r
473 retrieved and an implementation specific non-zero key value that specifies the end of the performance\r
474 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry\r
475 is retrieved and zero is returned. In the cases where a performance log entry can be returned,\r
476 the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.\r
477 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().\r
478 If Handle is NULL, then ASSERT().\r
479 If Token is NULL, then ASSERT().\r
480 If Module is NULL, then ASSERT().\r
481 If StartTimeStamp is NULL, then ASSERT().\r
482 If EndTimeStamp is NULL, then ASSERT().\r
483\r
484 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.\r
485 0, then the first performance measurement log entry is retrieved.\r
486 On exit, the key of the next performance log entry.\r
487 @param Handle Pointer to environment specific context used to identify the component\r
488 being measured.\r
489 @param Token Pointer to a Null-terminated ASCII string that identifies the component\r
490 being measured.\r
491 @param Module Pointer to a Null-terminated ASCII string that identifies the module\r
492 being measured.\r
493 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement\r
494 was started.\r
495 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement\r
496 was ended.\r
497\r
498 @return The key for the next performance log entry (in general case).\r
499\r
500**/\r
501UINTN\r
502EFIAPI\r
503GetPerformanceMeasurement (\r
504 IN UINTN LogEntryKey,\r
505 OUT CONST VOID **Handle,\r
506 OUT CONST CHAR8 **Token,\r
507 OUT CONST CHAR8 **Module,\r
508 OUT UINT64 *StartTimeStamp,\r
509 OUT UINT64 *EndTimeStamp\r
510 )\r
511{\r
512 UINT32 Identifier;\r
513 return GetPerformanceMeasurementEx (LogEntryKey, Handle, Token, Module, StartTimeStamp, EndTimeStamp, &Identifier);\r
514}\r
515\r
d042c6e8 516/**\r
517 Returns TRUE if the performance measurement macros are enabled.\r
518\r
519 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of\r
520 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.\r
521\r
522 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of\r
523 PcdPerformanceLibraryPropertyMask is set.\r
524 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of\r
525 PcdPerformanceLibraryPropertyMask is clear.\r
526\r
527**/\r
528BOOLEAN\r
529EFIAPI\r
530PerformanceMeasurementEnabled (\r
531 VOID\r
532 )\r
533{\r
534 return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);\r
535}\r