2 Performance library instance used in DXE phase to dump both PEI/DXE and SMM performance data.
4 This library instance allows a DXE driver or UEFI application to dump both PEI/DXE and SMM performance data.
5 StartPerformanceMeasurement(), EndPerformanceMeasurement(), StartPerformanceMeasurementEx()
6 and EndPerformanceMeasurementEx() are not implemented.
8 Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
9 This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 #include <Guid/Performance.h>
24 #include <Library/PerformanceLib.h>
25 #include <Library/DebugLib.h>
26 #include <Library/UefiBootServicesTableLib.h>
27 #include <Library/UefiRuntimeServicesTableLib.h>
28 #include <Library/PcdLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/BaseLib.h>
31 #include <Library/MemoryAllocationLib.h>
33 #include <Protocol/SmmCommunication.h>
35 #define SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + sizeof (SMM_PERF_COMMUNICATE))
37 EFI_SMM_COMMUNICATION_PROTOCOL
*mSmmCommunication
= NULL
;
38 UINT8 mSmmPerformanceBuffer
[SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE
];
39 GAUGE_DATA_ENTRY
*mGaugeData
= NULL
;
40 UINTN mGaugeNumberOfEntries
= 0;
41 GAUGE_DATA_ENTRY_EX
*mGaugeDataEx
= NULL
;
42 UINTN mGaugeNumberOfEntriesEx
= 0;
44 BOOLEAN mNoSmmPerfHandler
= FALSE
;
45 BOOLEAN mNoSmmPerfExHandler
= FALSE
;
48 // The cached Performance Protocol and PerformanceEx Protocol interface.
50 PERFORMANCE_PROTOCOL
*mPerformance
= NULL
;
51 PERFORMANCE_EX_PROTOCOL
*mPerformanceEx
= NULL
;
54 The function caches the pointer to SMM Communication protocol.
56 The function locates SMM Communication protocol from protocol database.
58 @retval EFI_SUCCESS SMM Communication protocol is successfully located.
59 @retval Other SMM Communication protocol is not located to log performance.
63 GetCommunicationProtocol (
68 EFI_SMM_COMMUNICATION_PROTOCOL
*Communication
;
70 if (mSmmCommunication
!= NULL
) {
74 Status
= gBS
->LocateProtocol (&gEfiSmmCommunicationProtocolGuid
, NULL
, (VOID
**) &Communication
);
75 if (!EFI_ERROR (Status
)) {
76 ASSERT (Communication
!= NULL
);
78 // Cache SMM Communication protocol.
80 mSmmCommunication
= Communication
;
87 The function caches the pointers to PerformanceEx protocol and Performance Protocol.
89 The function locates PerformanceEx protocol and Performance Protocol from protocol database.
91 @retval EFI_SUCCESS PerformanceEx protocol or Performance Protocol is successfully located.
92 @retval EFI_NOT_FOUND Both PerformanceEx protocol and Performance Protocol are not located to log performance.
96 GetPerformanceProtocol (
101 PERFORMANCE_PROTOCOL
*Performance
;
102 PERFORMANCE_EX_PROTOCOL
*PerformanceEx
;
104 if (mPerformanceEx
!= NULL
|| mPerformance
!= NULL
) {
108 Status
= gBS
->LocateProtocol (&gPerformanceExProtocolGuid
, NULL
, (VOID
**) &PerformanceEx
);
109 if (!EFI_ERROR (Status
)) {
110 ASSERT (PerformanceEx
!= NULL
);
112 // Cache PerformanceEx Protocol.
114 mPerformanceEx
= PerformanceEx
;
118 Status
= gBS
->LocateProtocol (&gPerformanceProtocolGuid
, NULL
, (VOID
**) &Performance
);
119 if (!EFI_ERROR (Status
)) {
120 ASSERT (Performance
!= NULL
);
122 // Cache performance protocol.
124 mPerformance
= Performance
;
128 return EFI_NOT_FOUND
;
132 Creates a record for the beginning of a performance measurement.
134 Creates a record that contains the Handle, Token, Module and Identifier.
135 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
136 If TimeStamp is zero, then this function reads the current time stamp
137 and adds that time stamp value to the record as the start time.
139 @param Handle Pointer to environment specific context used
140 to identify the component being measured.
141 @param Token Pointer to a Null-terminated ASCII string
142 that identifies the component being measured.
143 @param Module Pointer to a Null-terminated ASCII string
144 that identifies the module being measured.
145 @param TimeStamp 64-bit time stamp.
146 @param Identifier 32-bit identifier. If the value is 0, the created record
147 is same as the one created by StartPerformanceMeasurement.
149 @retval RETURN_SUCCESS The start of the measurement was recorded.
150 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
155 StartPerformanceMeasurementEx (
156 IN CONST VOID
*Handle
, OPTIONAL
157 IN CONST CHAR8
*Token
, OPTIONAL
158 IN CONST CHAR8
*Module
, OPTIONAL
163 return RETURN_SUCCESS
;
167 Fills in the end time of a performance measurement.
169 Looks up the record that matches Handle, Token and Module.
170 If the record can not be found then return RETURN_NOT_FOUND.
171 If the record is found and TimeStamp is not zero,
172 then TimeStamp is added to the record as the end time.
173 If the record is found and TimeStamp is zero, then this function reads
174 the current time stamp and adds that time stamp value to the record as the end time.
176 @param Handle Pointer to environment specific context used
177 to identify the component being measured.
178 @param Token Pointer to a Null-terminated ASCII string
179 that identifies the component being measured.
180 @param Module Pointer to a Null-terminated ASCII string
181 that identifies the module being measured.
182 @param TimeStamp 64-bit time stamp.
183 @param Identifier 32-bit identifier. If the value is 0, the found record
184 is same as the one found by EndPerformanceMeasurement.
186 @retval RETURN_SUCCESS The end of the measurement was recorded.
187 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
192 EndPerformanceMeasurementEx (
193 IN CONST VOID
*Handle
, OPTIONAL
194 IN CONST CHAR8
*Token
, OPTIONAL
195 IN CONST CHAR8
*Module
, OPTIONAL
200 return RETURN_SUCCESS
;
204 Creates a record for the beginning of a performance measurement.
206 Creates a record that contains the Handle, Token, and Module.
207 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
208 If TimeStamp is zero, then this function reads the current time stamp
209 and adds that time stamp value to the record as the start time.
211 @param Handle Pointer to environment specific context used
212 to identify the component being measured.
213 @param Token Pointer to a Null-terminated ASCII string
214 that identifies the component being measured.
215 @param Module Pointer to a Null-terminated ASCII string
216 that identifies the module being measured.
217 @param TimeStamp 64-bit time stamp.
219 @retval RETURN_SUCCESS The start of the measurement was recorded.
220 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
225 StartPerformanceMeasurement (
226 IN CONST VOID
*Handle
, OPTIONAL
227 IN CONST CHAR8
*Token
, OPTIONAL
228 IN CONST CHAR8
*Module
, OPTIONAL
232 return RETURN_SUCCESS
;
236 Fills in the end time of a performance measurement.
238 Looks up the record that matches Handle, Token, and Module.
239 If the record can not be found then return RETURN_NOT_FOUND.
240 If the record is found and TimeStamp is not zero,
241 then TimeStamp is added to the record as the end time.
242 If the record is found and TimeStamp is zero, then this function reads
243 the current time stamp and adds that time stamp value to the record as the end time.
245 @param Handle Pointer to environment specific context used
246 to identify the component being measured.
247 @param Token Pointer to a Null-terminated ASCII string
248 that identifies the component being measured.
249 @param Module Pointer to a Null-terminated ASCII string
250 that identifies the module being measured.
251 @param TimeStamp 64-bit time stamp.
253 @retval RETURN_SUCCESS The end of the measurement was recorded.
254 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
259 EndPerformanceMeasurement (
260 IN CONST VOID
*Handle
, OPTIONAL
261 IN CONST CHAR8
*Token
, OPTIONAL
262 IN CONST CHAR8
*Module
, OPTIONAL
266 return RETURN_SUCCESS
;
270 Attempts to retrieve a performance measurement log entry from the performance measurement log.
271 It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement,
272 and then assign the Identifier with 0.
274 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
275 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
276 and the key for the second entry in the log is returned. If the performance log is empty,
277 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
278 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
279 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
280 retrieved and an implementation specific non-zero key value that specifies the end of the performance
281 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
282 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
283 the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier.
284 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
285 If Handle is NULL, then ASSERT().
286 If Token is NULL, then ASSERT().
287 If Module is NULL, then ASSERT().
288 If StartTimeStamp is NULL, then ASSERT().
289 If EndTimeStamp is NULL, then ASSERT().
290 If Identifier is NULL, then ASSERT().
292 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
293 0, then the first performance measurement log entry is retrieved.
294 On exit, the key of the next performance log entry.
295 @param Handle Pointer to environment specific context used to identify the component
297 @param Token Pointer to a Null-terminated ASCII string that identifies the component
299 @param Module Pointer to a Null-terminated ASCII string that identifies the module
301 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
303 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
305 @param Identifier Pointer to the 32-bit identifier that was recorded.
307 @return The key for the next performance log entry (in general case).
312 GetByPerformanceProtocol (
313 IN UINTN LogEntryKey
,
314 OUT CONST VOID
**Handle
,
315 OUT CONST CHAR8
**Token
,
316 OUT CONST CHAR8
**Module
,
317 OUT UINT64
*StartTimeStamp
,
318 OUT UINT64
*EndTimeStamp
,
319 OUT UINT32
*Identifier
323 GAUGE_DATA_ENTRY_EX
*GaugeData
;
325 Status
= GetPerformanceProtocol ();
326 if (EFI_ERROR (Status
)) {
330 if (mPerformanceEx
!= NULL
) {
331 Status
= mPerformanceEx
->GetGaugeEx (LogEntryKey
++, &GaugeData
);
332 } else if (mPerformance
!= NULL
) {
333 Status
= mPerformance
->GetGauge (LogEntryKey
++, (GAUGE_DATA_ENTRY
**) &GaugeData
);
340 // Make sure that LogEntryKey is a valid log entry key,
342 ASSERT (Status
!= EFI_INVALID_PARAMETER
);
344 if (EFI_ERROR (Status
)) {
346 // The LogEntryKey is the last entry (equals to the total entry number).
351 ASSERT (GaugeData
!= NULL
);
353 *Handle
= (VOID
*) (UINTN
) GaugeData
->Handle
;
354 *Token
= GaugeData
->Token
;
355 *Module
= GaugeData
->Module
;
356 *StartTimeStamp
= GaugeData
->StartTimeStamp
;
357 *EndTimeStamp
= GaugeData
->EndTimeStamp
;
358 if (mPerformanceEx
!= NULL
) {
359 *Identifier
= GaugeData
->Identifier
;
369 Retrieves all previous logged performance measurement.
370 Function will use SMM communicate protocol to get all previous SMM performance measurement data.
371 If success, data buffer will be returned. If fail function will return NULL.
373 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
374 0, then the first performance measurement log entry is retrieved.
375 On exit, the key of the next performance log entry.
377 @retval !NULL Get all gauge data success.
378 @retval NULL Get all gauge data failed.
387 EFI_SMM_COMMUNICATE_HEADER
*SmmCommBufferHeader
;
388 SMM_PERF_COMMUNICATE
*SmmPerfCommData
;
392 if (mNoSmmPerfHandler
) {
394 // Not try to get the SMM gauge data again
395 // if no SMM Performance handler found.
400 if (LogEntryKey
!= 0) {
401 if (mGaugeData
!= NULL
) {
406 // Reget the SMM gauge data at the first entry get.
408 if (mGaugeData
!= NULL
) {
409 FreePool (mGaugeData
);
411 mGaugeNumberOfEntries
= 0;
415 Status
= GetCommunicationProtocol ();
416 if (EFI_ERROR (Status
)) {
421 // Initialize communicate buffer
423 SmmCommBufferHeader
= (EFI_SMM_COMMUNICATE_HEADER
*)mSmmPerformanceBuffer
;
424 SmmPerfCommData
= (SMM_PERF_COMMUNICATE
*)SmmCommBufferHeader
->Data
;
425 ZeroMem((UINT8
*)SmmPerfCommData
, sizeof(SMM_PERF_COMMUNICATE
));
427 CopyGuid (&SmmCommBufferHeader
->HeaderGuid
, &gSmmPerformanceProtocolGuid
);
428 SmmCommBufferHeader
->MessageLength
= sizeof(SMM_PERF_COMMUNICATE
);
429 CommSize
= SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE
;
432 // Get total number of SMM gauge entries
434 SmmPerfCommData
->Function
= SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER
;
435 Status
= mSmmCommunication
->Communicate (mSmmCommunication
, mSmmPerformanceBuffer
, &CommSize
);
436 if (Status
== EFI_NOT_FOUND
) {
437 mNoSmmPerfHandler
= TRUE
;
439 if (EFI_ERROR (Status
) || EFI_ERROR (SmmPerfCommData
->ReturnStatus
) || SmmPerfCommData
->NumberOfEntries
== 0) {
443 mGaugeNumberOfEntries
= SmmPerfCommData
->NumberOfEntries
;
445 DataSize
= mGaugeNumberOfEntries
* sizeof(GAUGE_DATA_ENTRY
);
446 mGaugeData
= AllocateZeroPool(DataSize
);
447 ASSERT (mGaugeData
!= NULL
);
450 // Get all SMM gauge data
452 SmmPerfCommData
->Function
= SMM_PERF_FUNCTION_GET_GAUGE_DATA
;
453 SmmPerfCommData
->LogEntryKey
= 0;
454 SmmPerfCommData
->NumberOfEntries
= mGaugeNumberOfEntries
;
455 SmmPerfCommData
->GaugeData
= mGaugeData
;
456 Status
= mSmmCommunication
->Communicate (mSmmCommunication
, mSmmPerformanceBuffer
, &CommSize
);
457 if (EFI_ERROR (Status
) || EFI_ERROR (SmmPerfCommData
->ReturnStatus
)) {
458 FreePool (mGaugeData
);
460 mGaugeNumberOfEntries
= 0;
467 Retrieves all previous logged performance measurement.
468 Function will use SMM communicate protocol to get all previous SMM performance measurement data.
469 If success, data buffer will be returned. If fail function will return NULL.
471 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
472 0, then the first performance measurement log entry is retrieved.
473 On exit, the key of the next performance log entry.
475 @retval !NULL Get all gauge data success.
476 @retval NULL Get all gauge data failed.
478 GAUGE_DATA_ENTRY_EX
*
480 GetAllSmmGaugeDataEx (
485 EFI_SMM_COMMUNICATE_HEADER
*SmmCommBufferHeader
;
486 SMM_PERF_COMMUNICATE_EX
*SmmPerfCommData
;
490 if (mNoSmmPerfExHandler
) {
492 // Not try to get the SMM gauge data again
493 // if no SMM PerformanceEx handler found.
498 if (LogEntryKey
!= 0) {
499 if (mGaugeDataEx
!= NULL
) {
504 // Reget the SMM gauge data at the first entry get.
506 if (mGaugeDataEx
!= NULL
) {
507 FreePool (mGaugeDataEx
);
509 mGaugeNumberOfEntriesEx
= 0;
513 Status
= GetCommunicationProtocol ();
514 if (EFI_ERROR (Status
)) {
519 // Initialize communicate buffer
521 SmmCommBufferHeader
= (EFI_SMM_COMMUNICATE_HEADER
*)mSmmPerformanceBuffer
;
522 SmmPerfCommData
= (SMM_PERF_COMMUNICATE_EX
*)SmmCommBufferHeader
->Data
;
523 ZeroMem((UINT8
*)SmmPerfCommData
, sizeof(SMM_PERF_COMMUNICATE_EX
));
525 CopyGuid (&SmmCommBufferHeader
->HeaderGuid
, &gSmmPerformanceExProtocolGuid
);
526 SmmCommBufferHeader
->MessageLength
= sizeof(SMM_PERF_COMMUNICATE_EX
);
527 CommSize
= SMM_PERFORMANCE_COMMUNICATION_BUFFER_SIZE
;
530 // Get total number of SMM gauge entries
532 SmmPerfCommData
->Function
= SMM_PERF_FUNCTION_GET_GAUGE_ENTRY_NUMBER
;
533 Status
= mSmmCommunication
->Communicate (mSmmCommunication
, mSmmPerformanceBuffer
, &CommSize
);
534 if (Status
== EFI_NOT_FOUND
) {
535 mNoSmmPerfExHandler
= TRUE
;
537 if (EFI_ERROR (Status
) || EFI_ERROR (SmmPerfCommData
->ReturnStatus
) || SmmPerfCommData
->NumberOfEntries
== 0) {
541 mGaugeNumberOfEntriesEx
= SmmPerfCommData
->NumberOfEntries
;
543 DataSize
= mGaugeNumberOfEntriesEx
* sizeof(GAUGE_DATA_ENTRY_EX
);
544 mGaugeDataEx
= AllocateZeroPool(DataSize
);
545 ASSERT (mGaugeDataEx
!= NULL
);
548 // Get all SMM gauge data
550 SmmPerfCommData
->Function
= SMM_PERF_FUNCTION_GET_GAUGE_DATA
;
551 SmmPerfCommData
->LogEntryKey
= 0;
552 SmmPerfCommData
->NumberOfEntries
= mGaugeNumberOfEntriesEx
;
553 SmmPerfCommData
->GaugeDataEx
= mGaugeDataEx
;
554 Status
= mSmmCommunication
->Communicate (mSmmCommunication
, mSmmPerformanceBuffer
, &CommSize
);
555 if (EFI_ERROR (Status
) || EFI_ERROR (SmmPerfCommData
->ReturnStatus
)) {
556 FreePool (mGaugeDataEx
);
558 mGaugeNumberOfEntriesEx
= 0;
565 Attempts to retrieve a performance measurement log entry from the performance measurement log.
566 It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement,
567 and then assign the Identifier with 0.
569 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
570 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
571 and the key for the second entry in the log is returned. If the performance log is empty,
572 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
573 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
574 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
575 retrieved and an implementation specific non-zero key value that specifies the end of the performance
576 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
577 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
578 the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier.
579 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
580 If Handle is NULL, then ASSERT().
581 If Token is NULL, then ASSERT().
582 If Module is NULL, then ASSERT().
583 If StartTimeStamp is NULL, then ASSERT().
584 If EndTimeStamp is NULL, then ASSERT().
585 If Identifier is NULL, then ASSERT().
587 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
588 0, then the first performance measurement log entry is retrieved.
589 On exit, the key of the next performance log entry.
590 @param Handle Pointer to environment specific context used to identify the component
592 @param Token Pointer to a Null-terminated ASCII string that identifies the component
594 @param Module Pointer to a Null-terminated ASCII string that identifies the module
596 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
598 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
600 @param Identifier Pointer to the 32-bit identifier that was recorded.
602 @return The key for the next performance log entry (in general case).
607 GetPerformanceMeasurementEx (
608 IN UINTN LogEntryKey
,
609 OUT CONST VOID
**Handle
,
610 OUT CONST CHAR8
**Token
,
611 OUT CONST CHAR8
**Module
,
612 OUT UINT64
*StartTimeStamp
,
613 OUT UINT64
*EndTimeStamp
,
614 OUT UINT32
*Identifier
617 GAUGE_DATA_ENTRY_EX
*GaugeData
;
621 ASSERT (Handle
!= NULL
);
622 ASSERT (Token
!= NULL
);
623 ASSERT (Module
!= NULL
);
624 ASSERT (StartTimeStamp
!= NULL
);
625 ASSERT (EndTimeStamp
!= NULL
);
626 ASSERT (Identifier
!= NULL
);
628 mGaugeDataEx
= GetAllSmmGaugeDataEx (LogEntryKey
);
629 if (mGaugeDataEx
!= NULL
) {
630 if (LogEntryKey
>= mGaugeNumberOfEntriesEx
) {
632 // Try to get the data by Performance Protocol.
634 LogEntryKey
= LogEntryKey
- mGaugeNumberOfEntriesEx
;
635 LogEntryKey
= GetByPerformanceProtocol (
644 if (LogEntryKey
== 0) {
650 return (LogEntryKey
+ mGaugeNumberOfEntriesEx
);
654 GaugeData
= &mGaugeDataEx
[LogEntryKey
++];
655 *Identifier
= GaugeData
->Identifier
;
657 mGaugeData
= GetAllSmmGaugeData (LogEntryKey
);
658 if (mGaugeData
!= NULL
) {
659 if (LogEntryKey
>= mGaugeNumberOfEntries
) {
661 // Try to get the data by Performance Protocol.
663 LogEntryKey
= LogEntryKey
- mGaugeNumberOfEntries
;
664 LogEntryKey
= GetByPerformanceProtocol (
673 if (LogEntryKey
== 0) {
679 return (LogEntryKey
+ mGaugeNumberOfEntries
);
683 GaugeData
= (GAUGE_DATA_ENTRY_EX
*) &mGaugeData
[LogEntryKey
++];
686 return GetByPerformanceProtocol (
698 *Handle
= (VOID
*) (UINTN
) GaugeData
->Handle
;
699 *Token
= GaugeData
->Token
;
700 *Module
= GaugeData
->Module
;
701 *StartTimeStamp
= GaugeData
->StartTimeStamp
;
702 *EndTimeStamp
= GaugeData
->EndTimeStamp
;
708 Attempts to retrieve a performance measurement log entry from the performance measurement log.
709 It can also retrieve the log created by StartPerformanceMeasurementEx and EndPerformanceMeasurementEx,
710 and then eliminate the Identifier.
712 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
713 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
714 and the key for the second entry in the log is returned. If the performance log is empty,
715 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
716 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
717 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
718 retrieved and an implementation specific non-zero key value that specifies the end of the performance
719 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
720 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
721 the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
722 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
723 If Handle is NULL, then ASSERT().
724 If Token is NULL, then ASSERT().
725 If Module is NULL, then ASSERT().
726 If StartTimeStamp is NULL, then ASSERT().
727 If EndTimeStamp is NULL, then ASSERT().
729 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
730 0, then the first performance measurement log entry is retrieved.
731 On exit, the key of the next performance log entry.
732 @param Handle Pointer to environment specific context used to identify the component
734 @param Token Pointer to a Null-terminated ASCII string that identifies the component
736 @param Module Pointer to a Null-terminated ASCII string that identifies the module
738 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
740 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
743 @return The key for the next performance log entry (in general case).
748 GetPerformanceMeasurement (
749 IN UINTN LogEntryKey
,
750 OUT CONST VOID
**Handle
,
751 OUT CONST CHAR8
**Token
,
752 OUT CONST CHAR8
**Module
,
753 OUT UINT64
*StartTimeStamp
,
754 OUT UINT64
*EndTimeStamp
758 return GetPerformanceMeasurementEx (LogEntryKey
, Handle
, Token
, Module
, StartTimeStamp
, EndTimeStamp
, &Identifier
);
762 Returns TRUE if the performance measurement macros are enabled.
764 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
765 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
767 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
768 PcdPerformanceLibraryPropertyMask is set.
769 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
770 PcdPerformanceLibraryPropertyMask is clear.
775 PerformanceMeasurementEnabled (
779 return (BOOLEAN
) ((PcdGet8(PcdPerformanceLibraryPropertyMask
) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED
) != 0);