]>
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 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __PERFORMANCE_LIB_H__
16 #define __PERFORMANCE_LIB_H__
19 /// Performance library propery mask bits
21 #define PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED 0x00000001
24 // Public Progress Identifiers for Event Records.
26 #define PERF_EVENT_ID 0x00
28 #define MODULE_START_ID 0x01
29 #define MODULE_END_ID 0x02
30 #define MODULE_LOADIMAGE_START_ID 0x03
31 #define MODULE_LOADIMAGE_END_ID 0x04
32 #define MODULE_DB_START_ID 0x05
33 #define MODULE_DB_END_ID 0x06
34 #define MODULE_DB_SUPPORT_START_ID 0x07
35 #define MODULE_DB_SUPPORT_END_ID 0x08
36 #define MODULE_DB_STOP_START_ID 0x09
37 #define MODULE_DB_STOP_END_ID 0x0A
39 #define PERF_EVENTSIGNAL_START_ID 0x10
40 #define PERF_EVENTSIGNAL_END_ID 0x11
41 #define PERF_CALLBACK_START_ID 0x20
42 #define PERF_CALLBACK_END_ID 0x21
43 #define PERF_FUNCTION_START_ID 0x30
44 #define PERF_FUNCTION_END_ID 0x31
45 #define PERF_INMODULE_START_ID 0x40
46 #define PERF_INMODULE_END_ID 0x41
47 #define PERF_CROSSMODULE_START_ID 0x50
48 #define PERF_CROSSMODULE_END_ID 0x51
51 // Declare bits for PcdPerformanceLibraryPropertyMask and
52 // also used as the Type parameter of LogPerformanceMeasurementEnabled().
54 #define PERF_CORE_START_IMAGE 0x0002
55 #define PERF_CORE_LOAD_IMAGE 0x0004
56 #define PERF_CORE_DB_SUPPORT 0x0008
57 #define PERF_CORE_DB_START 0x0010
58 #define PERF_CORE_DB_STOP 0x0020
60 #define PERF_GENERAL_TYPE 0x0040
63 Creates a record for the beginning of a performance measurement.
65 Creates a record that contains the Handle, Token, and Module.
66 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
67 If TimeStamp is zero, then this function reads the current time stamp
68 and adds that time stamp value to the record as the start time.
70 @param Handle Pointer to environment specific context used
71 to identify the component being measured.
72 @param Token Pointer to a Null-terminated ASCII string
73 that identifies the component being measured.
74 @param Module Pointer to a Null-terminated ASCII string
75 that identifies the module being measured.
76 @param TimeStamp 64-bit time stamp.
78 @retval RETURN_SUCCESS The start of the measurement was recorded.
79 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
80 @retval RETURN_DEVICE_ERROR A device error reading the time stamp.
85 StartPerformanceMeasurement (
86 IN CONST VOID
*Handle
, OPTIONAL
87 IN CONST CHAR8
*Token
, OPTIONAL
88 IN CONST CHAR8
*Module
, OPTIONAL
93 Fills in the end time of a performance measurement.
95 Looks up the record that matches Handle, Token, and Module.
96 If the record can not be found then return RETURN_NOT_FOUND.
97 If the record is found and TimeStamp is not zero,
98 then TimeStamp is added to the record as the end time.
99 If the record is found and TimeStamp is zero, then this function reads
100 the current time stamp and adds that time stamp value to the record as the end time.
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 TimeStamp 64-bit time stamp.
110 @retval RETURN_SUCCESS The end of the measurement was recorded.
111 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
112 @retval RETURN_DEVICE_ERROR A device error reading the time stamp.
117 EndPerformanceMeasurement (
118 IN CONST VOID
*Handle
, OPTIONAL
119 IN CONST CHAR8
*Token
, OPTIONAL
120 IN CONST CHAR8
*Module
, OPTIONAL
125 Attempts to retrieve a performance measurement log entry from the performance measurement log.
126 It can also retrieve the log created by StartPerformanceMeasurementEx and EndPerformanceMeasurementEx,
127 and then eliminate the Identifier.
129 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
130 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
131 and the key for the second entry in the log is returned. If the performance log is empty,
132 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
133 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
134 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
135 retrieved and an implementation specific non-zero key value that specifies the end of the performance
136 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
137 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
138 the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
139 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
140 If Handle is NULL, then ASSERT().
141 If Token is NULL, then ASSERT().
142 If Module is NULL, then ASSERT().
143 If StartTimeStamp is NULL, then ASSERT().
144 If EndTimeStamp is NULL, then ASSERT().
146 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
147 0, then the first performance measurement log entry is retrieved.
148 On exit, the key of the next performance lof entry entry.
149 @param Handle Pointer to environment specific context used to identify the component
151 @param Token Pointer to a Null-terminated ASCII string that identifies the component
153 @param Module Pointer to a Null-terminated ASCII string that identifies the module
155 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
157 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
160 @return The key for the next performance log entry (in general case).
165 GetPerformanceMeasurement (
166 IN UINTN LogEntryKey
,
167 OUT CONST VOID
**Handle
,
168 OUT CONST CHAR8
**Token
,
169 OUT CONST CHAR8
**Module
,
170 OUT UINT64
*StartTimeStamp
,
171 OUT UINT64
*EndTimeStamp
175 Creates a record for the beginning of a performance measurement.
177 Creates a record that contains the Handle, Token, Module and Identifier.
178 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
179 If TimeStamp is zero, then this function reads the current time stamp
180 and adds that time stamp value to the record as the start time.
182 @param Handle Pointer to environment specific context used
183 to identify the component being measured.
184 @param Token Pointer to a Null-terminated ASCII string
185 that identifies the component being measured.
186 @param Module Pointer to a Null-terminated ASCII string
187 that identifies the module being measured.
188 @param TimeStamp 64-bit time stamp.
189 @param Identifier 32-bit identifier. If the value is 0, the created record
190 is same as the one created by StartPerformanceMeasurement.
192 @retval RETURN_SUCCESS The start of the measurement was recorded.
193 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
194 @retval RETURN_DEVICE_ERROR A device error reading the time stamp.
199 StartPerformanceMeasurementEx (
200 IN CONST VOID
*Handle
, OPTIONAL
201 IN CONST CHAR8
*Token
, OPTIONAL
202 IN CONST CHAR8
*Module
, OPTIONAL
208 Fills in the end time of a performance measurement.
210 Looks up the record that matches Handle, Token and Module.
211 If the record can not be found then return RETURN_NOT_FOUND.
212 If the record is found and TimeStamp is not zero,
213 then TimeStamp is added to the record as the end time.
214 If the record is found and TimeStamp is zero, then this function reads
215 the current time stamp and adds that time stamp value to the record as the end time.
217 @param Handle Pointer to environment specific context used
218 to identify the component being measured.
219 @param Token Pointer to a Null-terminated ASCII string
220 that identifies the component being measured.
221 @param Module Pointer to a Null-terminated ASCII string
222 that identifies the module being measured.
223 @param TimeStamp 64-bit time stamp.
224 @param Identifier 32-bit identifier. If the value is 0, the found record
225 is same as the one found by EndPerformanceMeasurement.
227 @retval RETURN_SUCCESS The end of the measurement was recorded.
228 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
229 @retval RETURN_DEVICE_ERROR A device error reading the time stamp.
234 EndPerformanceMeasurementEx (
235 IN CONST VOID
*Handle
, OPTIONAL
236 IN CONST CHAR8
*Token
, OPTIONAL
237 IN CONST CHAR8
*Module
, OPTIONAL
243 Attempts to retrieve a performance measurement log entry from the performance measurement log.
244 It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement,
245 and then assign the Identifier with 0.
247 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
248 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
249 and the key for the second entry in the log is returned. If the performance log is empty,
250 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
251 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
252 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
253 retrieved and an implementation specific non-zero key value that specifies the end of the performance
254 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
255 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
256 the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier.
257 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
258 If Handle is NULL, then ASSERT().
259 If Token is NULL, then ASSERT().
260 If Module is NULL, then ASSERT().
261 If StartTimeStamp is NULL, then ASSERT().
262 If EndTimeStamp is NULL, then ASSERT().
263 If Identifier is NULL, then ASSERT().
265 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
266 0, then the first performance measurement log entry is retrieved.
267 On exit, the key of the next performance of entry entry.
268 @param Handle Pointer to environment specific context used to identify the component
270 @param Token Pointer to a Null-terminated ASCII string that identifies the component
272 @param Module Pointer to a Null-terminated ASCII string that identifies the module
274 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
276 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
278 @param Identifier Pointer to the 32-bit identifier that was recorded.
280 @return The key for the next performance log entry (in general case).
285 GetPerformanceMeasurementEx (
286 IN UINTN LogEntryKey
,
287 OUT CONST VOID
**Handle
,
288 OUT CONST CHAR8
**Token
,
289 OUT CONST CHAR8
**Module
,
290 OUT UINT64
*StartTimeStamp
,
291 OUT UINT64
*EndTimeStamp
,
292 OUT UINT32
*Identifier
296 Returns TRUE if the performance measurement macros are enabled.
298 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
299 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
301 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
302 PcdPerformanceLibraryPropertyMask is set.
303 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
304 PcdPerformanceLibraryPropertyMask is clear.
309 PerformanceMeasurementEnabled (
315 Check whether the specified performance measurement can be logged.
317 This function returns TRUE when the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set
318 and the Type disable bit in PcdPerformanceLibraryPropertyMask is not set.
320 @param Type - Type of the performance measurement entry.
322 @retval TRUE The performance measurement can be logged.
323 @retval FALSE The performance measurement can NOT be logged.
328 LogPerformanceMeasurementEnabled (
333 Create performance record with event description.
335 @param CallerIdentifier - Image handle or pointer to caller ID GUID
336 @param Guid - Pointer to a GUID.
337 Used for event signal perf and callback perf to cache the event guid.
338 @param String - Pointer to a string describing the measurement
339 @param Address - Pointer to a location in memory relevant to the measurement.
340 @param Identifier - Performance identifier describing the type of measurement.
342 @retval RETURN_SUCCESS - Successfully created performance record
343 @retval RETURN_OUT_OF_RESOURCES - Ran out of space to store the records
344 @retval RETURN_INVALID_PARAMETER - Invalid parameter passed to function - NULL
345 pointer or invalid Identifier.
350 LogPerformanceMeasurement (
351 IN CONST VOID
*CallerIdentifier
, OPTIONAL
352 IN CONST VOID
*Guid
, OPTIONAL
353 IN CONST CHAR8
*String
, OPTIONAL
354 IN UINT64 Address
, OPTIONAL
359 Begin Macro to measure the performance of StartImage in core.
361 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
362 and the BIT1(dsiable PERF_CORE_START_IMAGE) of PcdPerformanceLibraryPropertyMask is not set.
363 then LogPerformanceMeasurement() is called.
366 #define PERF_START_IMAGE_BEGIN(ModuleHandle) \
368 if (LogPerformanceMeasurementEnabled (PERF_CORE_START_IMAGE)) { \
369 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_START_ID); \
374 End Macro to measure the performance of StartImage in core.
376 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
377 and the BIT1 (dsiable PERF_CORE_START_IMAGE)of PcdPerformanceLibraryPropertyMask is not set.
378 then LogPerformanceMeasurement() is called.
381 #define PERF_START_IMAGE_END(ModuleHandle) \
383 if (LogPerformanceMeasurementEnabled (PERF_CORE_START_IMAGE)) { \
384 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_END_ID); \
389 Begin Macro to measure the performance of LoadImage in core.
391 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
392 and the BIT2 (dsiable PERF_CORE_LOAD_IAMGE) of PcdPerformanceLibraryPropertyMask is not set.
393 then LogPerformanceMeasurement() is called.
396 #define PERF_LOAD_IMAGE_BEGIN(ModuleHandle) \
398 if (LogPerformanceMeasurementEnabled (PERF_CORE_LOAD_IMAGE)) { \
399 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_LOADIMAGE_START_ID); \
404 End Macro to measure the performance of LoadImage in core.
406 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
407 and the BIT2 (dsiable PERF_CORE_LOAD_IAMGE) of PcdPerformanceLibraryPropertyMask is not set.
408 then LogPerformanceMeasurement() is called.
411 #define PERF_LOAD_IMAGE_END(ModuleHandle) \
413 if (LogPerformanceMeasurementEnabled (PERF_CORE_LOAD_IMAGE)) { \
414 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, 0, MODULE_LOADIMAGE_END_ID); \
419 Start Macro to measure the performance of DriverBinding Support in core.
421 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
422 and the BIT3 (dsiable PERF_CORE_DB_SUPPORT) of PcdPerformanceLibraryPropertyMask is not set.
423 then LogPerformanceMeasurement() is called.
426 #define PERF_DRIVER_BINDING_SUPPORT_BEGIN(ModuleHandle, ControllerHandle) \
428 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_SUPPORT)) { \
429 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_SUPPORT_START_ID); \
434 End Macro to measure the performance of DriverBinding Support in core.
436 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
437 and the BIT3 (dsiable PERF_CORE_DB_SUPPORT) of PcdPerformanceLibraryPropertyMask is not set.
438 then LogPerformanceMeasurement() is called.
441 #define PERF_DRIVER_BINDING_SUPPORT_END(ModuleHandle, ControllerHandle) \
443 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_SUPPORT)) { \
444 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_SUPPORT_END_ID); \
449 Begin Macro to measure the performance of DriverBinding Start in core.
451 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
452 and the BIT4 (dsiable PERF_CORE_DB_START) of PcdPerformanceLibraryPropertyMask is not set.
453 then LogPerformanceMeasurement() is called.
456 #define PERF_DRIVER_BINDING_START_BEGIN(ModuleHandle, ControllerHandle) \
458 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_START)) { \
459 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_START_ID); \
464 End Macro to measure the performance of DriverBinding Start in core.
466 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
467 and the BIT4 (dsiable PERF_CORE_DB_START) of PcdPerformanceLibraryPropertyMask is not set.
468 then LogPerformanceMeasurement() is called.
471 #define PERF_DRIVER_BINDING_START_END(ModuleHandle, ControllerHandle) \
473 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_START)) { \
474 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_END_ID); \
479 Start Macro to measure the performance of DriverBinding Stop in core.
481 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
482 and the BIT5 (dsiable PERF_CORE_DB_STOP) of PcdPerformanceLibraryPropertyMask is not set.
483 then LogPerformanceMeasurement() is called.
486 #define PERF_DRIVER_BINDING_STOP_BEGIN(ModuleHandle, ControllerHandle) \
488 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_STOP)) { \
489 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_STOP_START_ID); \
494 End Macro to measure the performance of DriverBinding Stop in core.
496 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
497 and the BIT5 (dsiable PERF_CORE_DB_STOP) of PcdPerformanceLibraryPropertyMask is not set.
498 then LogPerformanceMeasurement() is called.
501 #define PERF_DRIVER_BINDING_STOP_END(ModuleHandle, ControllerHandle) \
503 if (LogPerformanceMeasurementEnabled (PERF_CORE_DB_STOP)) { \
504 LogPerformanceMeasurement (ModuleHandle, NULL, NULL, (UINT64)(UINTN)ControllerHandle, MODULE_DB_STOP_END_ID); \
509 Macro to measure the time from power-on to this macro execution.
510 It can be used to log a meaningful thing which happens at a time point.
512 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
513 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
514 then LogPerformanceMeasurement() is called.
517 #define PERF_EVENT(EventString) \
519 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
520 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, EventString , 0, PERF_EVENT_ID); \
525 Begin Macro to measure the perofrmance of evnent signal behavior in any module.
526 The event guid will be passed with this macro.
528 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
529 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
530 then LogPerformanceMeasurement() is called.
533 #define PERF_EVENT_SIGNAL_BEGIN(EventGuid) \
535 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
536 LogPerformanceMeasurement (&gEfiCallerIdGuid, EventGuid, __FUNCTION__ , 0, PERF_EVENTSIGNAL_START_ID); \
541 End Macro to measure the perofrmance of evnent signal behavior in any module.
542 The event guid will be passed with this macro.
544 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
545 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
546 then LogPerformanceMeasurement() is called.
549 #define PERF_EVENT_SIGNAL_END(EventGuid) \
551 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
552 LogPerformanceMeasurement (&gEfiCallerIdGuid, EventGuid, __FUNCTION__ , 0, PERF_EVENTSIGNAL_END_ID); \
557 Begin Macro to measure the perofrmance of a callback function in any module.
558 The event guid which trigger the callback function will be passed with this macro.
560 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
561 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
562 then LogPerformanceMeasurement() is called.
565 #define PERF_CALLBACK_BEGIN(TriggerGuid) \
567 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
568 LogPerformanceMeasurement (&gEfiCallerIdGuid, TriggerGuid, __FUNCTION__ , 0, PERF_CALLBACK_START_ID); \
573 End Macro to measure the perofrmance of a callback function in any module.
574 The event guid which trigger the callback function will be passed with this macro.
576 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
577 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
578 then LogPerformanceMeasurement() is called.
581 #define PERF_CALLBACK_END(TriggerGuid) \
583 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
584 LogPerformanceMeasurement (&gEfiCallerIdGuid, TriggerGuid, __FUNCTION__ , 0, PERF_CALLBACK_END_ID); \
589 Begin Macro to measure the perofrmance of a general function in any module.
591 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
592 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
593 then LogPerformanceMeasurement() is called.
596 #define PERF_FUNCTION_BEGIN() \
598 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
599 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, __FUNCTION__ , 0, PERF_FUNCTION_START_ID); \
604 End Macro to measure the perofrmance of a general function in any module.
606 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
607 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
608 then LogPerformanceMeasurement() is called.
611 #define PERF_FUNCTION_END() \
613 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
614 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, __FUNCTION__ , 0, PERF_FUNCTION_END_ID); \
619 Begin Macro to measure the perofrmance of a behavior within one module.
621 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
622 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
623 then LogPerformanceMeasurement() is called.
626 #define PERF_INMODULE_BEGIN(MeasurementString) \
628 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
629 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_INMODULE_START_ID); \
634 End Macro to measure the perofrmance of a behavior within one module.
636 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
637 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
638 then LogPerformanceMeasurement() is called.
641 #define PERF_INMODULE_END(MeasurementString) \
643 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
644 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_INMODULE_END_ID); \
649 Begin Macro to measure the perofrmance of a behavior in different modules.
650 Such as the performance of PEI phase, DXE phase, BDS phase.
652 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
653 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
654 then LogPerformanceMeasurement() is called.
657 #define PERF_CROSSMODULE_BEGIN(MeasurementString) \
659 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
660 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_CROSSMODULE_START_ID); \
665 End Macro to measure the perofrmance of a behavior in different modules.
666 Such as the performance of PEI phase, DXE phase, BDS phase.
668 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
669 and the BIT6 (dsiable PERF_GENERAL_TYPE) of PcdPerformanceLibraryPropertyMask is not set.
670 then LogPerformanceMeasurement() is called.
673 #define PERF_CROSSMODULE_END(MeasurementString) \
675 if (LogPerformanceMeasurementEnabled (PERF_GENERAL_TYPE)) { \
676 LogPerformanceMeasurement (&gEfiCallerIdGuid, NULL, MeasurementString, 0, PERF_CROSSMODULE_END_ID); \
681 Macro that calls EndPerformanceMeasurement().
683 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
684 then EndPerformanceMeasurement() is called.
687 #define PERF_END(Handle, Token, Module, TimeStamp) \
689 if (PerformanceMeasurementEnabled ()) { \
690 EndPerformanceMeasurement (Handle, Token, Module, TimeStamp); \
695 Macro that calls StartPerformanceMeasurement().
697 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
698 then StartPerformanceMeasurement() is called.
701 #define PERF_START(Handle, Token, Module, TimeStamp) \
703 if (PerformanceMeasurementEnabled ()) { \
704 StartPerformanceMeasurement (Handle, Token, Module, TimeStamp); \
709 Macro that calls EndPerformanceMeasurementEx().
711 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
712 then EndPerformanceMeasurementEx() is called.
715 #define PERF_END_EX(Handle, Token, Module, TimeStamp, Identifier) \
717 if (PerformanceMeasurementEnabled ()) { \
718 EndPerformanceMeasurementEx (Handle, Token, Module, TimeStamp, Identifier); \
723 Macro that calls StartPerformanceMeasurementEx().
725 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
726 then StartPerformanceMeasurementEx() is called.
729 #define PERF_START_EX(Handle, Token, Module, TimeStamp, Identifier) \
731 if (PerformanceMeasurementEnabled ()) { \
732 StartPerformanceMeasurementEx (Handle, Token, Module, TimeStamp, Identifier); \
737 Macro that marks the beginning of performance measurement source code.
739 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
740 then this macro marks the beginning of source code that is included in a module.
741 Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module.
744 #define PERF_CODE_BEGIN() do { if (PerformanceMeasurementEnabled ()) { UINT8 __PerformanceCodeLocal
747 Macro that marks the end of performance measurement source code.
749 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
750 then this macro marks the end of source code that is included in a module.
751 Otherwise, the source lines between PERF_CODE_BEGIN() and PERF_CODE_END() are not included in a module.
754 #define PERF_CODE_END() __PerformanceCodeLocal = 0; __PerformanceCodeLocal++; } } while (FALSE)
757 Macro that declares a section of performance measurement source code.
759 If the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set,
760 then the source code specified by Expression is included in a module.
761 Otherwise, the source specified by Expression is not included in a module.
763 @param Expression Performance measurement source code to include in a module.
766 #define PERF_CODE(Expression) \
767 PERF_CODE_BEGIN (); \