]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PerformanceLib.h
2 Provides services to log the execution times and retrieve them later.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __PERFORMANCE_LIB_H__
10 #define __PERFORMANCE_LIB_H__
13 /// Performance library propery mask bits
15 #define PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED 0x00000001
18 // Public Progress Identifiers for Event Records.
20 #define PERF_EVENT_ID 0x00
22 #define MODULE_START_ID 0x01
23 #define MODULE_END_ID 0x02
24 #define MODULE_LOADIMAGE_START_ID 0x03
25 #define MODULE_LOADIMAGE_END_ID 0x04
26 #define MODULE_DB_START_ID 0x05
27 #define MODULE_DB_END_ID 0x06
28 #define MODULE_DB_SUPPORT_START_ID 0x07
29 #define MODULE_DB_SUPPORT_END_ID 0x08
30 #define MODULE_DB_STOP_START_ID 0x09
31 #define MODULE_DB_STOP_END_ID 0x0A
33 #define PERF_EVENTSIGNAL_START_ID 0x10
34 #define PERF_EVENTSIGNAL_END_ID 0x11
35 #define PERF_CALLBACK_START_ID 0x20
36 #define PERF_CALLBACK_END_ID 0x21
37 #define PERF_FUNCTION_START_ID 0x30
38 #define PERF_FUNCTION_END_ID 0x31
39 #define PERF_INMODULE_START_ID 0x40
40 #define PERF_INMODULE_END_ID 0x41
41 #define PERF_CROSSMODULE_START_ID 0x50
42 #define PERF_CROSSMODULE_END_ID 0x51
45 // Declare bits for PcdPerformanceLibraryPropertyMask and
46 // also used as the Type parameter of LogPerformanceMeasurementEnabled().
48 #define PERF_CORE_START_IMAGE 0x0002
49 #define PERF_CORE_LOAD_IMAGE 0x0004
50 #define PERF_CORE_DB_SUPPORT 0x0008
51 #define PERF_CORE_DB_START 0x0010
52 #define PERF_CORE_DB_STOP 0x0020
54 #define PERF_GENERAL_TYPE 0x0040
57 Creates a record for the beginning of a performance measurement.
59 Creates a record that contains the Handle, Token, and Module.
60 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
61 If TimeStamp is zero, then this function reads the current time stamp
62 and adds that time stamp value to the record as the start time.
64 @param Handle Pointer to environment specific context used
65 to identify the component being measured.
66 @param Token Pointer to a Null-terminated ASCII string
67 that identifies the component being measured.
68 @param Module Pointer to a Null-terminated ASCII string
69 that identifies the module being measured.
70 @param TimeStamp 64-bit time stamp.
72 @retval RETURN_SUCCESS The start of the measurement was recorded.
73 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
74 @retval RETURN_DEVICE_ERROR A device error reading the time stamp.
79 StartPerformanceMeasurement (
80 IN CONST VOID
*Handle
, OPTIONAL
81 IN CONST CHAR8
*Token
, OPTIONAL
82 IN CONST CHAR8
*Module
, OPTIONAL
87 Fills in the end time of a performance measurement.
89 Looks up the record that matches Handle, Token, and Module.
90 If the record can not be found then return RETURN_NOT_FOUND.
91 If the record is found and TimeStamp is not zero,
92 then TimeStamp is added to the record as the end time.
93 If the record is found and TimeStamp is zero, then this function reads
94 the current time stamp and adds that time stamp value to the record as the end time.
96 @param Handle Pointer to environment specific context used
97 to identify the component being measured.
98 @param Token Pointer to a Null-terminated ASCII string
99 that identifies the component being measured.
100 @param Module Pointer to a Null-terminated ASCII string
101 that identifies the module being measured.
102 @param TimeStamp 64-bit time stamp.
104 @retval RETURN_SUCCESS The end of the measurement was recorded.
105 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
106 @retval RETURN_DEVICE_ERROR A device error reading the time stamp.
111 EndPerformanceMeasurement (
112 IN CONST VOID
*Handle
, OPTIONAL
113 IN CONST CHAR8
*Token
, OPTIONAL
114 IN CONST CHAR8
*Module
, OPTIONAL
119 Attempts to retrieve a performance measurement log entry from the performance measurement log.
120 It can also retrieve the log created by StartPerformanceMeasurementEx and EndPerformanceMeasurementEx,
121 and then eliminate the Identifier.
123 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
124 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
125 and the key for the second entry in the log is returned. If the performance log is empty,
126 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
127 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
128 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
129 retrieved and an implementation specific non-zero key value that specifies the end of the performance
130 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
131 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
132 the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
133 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
134 If Handle is NULL, then ASSERT().
135 If Token is NULL, then ASSERT().
136 If Module is NULL, then ASSERT().
137 If StartTimeStamp is NULL, then ASSERT().
138 If EndTimeStamp is NULL, then ASSERT().
140 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
141 0, then the first performance measurement log entry is retrieved.
142 On exit, the key of the next performance lof entry entry.
143 @param Handle Pointer to environment specific context used to identify the component
145 @param Token Pointer to a Null-terminated ASCII string that identifies the component
147 @param Module Pointer to a Null-terminated ASCII string that identifies the module
149 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
151 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
154 @return The key for the next performance log entry (in general case).
159 GetPerformanceMeasurement (
160 IN UINTN LogEntryKey
,
161 OUT CONST VOID
**Handle
,
162 OUT CONST CHAR8
**Token
,
163 OUT CONST CHAR8
**Module
,
164 OUT UINT64
*StartTimeStamp
,
165 OUT UINT64
*EndTimeStamp
169 Creates a record for the beginning of a performance measurement.
171 Creates a record that contains the Handle, Token, Module and Identifier.
172 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
173 If TimeStamp is zero, then this function reads the current time stamp
174 and adds that time stamp value to the record as the start 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 created record
184 is same as the one created by StartPerformanceMeasurement.
186 @retval RETURN_SUCCESS The start of the measurement was recorded.
187 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
188 @retval RETURN_DEVICE_ERROR A device error reading the time stamp.
193 StartPerformanceMeasurementEx (
194 IN CONST VOID
*Handle
, OPTIONAL
195 IN CONST CHAR8
*Token
, OPTIONAL
196 IN CONST CHAR8
*Module
, OPTIONAL
202 Fills in the end time of a performance measurement.
204 Looks up the record that matches Handle, Token and Module.
205 If the record can not be found then return RETURN_NOT_FOUND.
206 If the record is found and TimeStamp is not zero,
207 then TimeStamp is added to the record as the end time.
208 If the record is found and TimeStamp is zero, then this function reads
209 the current time stamp and adds that time stamp value to the record as the end 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.
218 @param Identifier 32-bit identifier. If the value is 0, the found record
219 is same as the one found by EndPerformanceMeasurement.
221 @retval RETURN_SUCCESS The end of the measurement was recorded.
222 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
223 @retval RETURN_DEVICE_ERROR A device error reading the time stamp.
228 EndPerformanceMeasurementEx (
229 IN CONST VOID
*Handle
, OPTIONAL
230 IN CONST CHAR8
*Token
, OPTIONAL
231 IN CONST CHAR8
*Module
, OPTIONAL
237 Attempts to retrieve a performance measurement log entry from the performance measurement log.
238 It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement,
239 and then assign the Identifier with 0.
241 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
242 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
243 and the key for the second entry in the log is returned. If the performance log is empty,
244 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
245 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
246 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
247 retrieved and an implementation specific non-zero key value that specifies the end of the performance
248 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
249 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
250 the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier.
251 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
252 If Handle is NULL, then ASSERT().
253 If Token is NULL, then ASSERT().
254 If Module is NULL, then ASSERT().
255 If StartTimeStamp is NULL, then ASSERT().
256 If EndTimeStamp is NULL, then ASSERT().
257 If Identifier is NULL, then ASSERT().
259 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
260 0, then the first performance measurement log entry is retrieved.
261 On exit, the key of the next performance of entry entry.
262 @param Handle Pointer to environment specific context used to identify the component
264 @param Token Pointer to a Null-terminated ASCII string that identifies the component
266 @param Module Pointer to a Null-terminated ASCII string that identifies the module
268 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
270 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
272 @param Identifier Pointer to the 32-bit identifier that was recorded.
274 @return The key for the next performance log entry (in general case).
279 GetPerformanceMeasurementEx (
280 IN UINTN LogEntryKey
,
281 OUT CONST VOID
**Handle
,
282 OUT CONST CHAR8
**Token
,
283 OUT CONST CHAR8
**Module
,
284 OUT UINT64
*StartTimeStamp
,
285 OUT UINT64
*EndTimeStamp
,
286 OUT UINT32
*Identifier
290 Returns TRUE if the performance measurement macros are enabled.
292 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
293 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
295 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
296 PcdPerformanceLibraryPropertyMask is set.
297 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
298 PcdPerformanceLibraryPropertyMask is clear.
303 PerformanceMeasurementEnabled (
309 Check whether the specified performance measurement can be logged.
311 This function returns TRUE when the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set
312 and the Type disable bit in PcdPerformanceLibraryPropertyMask is not set.
314 @param Type - Type of the performance measurement entry.
316 @retval TRUE The performance measurement can be logged.
317 @retval FALSE The performance measurement can NOT be logged.
322 LogPerformanceMeasurementEnabled (
327 Create performance record with event description.
329 @param CallerIdentifier - Image handle or pointer to caller ID GUID
330 @param Guid - Pointer to a GUID.
331 Used for event signal perf and callback perf to cache the event guid.
332 @param String - Pointer to a string describing the measurement
333 @param Address - Pointer to a location in memory relevant to the measurement.
334 @param Identifier - Performance identifier describing the type of measurement.
336 @retval RETURN_SUCCESS - Successfully created performance record
337 @retval RETURN_OUT_OF_RESOURCES - Ran out of space to store the records
338 @retval RETURN_INVALID_PARAMETER - Invalid parameter passed to function - NULL
339 pointer or invalid Identifier.
344 LogPerformanceMeasurement (
345 IN CONST VOID
*CallerIdentifier
, OPTIONAL
346 IN CONST VOID
*Guid
, OPTIONAL
347 IN CONST CHAR8
*String
, OPTIONAL
348 IN UINT64 Address
, OPTIONAL
353 Begin Macro to measure the performance of StartImage in core.
355 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
356 and the BIT1(dsiable PERF_CORE_START_IMAGE) of PcdPerformanceLibraryPropertyMask is not set.
357 then LogPerformanceMeasurement() is called.
360 #define PERF_START_IMAGE_BEGIN(ModuleHandle) \
362 if (LogPerformanceMeasurementEnabled (PERF_CORE_START_IMAGE)) { \
363 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_START_ID); \
368 End Macro to measure the performance of StartImage in core.
370 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
371 and the BIT1 (dsiable PERF_CORE_START_IMAGE)of PcdPerformanceLibraryPropertyMask is not set.
372 then LogPerformanceMeasurement() is called.
375 #define PERF_START_IMAGE_END(ModuleHandle) \
377 if (LogPerformanceMeasurementEnabled (PERF_CORE_START_IMAGE)) { \
378 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_END_ID); \
383 Begin Macro to measure the performance of LoadImage in core.
385 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
386 and the BIT2 (dsiable PERF_CORE_LOAD_IAMGE) of PcdPerformanceLibraryPropertyMask is not set.
387 then LogPerformanceMeasurement() is called.
390 #define PERF_LOAD_IMAGE_BEGIN(ModuleHandle) \
392 if (LogPerformanceMeasurementEnabled (PERF_CORE_LOAD_IMAGE)) { \
393 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_LOADIMAGE_START_ID); \
398 End Macro to measure the performance of LoadImage in core.
400 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
401 and the BIT2 (dsiable PERF_CORE_LOAD_IAMGE) of PcdPerformanceLibraryPropertyMask is not set.
402 then LogPerformanceMeasurement() is called.
405 #define PERF_LOAD_IMAGE_END(ModuleHandle) \
407 if (LogPerformanceMeasurementEnabled (PERF_CORE_LOAD_IMAGE)) { \
408 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_LOADIMAGE_END_ID); \
413 Start Macro to measure the performance of DriverBinding Support in core.
415 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
416 and the BIT3 (dsiable PERF_CORE_DB_SUPPORT) of PcdPerformanceLibraryPropertyMask is not set.
417 then LogPerformanceMeasurement() is called.
420 #define PERF_DRIVER_BINDING_SUPPORT_BEGIN(ModuleHandle, ControllerHandle) \
422 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_SUPPORT)) { \
423 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_SUPPORT_START_ID); \
428 End Macro to measure the performance of DriverBinding Support in core.
430 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
431 and the BIT3 (dsiable PERF_CORE_DB_SUPPORT) of PcdPerformanceLibraryPropertyMask is not set.
432 then LogPerformanceMeasurement() is called.
435 #define PERF_DRIVER_BINDING_SUPPORT_END(ModuleHandle, ControllerHandle) \
437 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_SUPPORT)) { \
438 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_SUPPORT_END_ID); \
443 Begin Macro to measure the performance of DriverBinding Start in core.
445 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
446 and the BIT4 (dsiable PERF_CORE_DB_START) of PcdPerformanceLibraryPropertyMask is not set.
447 then LogPerformanceMeasurement() is called.
450 #define PERF_DRIVER_BINDING_START_BEGIN(ModuleHandle, ControllerHandle) \
452 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_START)) { \
453 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_START_ID); \
458 End Macro to measure the performance of DriverBinding Start in core.
460 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
461 and the BIT4 (dsiable PERF_CORE_DB_START) of PcdPerformanceLibraryPropertyMask is not set.
462 then LogPerformanceMeasurement() is called.
465 #define PERF_DRIVER_BINDING_START_END(ModuleHandle, ControllerHandle) \
467 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_START)) { \
468 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_END_ID); \
473 Start Macro to measure the performance of DriverBinding Stop in core.
475 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
476 and the BIT5 (dsiable PERF_CORE_DB_STOP) of PcdPerformanceLibraryPropertyMask is not set.
477 then LogPerformanceMeasurement() is called.
480 #define PERF_DRIVER_BINDING_STOP_BEGIN(ModuleHandle, ControllerHandle) \
482 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_STOP)) { \
483 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_STOP_START_ID); \
488 End Macro to measure the performance of DriverBinding Stop in core.
490 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
491 and the BIT5 (dsiable PERF_CORE_DB_STOP) of PcdPerformanceLibraryPropertyMask is not set.
492 then LogPerformanceMeasurement() is called.
495 #define PERF_DRIVER_BINDING_STOP_END(ModuleHandle, ControllerHandle) \
497 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_STOP)) { \
498 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_STOP_END_ID); \
503 Macro to measure the time from power-on to this macro execution.
504 It can be used to log a meaningful thing which happens at a time point.
506 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
507 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
508 then LogPerformanceMeasurement() is called.
511 #define PERF_EVENT(EventString) \
513 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
514 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, EventString , 0, PERF_EVENT_ID); \
519 Begin Macro to measure the perofrmance of evnent signal behavior in any module.
520 The event guid will be passed with this macro.
522 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
523 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
524 then LogPerformanceMeasurement() is called.
527 #define PERF_EVENT_SIGNAL_BEGIN(EventGuid) \
529 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
530 LogPerformanceMeasurement (&gEfiCallerIdGuid, EventGuid, __FUNCTION__ , 0, PERF_EVENTSIGNAL_START_ID); \
535 End Macro to measure the perofrmance of evnent signal behavior in any module.
536 The event guid will be passed with this macro.
538 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
539 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
540 then LogPerformanceMeasurement() is called.
543 #define PERF_EVENT_SIGNAL_END(EventGuid) \
545 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
546 LogPerformanceMeasurement (&gEfiCallerIdGuid, EventGuid, __FUNCTION__ , 0, PERF_EVENTSIGNAL_END_ID); \
551 Begin Macro to measure the perofrmance of a callback function in any module.
552 The event guid which trigger the callback function will be passed with this macro.
554 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
555 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
556 then LogPerformanceMeasurement() is called.
559 #define PERF_CALLBACK_BEGIN(TriggerGuid) \
561 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
562 LogPerformanceMeasurement (&gEfiCallerIdGuid, TriggerGuid, __FUNCTION__ , 0, PERF_CALLBACK_START_ID); \
567 End Macro to measure the perofrmance of a callback function in any module.
568 The event guid which trigger the callback function will be passed with this macro.
570 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
571 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
572 then LogPerformanceMeasurement() is called.
575 #define PERF_CALLBACK_END(TriggerGuid) \
577 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
578 LogPerformanceMeasurement (&gEfiCallerIdGuid, TriggerGuid, __FUNCTION__ , 0, PERF_CALLBACK_END_ID); \
583 Begin Macro to measure the perofrmance of a general function in any module.
585 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
586 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
587 then LogPerformanceMeasurement() is called.
590 #define PERF_FUNCTION_BEGIN() \
592 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
593 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, __FUNCTION__ , 0, PERF_FUNCTION_START_ID); \
598 End Macro to measure the perofrmance of a general function in any module.
600 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
601 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
602 then LogPerformanceMeasurement() is called.
605 #define PERF_FUNCTION_END() \
607 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
608 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, __FUNCTION__ , 0, PERF_FUNCTION_END_ID); \
613 Begin Macro to measure the perofrmance of a behavior within one module.
615 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
616 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
617 then LogPerformanceMeasurement() is called.
620 #define PERF_INMODULE_BEGIN(MeasurementString) \
622 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
623 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_INMODULE_START_ID); \
628 End Macro to measure the perofrmance of a behavior within one module.
630 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
631 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
632 then LogPerformanceMeasurement() is called.
635 #define PERF_INMODULE_END(MeasurementString) \
637 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
638 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_INMODULE_END_ID); \
643 Begin Macro to measure the perofrmance of a behavior in different modules.
644 Such as the performance of PEI phase, DXE phase, BDS phase.
646 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
647 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
648 then LogPerformanceMeasurement() is called.
651 #define PERF_CROSSMODULE_BEGIN(MeasurementString) \
653 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
654 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_CROSSMODULE_START_ID); \
659 End Macro to measure the perofrmance of a behavior in different modules.
660 Such as the performance of PEI phase, DXE phase, BDS phase.
662 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
663 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
664 then LogPerformanceMeasurement() is called.
667 #define PERF_CROSSMODULE_END(MeasurementString) \
669 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
670 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_CROSSMODULE_END_ID); \
675 Macro that calls EndPerformanceMeasurement().
677 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
678 then EndPerformanceMeasurement() is called.
681 #define PERF_END(Handle, Token, Module, TimeStamp) \
683 if (PerformanceMeasurementEnabled ()) { \
684 EndPerformanceMeasurement (Handle, Token, Module, TimeStamp); \
689 Macro that calls StartPerformanceMeasurement().
691 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
692 then StartPerformanceMeasurement() is called.
695 #define PERF_START(Handle, Token, Module, TimeStamp) \
697 if (PerformanceMeasurementEnabled ()) { \
698 StartPerformanceMeasurement (Handle, Token, Module, TimeStamp); \
703 Macro that calls EndPerformanceMeasurementEx().
705 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
706 then EndPerformanceMeasurementEx() is called.
709 #define PERF_END_EX(Handle, Token, Module, TimeStamp, Identifier) \
711 if (PerformanceMeasurementEnabled ()) { \
712 EndPerformanceMeasurementEx (Handle, Token, Module, TimeStamp, Identifier); \
717 Macro that calls StartPerformanceMeasurementEx().
719 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
720 then StartPerformanceMeasurementEx() is called.
723 #define PERF_START_EX(Handle, Token, Module, TimeStamp, Identifier) \
725 if (PerformanceMeasurementEnabled ()) { \
726 StartPerformanceMeasurementEx (Handle, Token, Module, TimeStamp, Identifier); \
731 Macro that marks the beginning of performance measurement source code.
733 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
734 then this macro marks the beginning of source code that is included in a module.
735 Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module.
738 #define PERF_CODE_BEGIN() do { if (PerformanceMeasurementEnabled ()) { UINT8 __PerformanceCodeLocal
741 Macro that marks the end of performance measurement source code.
743 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
744 then this macro marks the end of source code that is included in a module.
745 Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module.
748 #define PERF_CODE_END() __PerformanceCodeLocal = 0; __PerformanceCodeLocal++; } } while (FALSE)
751 Macro that declares a section of performance measurement source code.
753 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
754 then the source code specified by Expression is included in a module.
755 Otherwise, the source specified by Expression is not included in a module.
757 @param Expression Performance measurement source code to include in a module.
760 #define PERF_CODE(Expression) \
761 PERF_CODE_BEGIN (); \