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.
56 if (AsciiStrCmp (Token
, SEC_TOK
) == 0 ||
57 AsciiStrCmp (Token
, PEI_TOK
) == 0 ||
58 AsciiStrCmp (Token
, DXE_TOK
) == 0 ||
59 AsciiStrCmp (Token
, BDS_TOK
) == 0 ||
60 AsciiStrCmp (Token
, DRIVERBINDING_START_TOK
) == 0 ||
61 AsciiStrCmp (Token
, DRIVERBINDING_SUPPORT_TOK
) == 0 ||
62 AsciiStrCmp (Token
, DRIVERBINDING_STOP_TOK
) == 0 ||
63 AsciiStrCmp (Token
, LOAD_IMAGE_TOK
) == 0 ||
64 AsciiStrCmp (Token
, START_IMAGE_TOK
) == 0 ||
65 AsciiStrCmp (Token
, PEIM_TOK
) == 0) {
73 Check whether the ID is a known one which map to the known Token.
75 @param Identifier 32-bit identifier.
77 @retval TRUE Is a known one used by core.
78 @retval FALSE Not a known one.
86 if (Identifier
== MODULE_START_ID
||
87 Identifier
== MODULE_END_ID
||
88 Identifier
== MODULE_LOADIMAGE_START_ID
||
89 Identifier
== MODULE_LOADIMAGE_END_ID
||
90 Identifier
== MODULE_DB_START_ID
||
91 Identifier
== MODULE_DB_END_ID
||
92 Identifier
== MODULE_DB_SUPPORT_START_ID
||
93 Identifier
== MODULE_DB_SUPPORT_END_ID
||
94 Identifier
== MODULE_DB_STOP_START_ID
||
95 Identifier
== MODULE_DB_STOP_END_ID
) {
103 Get the FPDT record info.
105 @param IsStart TRUE if the performance log is start log.
106 @param Handle Pointer to environment specific context used
107 to identify the component being measured.
108 @param Token Pointer to a Null-terminated ASCII string
109 that identifies the component being measured.
110 @param Module Pointer to a Null-terminated ASCII string
111 that identifies the module being measured.
112 @param RecordInfo On return, pointer to the info of the record.
114 @retval EFI_SUCCESS Get record info successfully.
115 @retval EFI_UNSUPPORTED No matched FPDT record.
121 IN CONST VOID
*Handle
,
122 IN CONST CHAR8
*Token
,
123 IN CONST CHAR8
*Module
,
124 OUT FPDT_BASIC_RECORD_INFO
*RecordInfo
130 RecordType
= FPDT_DYNAMIC_STRING_EVENT_TYPE
;
133 // Get the ProgressID based on the Token.
134 // When PcdEdkiiFpdtStringRecordEnableOnly is TRUE, all records are with type of FPDT_DYNAMIC_STRING_EVENT_TYPE.
137 if (AsciiStrCmp (Token
, LOAD_IMAGE_TOK
) == 0) { // "LoadImage:"
139 RecordInfo
->ProgressID
= MODULE_LOADIMAGE_START_ID
;
141 RecordInfo
->ProgressID
= MODULE_LOADIMAGE_END_ID
;
143 if(!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly
)) {
144 RecordType
= FPDT_GUID_QWORD_EVENT_TYPE
;
146 } else if (AsciiStrCmp (Token
, SEC_TOK
) == 0 || // "SEC"
147 AsciiStrCmp (Token
, PEI_TOK
) == 0) { // "PEI"
149 RecordInfo
->ProgressID
= PERF_CROSSMODULE_START_ID
;
151 RecordInfo
->ProgressID
= PERF_CROSSMODULE_END_ID
;
153 } else if (AsciiStrCmp (Token
, PEIM_TOK
) == 0) { // "PEIM"
155 RecordInfo
->ProgressID
= MODULE_START_ID
;
157 RecordInfo
->ProgressID
= MODULE_END_ID
;
159 if(!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly
)) {
160 RecordType
= FPDT_GUID_EVENT_TYPE
;
162 } else { //Pref used in Modules.
164 RecordInfo
->ProgressID
= PERF_INMODULE_START_ID
;
166 RecordInfo
->ProgressID
= PERF_INMODULE_END_ID
;
169 } else if (Module
!= NULL
|| Handle
!= NULL
) { //Pref used in Modules.
171 RecordInfo
->ProgressID
= PERF_INMODULE_START_ID
;
173 RecordInfo
->ProgressID
= PERF_INMODULE_END_ID
;
176 return EFI_UNSUPPORTED
;
180 // Get the Guid and string.
182 if(PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly
)) {
183 RecordInfo
->RecordSize
= sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD
) + STRING_SIZE
;
185 switch (RecordType
) {
186 case FPDT_GUID_EVENT_TYPE
:
187 RecordInfo
->RecordSize
= sizeof (FPDT_GUID_EVENT_RECORD
);
190 case FPDT_GUID_QWORD_EVENT_TYPE
:
191 RecordInfo
->RecordSize
= sizeof (FPDT_GUID_QWORD_EVENT_RECORD
);
194 case FPDT_DYNAMIC_STRING_EVENT_TYPE
:
196 StringSize
= AsciiStrSize (Token
);
197 } else if (Module
!= NULL
) {
198 StringSize
= AsciiStrSize (Module
);
200 StringSize
= STRING_SIZE
;
202 RecordInfo
->RecordSize
= (UINT8
)(sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD
) + StringSize
);
207 // Other type is unsupported in PEI phase yet, return EFI_UNSUPPORTED
209 return EFI_UNSUPPORTED
;
212 RecordInfo
->Type
= RecordType
;
217 Convert PEI performance log to FPDT String boot record.
219 @param IsStart TRUE if the performance log is start log.
220 @param Handle Pointer to environment specific context used
221 to identify the component being measured.
222 @param Token Pointer to a Null-terminated ASCII string
223 that identifies the component being measured.
224 @param Module Pointer to a Null-terminated ASCII string
225 that identifies the module being measured.
226 @param Ticker 64-bit time stamp.
227 @param Identifier 32-bit identifier. If the value is 0, the created record
228 is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.
230 @retval EFI_SUCCESS Add FPDT boot record.
231 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
232 @retval EFI_UNSUPPORTED No matched FPDT record.
236 InsertPeiFpdtMeasurement (
238 IN CONST VOID
*Handle
, OPTIONAL
239 IN CONST CHAR8
*Token
, OPTIONAL
240 IN CONST CHAR8
*Module
, OPTIONAL
245 EFI_HOB_GUID_TYPE
*GuidHob
;
246 UINTN PeiPerformanceSize
;
247 UINT8
*PeiFirmwarePerformance
;
248 FPDT_PEI_EXT_PERF_HEADER
*PeiPerformanceLogHeader
;
249 FPDT_RECORD_PTR FpdtRecordPtr
;
250 FPDT_BASIC_RECORD_INFO RecordInfo
;
251 CONST VOID
*ModuleGuid
;
254 CONST CHAR8
*StringPtr
;
256 UINT16 PeiPerformanceLogEntries
;
260 FpdtRecordPtr
.RecordHeader
= NULL
;
261 PeiPerformanceLogHeader
= NULL
;
264 // Get record info (type, size, ProgressID and Module Guid).
266 Status
= GetFpdtRecordInfo (IsStart
, Handle
, Token
, Module
, &RecordInfo
);
267 if (EFI_ERROR (Status
)) {
272 // If PERF_START()/PERF_END() have specified the ProgressID,it has high priority.
273 // !!! Note: If the Perf is not the known Token used in the core but have same
274 // ID with the core Token, this case will not be supported.
275 // And in currtnt usage mode, for the unkown ID, there is a general rule:
276 // If it is start pref: the lower 4 bits of the ID should be 0.
277 // If it is end pref: the lower 4 bits of the ID should not be 0.
278 // If input ID doesn't follow the rule, we will adjust it.
280 if ((Identifier
!= 0) && (IsKnownID (Identifier
)) && (!IsKnownTokens (Token
))) {
281 return EFI_UNSUPPORTED
;
282 } else if ((Identifier
!= 0) && (!IsKnownID (Identifier
)) && (!IsKnownTokens (Token
))) {
283 if (IsStart
&& ((Identifier
& 0x000F) != 0)) {
284 Identifier
&= 0xFFF0;
285 } else if ((!IsStart
) && ((Identifier
& 0x000F) == 0)) {
288 RecordInfo
.ProgressID
= (UINT16
)Identifier
;
292 // Get the number of PeiPerformanceLogEntries form PCD.
294 PeiPerformanceLogEntries
= (UINT16
) (PcdGet16 (PcdMaxPeiPerformanceLogEntries16
) != 0 ?
295 PcdGet16 (PcdMaxPeiPerformanceLogEntries16
) :
296 PcdGet8 (PcdMaxPeiPerformanceLogEntries
));
299 // Create GUID HOB Data.
301 GuidHob
= GetFirstGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid
);
302 PeiFirmwarePerformance
= NULL
;
303 while (GuidHob
!= NULL
) {
305 // PEI Performance HOB was found, then return the existing one.
307 PeiFirmwarePerformance
= (UINT8
*)GET_GUID_HOB_DATA (GuidHob
);
308 PeiPerformanceLogHeader
= (FPDT_PEI_EXT_PERF_HEADER
*)PeiFirmwarePerformance
;
309 if (!PeiPerformanceLogHeader
->HobIsFull
&& PeiPerformanceLogHeader
->SizeOfAllEntries
+ RecordInfo
.RecordSize
> PeiPerformanceLogEntries
* MAX_RECORD_SIZE
) {
310 PeiPerformanceLogHeader
->HobIsFull
= TRUE
;
312 if (!PeiPerformanceLogHeader
->HobIsFull
&& PeiPerformanceLogHeader
->SizeOfAllEntries
+ RecordInfo
.RecordSize
<= PeiPerformanceLogEntries
* MAX_RECORD_SIZE
) {
313 FpdtRecordPtr
.RecordHeader
= (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER
*)(PeiFirmwarePerformance
+ sizeof (FPDT_PEI_EXT_PERF_HEADER
) + PeiPerformanceLogHeader
->SizeOfAllEntries
);
317 // Previous HOB is used, then find next one.
319 GuidHob
= GetNextGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid
, GET_NEXT_HOB (GuidHob
));
322 if (GuidHob
== NULL
) {
324 // PEI Performance HOB was not found, then build one.
326 PeiPerformanceSize
= sizeof (FPDT_PEI_EXT_PERF_HEADER
) +
327 MAX_RECORD_SIZE
* PeiPerformanceLogEntries
;
328 PeiFirmwarePerformance
= (UINT8
*)BuildGuidHob (&gEdkiiFpdtExtendedFirmwarePerformanceGuid
, PeiPerformanceSize
);
329 if (PeiFirmwarePerformance
!= NULL
) {
330 ZeroMem (PeiFirmwarePerformance
, PeiPerformanceSize
);
332 PeiPerformanceLogHeader
= (FPDT_PEI_EXT_PERF_HEADER
*)PeiFirmwarePerformance
;
333 FpdtRecordPtr
.RecordHeader
= (EFI_ACPI_5_0_FPDT_PERFORMANCE_RECORD_HEADER
*)(PeiFirmwarePerformance
+ sizeof (FPDT_PEI_EXT_PERF_HEADER
));
336 if (PeiFirmwarePerformance
== NULL
) {
338 // there is no enough resource to store performance data
340 return EFI_OUT_OF_RESOURCES
;
344 // Get the TimeStamp.
347 Ticker
= GetPerformanceCounter ();
348 TimeStamp
= GetTimeInNanoSecond (Ticker
);
349 } else if (Ticker
== 1) {
352 TimeStamp
= GetTimeInNanoSecond (Ticker
);
356 // Get the ModuleGuid.
358 if (Handle
!= NULL
) {
361 ModuleGuid
= &gEfiCallerIdGuid
;
364 switch (RecordInfo
.Type
) {
365 case FPDT_GUID_EVENT_TYPE
:
366 FpdtRecordPtr
.GuidEvent
->Header
.Type
= FPDT_GUID_EVENT_TYPE
;
367 FpdtRecordPtr
.GuidEvent
->Header
.Length
= RecordInfo
.RecordSize
;;
368 FpdtRecordPtr
.GuidEvent
->Header
.Revision
= FPDT_RECORD_REVISION_1
;
369 FpdtRecordPtr
.GuidEvent
->ProgressID
= RecordInfo
.ProgressID
;
370 FpdtRecordPtr
.GuidEvent
->Timestamp
= TimeStamp
;
371 CopyMem (&FpdtRecordPtr
.GuidEvent
->Guid
, ModuleGuid
, sizeof (EFI_GUID
));
372 PeiPerformanceLogHeader
->SizeOfAllEntries
+= RecordInfo
.RecordSize
;
375 case FPDT_GUID_QWORD_EVENT_TYPE
:
376 FpdtRecordPtr
.GuidQwordEvent
->Header
.Type
= FPDT_GUID_QWORD_EVENT_TYPE
;
377 FpdtRecordPtr
.GuidQwordEvent
->Header
.Length
= RecordInfo
.RecordSize
;;
378 FpdtRecordPtr
.GuidQwordEvent
->Header
.Revision
= FPDT_RECORD_REVISION_1
;
379 FpdtRecordPtr
.GuidQwordEvent
->ProgressID
= RecordInfo
.ProgressID
;
380 FpdtRecordPtr
.GuidQwordEvent
->Timestamp
= TimeStamp
;
381 PeiPerformanceLogHeader
->LoadImageCount
++;
382 FpdtRecordPtr
.GuidQwordEvent
->Qword
= PeiPerformanceLogHeader
->LoadImageCount
;
383 CopyMem (&FpdtRecordPtr
.GuidQwordEvent
->Guid
, ModuleGuid
, sizeof (EFI_GUID
));
384 PeiPerformanceLogHeader
->SizeOfAllEntries
+= RecordInfo
.RecordSize
;
387 case FPDT_DYNAMIC_STRING_EVENT_TYPE
:
388 FpdtRecordPtr
.DynamicStringEvent
->Header
.Type
= FPDT_DYNAMIC_STRING_EVENT_TYPE
;
389 FpdtRecordPtr
.DynamicStringEvent
->Header
.Length
= RecordInfo
.RecordSize
;
390 FpdtRecordPtr
.DynamicStringEvent
->Header
.Revision
= FPDT_RECORD_REVISION_1
;
391 FpdtRecordPtr
.DynamicStringEvent
->ProgressID
= RecordInfo
.ProgressID
;
392 FpdtRecordPtr
.DynamicStringEvent
->Timestamp
= TimeStamp
;
393 CopyMem (&FpdtRecordPtr
.DynamicStringEvent
->Guid
, ModuleGuid
, sizeof (EFI_GUID
));
394 PeiPerformanceLogHeader
->SizeOfAllEntries
+= RecordInfo
.RecordSize
;
398 } else if (Module
!= NULL
) {
401 if (StringPtr
!= NULL
&& AsciiStrLen (StringPtr
) != 0) {
402 DestMax
= (RecordInfo
.RecordSize
- sizeof (FPDT_DYNAMIC_STRING_EVENT_RECORD
)) / sizeof (CHAR8
);
403 StrLength
= AsciiStrLen (StringPtr
);
404 if (StrLength
>= DestMax
) {
405 StrLength
= DestMax
-1;
407 AsciiStrnCpyS (FpdtRecordPtr
.DynamicStringEvent
->String
, DestMax
, StringPtr
, StrLength
);
409 AsciiStrCpyS (FpdtRecordPtr
.DynamicStringEvent
->String
, FPDT_STRING_EVENT_RECORD_NAME_LENGTH
, "unknown name");
415 // Record is not supported in current PEI phase, return EFI_ABORTED
417 return EFI_UNSUPPORTED
;
424 Creates a record for the beginning of a performance measurement.
426 If TimeStamp is zero, then this function reads the current time stamp
427 and adds that time stamp value to the record as the start time.
429 If TimeStamp is one, then this function reads 0 as the start time.
431 If TimeStamp is other value, then TimeStamp is added to the record as the start time.
433 @param Handle Pointer to environment specific context used
434 to identify the component being measured.
435 @param Token Pointer to a Null-terminated ASCII string
436 that identifies the component being measured.
437 @param Module Pointer to a Null-terminated ASCII string
438 that identifies the module being measured.
439 @param TimeStamp 64-bit time stamp.
440 @param Identifier 32-bit identifier. If the value is 0, the created record
441 is same as the one created by StartPerformanceMeasurement.
443 @retval RETURN_SUCCESS The start of the measurement was recorded.
444 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
449 StartPerformanceMeasurementEx (
450 IN CONST VOID
*Handle
, OPTIONAL
451 IN CONST CHAR8
*Token
, OPTIONAL
452 IN CONST CHAR8
*Module
, OPTIONAL
457 return InsertPeiFpdtMeasurement (TRUE
, Handle
, Token
, Module
, TimeStamp
, Identifier
);
462 Creates a record for the end of a performance measurement.
464 If the TimeStamp is not zero or one, then TimeStamp is added to the record as the end time.
465 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.
466 If the TimeStamp is one, then this function reads 0 as the end time.
468 @param Handle Pointer to environment specific context used
469 to identify the component being measured.
470 @param Token Pointer to a Null-terminated ASCII string
471 that identifies the component being measured.
472 @param Module Pointer to a Null-terminated ASCII string
473 that identifies the module being measured.
474 @param TimeStamp 64-bit time stamp.
475 @param Identifier 32-bit identifier. If the value is 0, the found record
476 is same as the one found by EndPerformanceMeasurement.
478 @retval RETURN_SUCCESS The end of the measurement was recorded.
479 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
484 EndPerformanceMeasurementEx (
485 IN CONST VOID
*Handle
, OPTIONAL
486 IN CONST CHAR8
*Token
, OPTIONAL
487 IN CONST CHAR8
*Module
, OPTIONAL
492 return InsertPeiFpdtMeasurement (FALSE
, Handle
, Token
, Module
, TimeStamp
, Identifier
);
496 Attempts to retrieve a performance measurement log entry from the performance measurement log.
497 It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement,
498 and then assign the Identifier with 0.
500 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
501 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
502 and the key for the second entry in the log is returned. If the performance log is empty,
503 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
504 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
505 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
506 retrieved and an implementation specific non-zero key value that specifies the end of the performance
507 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
508 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
509 the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier.
510 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
511 If Handle is NULL, then ASSERT().
512 If Token is NULL, then ASSERT().
513 If Module is NULL, then ASSERT().
514 If StartTimeStamp is NULL, then ASSERT().
515 If EndTimeStamp is NULL, then ASSERT().
516 If Identifier is NULL, then ASSERT().
518 !!!NOT Support yet!!!
520 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
521 0, then the first performance measurement log entry is retrieved.
522 On exit, the key of the next performance of entry entry.
523 @param Handle Pointer to environment specific context used to identify the component
525 @param Token Pointer to a Null-terminated ASCII string that identifies the component
527 @param Module Pointer to a Null-terminated ASCII string that identifies the module
529 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
531 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
533 @param Identifier Pointer to the 32-bit identifier that was recorded.
535 @return The key for the next performance log entry (in general case).
540 GetPerformanceMeasurementEx (
541 IN UINTN LogEntryKey
,
542 OUT CONST VOID
**Handle
,
543 OUT CONST CHAR8
**Token
,
544 OUT CONST CHAR8
**Module
,
545 OUT UINT64
*StartTimeStamp
,
546 OUT UINT64
*EndTimeStamp
,
547 OUT UINT32
*Identifier
554 Creates a record for the beginning of a performance measurement.
556 If TimeStamp is zero, then this function reads the current time stamp
557 and adds that time stamp value to the record as the start time.
559 If TimeStamp is one, then this function reads 0 as the start time.
561 If TimeStamp is other value, then TimeStamp is added to the record as the start time.
564 @param Handle Pointer to environment specific context used
565 to identify the component being measured.
566 @param Token Pointer to a Null-terminated ASCII string
567 that identifies the component being measured.
568 @param Module Pointer to a Null-terminated ASCII string
569 that identifies the module being measured.
570 @param TimeStamp 64-bit time stamp.
572 @retval RETURN_SUCCESS The start of the measurement was recorded.
573 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
578 StartPerformanceMeasurement (
579 IN CONST VOID
*Handle
, OPTIONAL
580 IN CONST CHAR8
*Token
, OPTIONAL
581 IN CONST CHAR8
*Module
, OPTIONAL
585 return InsertPeiFpdtMeasurement (TRUE
, Handle
, Token
, Module
, TimeStamp
, 0);
590 Creates a record for the end of a performance measurement.
592 If the TimeStamp is not zero or one, then TimeStamp is added to the record as the end time.
593 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.
594 If the TimeStamp is one, then this function reads 0 as the end time.
596 @param Handle Pointer to environment specific context used
597 to identify the component being measured.
598 @param Token Pointer to a Null-terminated ASCII string
599 that identifies the component being measured.
600 @param Module Pointer to a Null-terminated ASCII string
601 that identifies the module being measured.
602 @param TimeStamp 64-bit time stamp.
604 @retval RETURN_SUCCESS The end of the measurement was recorded.
605 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
610 EndPerformanceMeasurement (
611 IN CONST VOID
*Handle
, OPTIONAL
612 IN CONST CHAR8
*Token
, OPTIONAL
613 IN CONST CHAR8
*Module
, OPTIONAL
617 return InsertPeiFpdtMeasurement (FALSE
, Handle
, Token
, Module
, TimeStamp
, 0);
621 Attempts to retrieve a performance measurement log entry from the performance measurement log.
622 It can also retrieve the log created by StartPerformanceMeasurementEx and EndPerformanceMeasurementEx,
623 and then eliminate the Identifier.
625 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
626 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
627 and the key for the second entry in the log is returned. If the performance log is empty,
628 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
629 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
630 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
631 retrieved and an implementation specific non-zero key value that specifies the end of the performance
632 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
633 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
634 the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
635 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
636 If Handle is NULL, then ASSERT().
637 If Token is NULL, then ASSERT().
638 If Module is NULL, then ASSERT().
639 If StartTimeStamp is NULL, then ASSERT().
640 If EndTimeStamp is NULL, then ASSERT().
644 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
645 0, then the first performance measurement log entry is retrieved.
646 On exit, the key of the next performance of entry entry.
647 @param Handle Pointer to environment specific context used to identify the component
649 @param Token Pointer to a Null-terminated ASCII string that identifies the component
651 @param Module Pointer to a Null-terminated ASCII string that identifies the module
653 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
655 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
658 @return The key for the next performance log entry (in general case).
663 GetPerformanceMeasurement (
664 IN UINTN LogEntryKey
,
665 OUT CONST VOID
**Handle
,
666 OUT CONST CHAR8
**Token
,
667 OUT CONST CHAR8
**Module
,
668 OUT UINT64
*StartTimeStamp
,
669 OUT UINT64
*EndTimeStamp
676 Returns TRUE if the performance measurement macros are enabled.
678 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
679 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
681 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
682 PcdPerformanceLibraryPropertyMask is set.
683 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
684 PcdPerformanceLibraryPropertyMask is clear.
689 PerformanceMeasurementEnabled (
693 return (BOOLEAN
) ((PcdGet8(PcdPerformanceLibraryPropertyMask
) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED
) != 0);