2 Performance library instance used in PEI phase.
4 This file implements all APIs in Performance Library class in MdePkg. It creates
5 performance logging GUIDed HOB on the first performance logging and then logs the
6 performance data to the GUIDed HOB. Due to the limitation of temporary RAM, the maximum
7 number of performance logging entry is specified by PcdMaxPeiPerformanceLogEntries or
8 PcdMaxPeiPerformanceLogEntries16.
10 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
11 (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
12 This program and the accompanying materials
13 are licensed and made available under the terms and conditions of the BSD License
14 which accompanies this distribution. The full text of the license may be found at
15 http://opensource.org/licenses/bsd-license.php
17 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
18 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 #include <Guid/ExtendedFirmwarePerformance.h>
27 #include <Library/PerformanceLib.h>
28 #include <Library/DebugLib.h>
29 #include <Library/HobLib.h>
30 #include <Library/BaseLib.h>
31 #include <Library/TimerLib.h>
32 #include <Library/PcdLib.h>
33 #include <Library/BaseMemoryLib.h>
35 #define STRING_SIZE (FPDT_STRING_EVENT_RECORD_NAME_LENGTH * sizeof (CHAR8))
36 #define MAX_RECORD_SIZE (sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD) + STRING_SIZE)
39 Check whether the Token is a known one which is uesed by core.
41 @param Token Pointer to a Null-terminated ASCII string
43 @retval TRUE Is a known one used by core.
44 @retval FALSE Not a known one.
52 if (AsciiStrCmp (Token
, SEC_TOK
) == 0 ||
53 AsciiStrCmp (Token
, PEI_TOK
) == 0 ||
54 AsciiStrCmp (Token
, DXE_TOK
) == 0 ||
55 AsciiStrCmp (Token
, BDS_TOK
) == 0 ||
56 AsciiStrCmp (Token
, DRIVERBINDING_START_TOK
) == 0 ||
57 AsciiStrCmp (Token
, DRIVERBINDING_SUPPORT_TOK
) == 0 ||
58 AsciiStrCmp (Token
, DRIVERBINDING_STOP_TOK
) == 0 ||
59 AsciiStrCmp (Token
, LOAD_IMAGE_TOK
) == 0 ||
60 AsciiStrCmp (Token
, START_IMAGE_TOK
) == 0 ||
61 AsciiStrCmp (Token
, PEIM_TOK
) == 0) {
69 Check whether the ID is a known one which map to the known Token.
71 @param Identifier 32-bit identifier.
73 @retval TRUE Is a known one used by core.
74 @retval FALSE Not a known one.
82 if (Identifier
== MODULE_START_ID
||
83 Identifier
== MODULE_END_ID
||
84 Identifier
== MODULE_LOADIMAGE_START_ID
||
85 Identifier
== MODULE_LOADIMAGE_END_ID
||
86 Identifier
== MODULE_DB_START_ID
||
87 Identifier
== MODULE_DB_END_ID
||
88 Identifier
== MODULE_DB_SUPPORT_START_ID
||
89 Identifier
== MODULE_DB_SUPPORT_END_ID
||
90 Identifier
== MODULE_DB_STOP_START_ID
||
91 Identifier
== MODULE_DB_STOP_END_ID
) {
99 Get the FPDT record info.
101 @param IsStart TRUE if the performance log is start log.
102 @param Handle Pointer to environment specific context used
103 to identify the component being measured.
104 @param Token Pointer to a Null-terminated ASCII string
105 that identifies the component being measured.
106 @param Module Pointer to a Null-terminated ASCII string
107 that identifies the module being measured.
108 @param RecordInfo On return, pointer to the info of the record.
110 @retval EFI_SUCCESS Get record info successfully.
111 @retval EFI_UNSUPPORTED No matched FPDT record.
117 IN CONST VOID
*Handle
,
118 IN CONST CHAR8
*Token
,
119 IN CONST CHAR8
*Module
,
120 OUT FPDT_BASIC_RECORD_INFO
*RecordInfo
126 RecordType
= FPDT_DYNAMIC_STRING_EVENT_TYPE
;
129 // Get the ProgressID based on the Token.
130 // When PcdEdkiiFpdtStringRecordEnableOnly is TRUE, all records are with type of FPDT_DYNAMIC_STRING_EVENT_TYPE.
133 if (AsciiStrCmp (Token
, LOAD_IMAGE_TOK
) == 0) { // "LoadImage:"
135 RecordInfo
->ProgressID
= MODULE_LOADIMAGE_START_ID
;
137 RecordInfo
->ProgressID
= MODULE_LOADIMAGE_END_ID
;
139 if(!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly
)) {
140 RecordType
= FPDT_GUID_QWORD_EVENT_TYPE
;
142 } else if (AsciiStrCmp (Token
, SEC_TOK
) == 0 || // "SEC"
143 AsciiStrCmp (Token
, PEI_TOK
) == 0) { // "PEI"
145 RecordInfo
->ProgressID
= PERF_CROSSMODULE_START_ID
;
147 RecordInfo
->ProgressID
= PERF_CROSSMODULE_END_ID
;
149 } else if (AsciiStrCmp (Token
, PEIM_TOK
) == 0) { // "PEIM"
151 RecordInfo
->ProgressID
= MODULE_START_ID
;
153 RecordInfo
->ProgressID
= MODULE_END_ID
;
155 if(!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly
)) {
156 RecordType
= FPDT_GUID_EVENT_TYPE
;
158 } else { //Pref used in Modules.
160 RecordInfo
->ProgressID
= PERF_INMODULE_START_ID
;
162 RecordInfo
->ProgressID
= PERF_INMODULE_END_ID
;
165 } else if (Module
!= NULL
|| Handle
!= NULL
) { //Pref used in Modules.
167 RecordInfo
->ProgressID
= PERF_INMODULE_START_ID
;
169 RecordInfo
->ProgressID
= PERF_INMODULE_END_ID
;
172 return EFI_UNSUPPORTED
;
176 // Get the Guid and string.
178 if(PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly
)) {
179 RecordInfo
->RecordSize
= sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD
) + STRING_SIZE
;
181 switch (RecordType
) {
182 case FPDT_GUID_EVENT_TYPE
:
183 RecordInfo
->RecordSize
= sizeof (FPDT_GUID_EVENT_RECORD
);
186 case FPDT_GUID_QWORD_EVENT_TYPE
:
187 RecordInfo
->RecordSize
= sizeof (FPDT_GUID_QWORD_EVENT_RECORD
);
190 case FPDT_DYNAMIC_STRING_EVENT_TYPE
:
192 StringSize
= AsciiStrSize (Token
);
193 } else if (Module
!= NULL
) {
194 StringSize
= AsciiStrSize (Module
);
196 StringSize
= STRING_SIZE
;
198 RecordInfo
->RecordSize
= (UINT8
)(sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD
) + StringSize
);
203 // Other type is unsupported in PEI phase yet, return EFI_UNSUPPORTED
205 return EFI_UNSUPPORTED
;
208 RecordInfo
->Type
= RecordType
;
213 Convert PEI performance log to FPDT String boot record.
215 @param IsStart TRUE if the performance log is start log.
216 @param Handle Pointer to environment specific context used
217 to identify the component being measured.
218 @param Token Pointer to a Null-terminated ASCII string
219 that identifies the component being measured.
220 @param Module Pointer to a Null-terminated ASCII string
221 that identifies the module being measured.
222 @param Ticker 64-bit time stamp.
223 @param Identifier 32-bit identifier. If the value is 0, the created record
224 is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.
226 @retval EFI_SUCCESS Add FPDT boot record.
227 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
228 @retval EFI_UNSUPPORTED No matched FPDT record.
232 InsertPeiFpdtMeasurement (
234 IN CONST VOID
*Handle
, OPTIONAL
235 IN CONST CHAR8
*Token
, OPTIONAL
236 IN CONST CHAR8
*Module
, OPTIONAL
241 EFI_HOB_GUID_TYPE
*GuidHob
;
242 UINTN PeiPerformanceSize
;
243 UINT8
*PeiFirmwarePerformance
;
244 FPDT_PEI_EXT_PERF_HEADER
*PeiPerformanceLogHeader
;
245 FPDT_RECORD_PTR FpdtRecordPtr
;
246 FPDT_BASIC_RECORD_INFO RecordInfo
;
247 CONST VOID
*ModuleGuid
;
250 CONST CHAR8
*StringPtr
;
252 UINT16 PeiPerformanceLogEntries
;
256 FpdtRecordPtr
.RecordHeader
= NULL
;
257 PeiPerformanceLogHeader
= NULL
;
260 // Get record info (type, size, ProgressID and Module Guid).
262 Status
= GetFpdtRecordInfo (IsStart
, Handle
, Token
, Module
, &RecordInfo
);
263 if (EFI_ERROR (Status
)) {
268 // If PERF_START()/PERF_END() have specified the ProgressID,it has high priority.
269 // !!! Note: If the Pref is not the known Token used in the core but have same
270 // ID with the core Token, this case will not be supported.
271 // And in currtnt usage mode, for the unkown ID, there is a general rule:
272 // If it is start pref: the lower 4 bits of the ID should be 0.
273 // If it is end pref: the lower 4 bits of the ID should not be 0.
274 // If input ID doesn't follow the rule, we will adjust it.
276 if ((Identifier
!= 0) && (IsKnownID (Identifier
)) && (!IsKnownTokens (Token
))) {
277 return EFI_UNSUPPORTED
;
278 } else if ((Identifier
!= 0) && (!IsKnownID (Identifier
)) && (!IsKnownTokens (Token
))) {
279 if (IsStart
&& ((Identifier
& 0x000F) != 0)) {
280 Identifier
&= 0xFFF0;
281 } else if ((!IsStart
) && ((Identifier
& 0x000F) == 0)) {
284 RecordInfo
.ProgressID
= (UINT16
)Identifier
;
288 // Get the number of PeiPerformanceLogEntries form PCD.
290 PeiPerformanceLogEntries
= (UINT16
) (PcdGet16 (PcdMaxPeiPerformanceLogEntries16
) != 0 ?
291 PcdGet16 (PcdMaxPeiPerformanceLogEntries16
) :
292 PcdGet8 (PcdMaxPeiPerformanceLogEntries
));
295 // Create GUID HOB Data.
297 GuidHob
= GetFirstGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid
);
298 PeiFirmwarePerformance
= NULL
;
299 while (GuidHob
!= NULL
) {
301 // PEI Performance HOB was found, then return the existing one.
303 PeiFirmwarePerformance
= (UINT8
*)GET_GUID_HOB_DATA (GuidHob
);
304 PeiPerformanceLogHeader
= (FPDT_PEI_EXT_PERF_HEADER
*)PeiFirmwarePerformance
;
305 if (!PeiPerformanceLogHeader
->HobIsFull
&& PeiPerformanceLogHeader
->SizeOfAllEntries
+ RecordInfo
.RecordSize
> PeiPerformanceLogEntries
* MAX_RECORD_SIZE
) {
306 PeiPerformanceLogHeader
->HobIsFull
= TRUE
;
308 if (!PeiPerformanceLogHeader
->HobIsFull
&& PeiPerformanceLogHeader
->SizeOfAllEntries
+ RecordInfo
.RecordSize
<= PeiPerformanceLogEntries
* MAX_RECORD_SIZE
) {
309 FpdtRecordPtr
.RecordHeader
= (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER
*)(PeiFirmwarePerformance
+ sizeof (FPDT_PEI_EXT_PERF_HEADER
) + PeiPerformanceLogHeader
->SizeOfAllEntries
);
313 // Previous HOB is used, then find next one.
315 GuidHob
= GetNextGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid
, GET_NEXT_HOB (GuidHob
));
318 if (GuidHob
== NULL
) {
320 // PEI Performance HOB was not found, then build one.
322 PeiPerformanceSize
= sizeof (FPDT_PEI_EXT_PERF_HEADER
) +
323 MAX_RECORD_SIZE
* PeiPerformanceLogEntries
;
324 PeiFirmwarePerformance
= (UINT8
*)BuildGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid
, PeiPerformanceSize
);
325 if (PeiFirmwarePerformance
!= NULL
) {
326 ZeroMem (PeiFirmwarePerformance
, PeiPerformanceSize
);
328 PeiPerformanceLogHeader
= (FPDT_PEI_EXT_PERF_HEADER
*)PeiFirmwarePerformance
;
329 FpdtRecordPtr
.RecordHeader
= (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER
*)(PeiFirmwarePerformance
+ sizeof (FPDT_PEI_EXT_PERF_HEADER
));
332 if (PeiFirmwarePerformance
== NULL
) {
334 // there is no enough resource to store performance data
336 return EFI_OUT_OF_RESOURCES
;
340 // Get the TimeStamp.
343 Ticker
= GetPerformanceCounter ();
344 TimeStamp
= GetTimeInNanoSecond (Ticker
);
345 } else if (Ticker
== 1) {
348 TimeStamp
= GetTimeInNanoSecond (Ticker
);
352 // Get the ModuleGuid.
354 if (Handle
!= NULL
) {
357 ModuleGuid
= &gEfiCallerIdGuid
;
360 switch (RecordInfo
.Type
) {
361 case FPDT_GUID_EVENT_TYPE
:
362 FpdtRecordPtr
.GuidEvent
->Header
.Type
= FPDT_GUID_EVENT_TYPE
;
363 FpdtRecordPtr
.GuidEvent
->Header
.Length
= RecordInfo
.RecordSize
;;
364 FpdtRecordPtr
.GuidEvent
->Header
.Revision
= FPDT_RECORD_REVISION_1
;
365 FpdtRecordPtr
.GuidEvent
->ProgressID
= RecordInfo
.ProgressID
;
366 FpdtRecordPtr
.GuidEvent
->Timestamp
= TimeStamp
;
367 CopyMem (&FpdtRecordPtr
.GuidEvent
->Guid
, ModuleGuid
, sizeof (EFI_GUID
));
368 PeiPerformanceLogHeader
->SizeOfAllEntries
+= RecordInfo
.RecordSize
;
371 case FPDT_GUID_QWORD_EVENT_TYPE
:
372 FpdtRecordPtr
.GuidQwordEvent
->Header
.Type
= FPDT_GUID_QWORD_EVENT_TYPE
;
373 FpdtRecordPtr
.GuidQwordEvent
->Header
.Length
= RecordInfo
.RecordSize
;;
374 FpdtRecordPtr
.GuidQwordEvent
->Header
.Revision
= FPDT_RECORD_REVISION_1
;
375 FpdtRecordPtr
.GuidQwordEvent
->ProgressID
= RecordInfo
.ProgressID
;
376 FpdtRecordPtr
.GuidQwordEvent
->Timestamp
= TimeStamp
;
377 PeiPerformanceLogHeader
->LoadImageCount
++;
378 FpdtRecordPtr
.GuidQwordEvent
->Qword
= PeiPerformanceLogHeader
->LoadImageCount
;
379 CopyMem (&FpdtRecordPtr
.GuidQwordEvent
->Guid
, ModuleGuid
, sizeof (EFI_GUID
));
380 PeiPerformanceLogHeader
->SizeOfAllEntries
+= RecordInfo
.RecordSize
;
383 case FPDT_DYNAMIC_STRING_EVENT_TYPE
:
384 FpdtRecordPtr
.DynamicStringEvent
->Header
.Type
= FPDT_DYNAMIC_STRING_EVENT_TYPE
;
385 FpdtRecordPtr
.DynamicStringEvent
->Header
.Length
= RecordInfo
.RecordSize
;
386 FpdtRecordPtr
.DynamicStringEvent
->Header
.Revision
= FPDT_RECORD_REVISION_1
;
387 FpdtRecordPtr
.DynamicStringEvent
->ProgressID
= RecordInfo
.ProgressID
;
388 FpdtRecordPtr
.DynamicStringEvent
->Timestamp
= TimeStamp
;
389 CopyMem (&FpdtRecordPtr
.DynamicStringEvent
->Guid
, ModuleGuid
, sizeof (EFI_GUID
));
390 PeiPerformanceLogHeader
->SizeOfAllEntries
+= RecordInfo
.RecordSize
;
394 } else if (Module
!= NULL
) {
397 if (StringPtr
!= NULL
&& AsciiStrLen (StringPtr
) != 0) {
398 DestMax
= (RecordInfo
.RecordSize
- sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD
)) / sizeof (CHAR8
);
399 StrLength
= AsciiStrLen (StringPtr
);
400 if (StrLength
>= DestMax
) {
401 StrLength
= DestMax
-1;
403 AsciiStrnCpyS (FpdtRecordPtr
.DynamicStringEvent
->String
, DestMax
, StringPtr
, StrLength
);
405 AsciiStrCpyS (FpdtRecordPtr
.DynamicStringEvent
->String
, FPDT_STRING_EVENT_RECORD_NAME_LENGTH
, "unknown name");
411 // Record is not supported in current PEI phase, return EFI_ABORTED
413 return EFI_UNSUPPORTED
;
420 Creates a record for the beginning of a performance measurement.
422 If TimeStamp is zero, then this function reads the current time stamp
423 and adds that time stamp value to the record as the start time.
425 If TimeStamp is one, then this function reads 0 as the start time.
427 If TimeStamp is other value, then TimeStamp is added to the record as the start time.
429 @param Handle Pointer to environment specific context used
430 to identify the component being measured.
431 @param Token Pointer to a Null-terminated ASCII string
432 that identifies the component being measured.
433 @param Module Pointer to a Null-terminated ASCII string
434 that identifies the module being measured.
435 @param TimeStamp 64-bit time stamp.
436 @param Identifier 32-bit identifier. If the value is 0, the created record
437 is same as the one created by StartPerformanceMeasurement.
439 @retval RETURN_SUCCESS The start of the measurement was recorded.
440 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
445 StartPerformanceMeasurementEx (
446 IN CONST VOID
*Handle
, OPTIONAL
447 IN CONST CHAR8
*Token
, OPTIONAL
448 IN CONST CHAR8
*Module
, OPTIONAL
453 return InsertPeiFpdtMeasurement (TRUE
, Handle
, Token
, Module
, TimeStamp
, Identifier
);
458 Creates a record for the end of a performance measurement.
460 If the TimeStamp is not zero or one, then TimeStamp is added to the record as the end time.
461 If the TimeStamp is zero, then this function reads the current time stamp and adds that time stamp value to the record as the end time.
462 If the TimeStamp is one, then this function reads 0 as the end time.
464 @param Handle Pointer to environment specific context used
465 to identify the component being measured.
466 @param Token Pointer to a Null-terminated ASCII string
467 that identifies the component being measured.
468 @param Module Pointer to a Null-terminated ASCII string
469 that identifies the module being measured.
470 @param TimeStamp 64-bit time stamp.
471 @param Identifier 32-bit identifier. If the value is 0, the found record
472 is same as the one found by EndPerformanceMeasurement.
474 @retval RETURN_SUCCESS The end of the measurement was recorded.
475 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
480 EndPerformanceMeasurementEx (
481 IN CONST VOID
*Handle
, OPTIONAL
482 IN CONST CHAR8
*Token
, OPTIONAL
483 IN CONST CHAR8
*Module
, OPTIONAL
488 return InsertPeiFpdtMeasurement (FALSE
, Handle
, Token
, Module
, TimeStamp
, Identifier
);
492 Attempts to retrieve a performance measurement log entry from the performance measurement log.
493 It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement,
494 and then assign the Identifier with 0.
496 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
497 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
498 and the key for the second entry in the log is returned. If the performance log is empty,
499 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
500 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
501 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
502 retrieved and an implementation specific non-zero key value that specifies the end of the performance
503 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
504 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
505 the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier.
506 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
507 If Handle is NULL, then ASSERT().
508 If Token is NULL, then ASSERT().
509 If Module is NULL, then ASSERT().
510 If StartTimeStamp is NULL, then ASSERT().
511 If EndTimeStamp is NULL, then ASSERT().
512 If Identifier is NULL, then ASSERT().
514 !!!NOT Support yet!!!
516 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
517 0, then the first performance measurement log entry is retrieved.
518 On exit, the key of the next performance of entry entry.
519 @param Handle Pointer to environment specific context used to identify the component
521 @param Token Pointer to a Null-terminated ASCII string that identifies the component
523 @param Module Pointer to a Null-terminated ASCII string that identifies the module
525 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
527 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
529 @param Identifier Pointer to the 32-bit identifier that was recorded.
531 @return The key for the next performance log entry (in general case).
536 GetPerformanceMeasurementEx (
537 IN UINTN LogEntryKey
,
538 OUT CONST VOID
**Handle
,
539 OUT CONST CHAR8
**Token
,
540 OUT CONST CHAR8
**Module
,
541 OUT UINT64
*StartTimeStamp
,
542 OUT UINT64
*EndTimeStamp
,
543 OUT UINT32
*Identifier
550 Creates a record for the beginning of a performance measurement.
552 If TimeStamp is zero, then this function reads the current time stamp
553 and adds that time stamp value to the record as the start time.
555 If TimeStamp is one, then this function reads 0 as the start time.
557 If TimeStamp is other value, then TimeStamp is added to the record as the start time.
560 @param Handle Pointer to environment specific context used
561 to identify the component being measured.
562 @param Token Pointer to a Null-terminated ASCII string
563 that identifies the component being measured.
564 @param Module Pointer to a Null-terminated ASCII string
565 that identifies the module being measured.
566 @param TimeStamp 64-bit time stamp.
568 @retval RETURN_SUCCESS The start of the measurement was recorded.
569 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
574 StartPerformanceMeasurement (
575 IN CONST VOID
*Handle
, OPTIONAL
576 IN CONST CHAR8
*Token
, OPTIONAL
577 IN CONST CHAR8
*Module
, OPTIONAL
581 return InsertPeiFpdtMeasurement (TRUE
, Handle
, Token
, Module
, TimeStamp
, 0);
586 Creates a record for the end of a performance measurement.
588 If the TimeStamp is not zero or one, then TimeStamp is added to the record as the end time.
589 If the TimeStamp is zero, then this function reads the current time stamp and adds that time stamp value to the record as the end time.
590 If the TimeStamp is one, then this function reads 0 as the end time.
592 @param Handle Pointer to environment specific context used
593 to identify the component being measured.
594 @param Token Pointer to a Null-terminated ASCII string
595 that identifies the component being measured.
596 @param Module Pointer to a Null-terminated ASCII string
597 that identifies the module being measured.
598 @param TimeStamp 64-bit time stamp.
600 @retval RETURN_SUCCESS The end of the measurement was recorded.
601 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
606 EndPerformanceMeasurement (
607 IN CONST VOID
*Handle
, OPTIONAL
608 IN CONST CHAR8
*Token
, OPTIONAL
609 IN CONST CHAR8
*Module
, OPTIONAL
613 return InsertPeiFpdtMeasurement (FALSE
, Handle
, Token
, Module
, TimeStamp
, 0);
617 Attempts to retrieve a performance measurement log entry from the performance measurement log.
618 It can also retrieve the log created by StartPerformanceMeasurementEx and EndPerformanceMeasurementEx,
619 and then eliminate the Identifier.
621 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
622 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
623 and the key for the second entry in the log is returned. If the performance log is empty,
624 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
625 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
626 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
627 retrieved and an implementation specific non-zero key value that specifies the end of the performance
628 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
629 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
630 the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
631 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
632 If Handle is NULL, then ASSERT().
633 If Token is NULL, then ASSERT().
634 If Module is NULL, then ASSERT().
635 If StartTimeStamp is NULL, then ASSERT().
636 If EndTimeStamp is NULL, then ASSERT().
640 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
641 0, then the first performance measurement log entry is retrieved.
642 On exit, the key of the next performance of entry entry.
643 @param Handle Pointer to environment specific context used to identify the component
645 @param Token Pointer to a Null-terminated ASCII string that identifies the component
647 @param Module Pointer to a Null-terminated ASCII string that identifies the module
649 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
651 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
654 @return The key for the next performance log entry (in general case).
659 GetPerformanceMeasurement (
660 IN UINTN LogEntryKey
,
661 OUT CONST VOID
**Handle
,
662 OUT CONST CHAR8
**Token
,
663 OUT CONST CHAR8
**Module
,
664 OUT UINT64
*StartTimeStamp
,
665 OUT UINT64
*EndTimeStamp
672 Returns TRUE if the performance measurement macros are enabled.
674 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
675 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
677 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
678 PcdPerformanceLibraryPropertyMask is set.
679 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
680 PcdPerformanceLibraryPropertyMask is clear.
685 PerformanceMeasurementEnabled (
689 return (BOOLEAN
) ((PcdGet8(PcdPerformanceLibraryPropertyMask
) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED
) != 0);