MdeModulePkg: Use new added Perf macros

Replace old Perf macros with the new added ones.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Bi, Dandan 2018-06-22 16:56:21 +08:00 committed by Liming Gao
parent f45dd2dd4f
commit 67e9ab84ef
11 changed files with 53 additions and 76 deletions

View File

@ -419,6 +419,7 @@ CoreDispatcher (
BOOLEAN ReadyToRun; BOOLEAN ReadyToRun;
EFI_EVENT DxeDispatchEvent; EFI_EVENT DxeDispatchEvent;
PERF_FUNCTION_BEGIN ();
if (gDispatcherRunning) { if (gDispatcherRunning) {
// //
@ -584,6 +585,8 @@ CoreDispatcher (
gDispatcherRunning = FALSE; gDispatcherRunning = FALSE;
PERF_FUNCTION_END ();
return ReturnStatus; return ReturnStatus;
} }
@ -1437,6 +1440,8 @@ CoreInitializeDispatcher (
VOID VOID
) )
{ {
PERF_FUNCTION_BEGIN ();
mFwVolEvent = EfiCreateProtocolNotifyEvent ( mFwVolEvent = EfiCreateProtocolNotifyEvent (
&gEfiFirmwareVolume2ProtocolGuid, &gEfiFirmwareVolume2ProtocolGuid,
TPL_CALLBACK, TPL_CALLBACK,
@ -1444,6 +1449,8 @@ CoreInitializeDispatcher (
NULL, NULL,
&mFwVolEventRegistration &mFwVolEventRegistration
); );
PERF_FUNCTION_END ();
} }
// //

View File

@ -301,8 +301,8 @@ DxeMain (
// Call constructor for all libraries // Call constructor for all libraries
// //
ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST); ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);
PERF_END (NULL,"PEI", NULL, 0) ; PERF_CROSSMODULE_END ("PEI");
PERF_START (NULL,"DXE", NULL, 0) ; PERF_CROSSMODULE_BEGIN ("DXE");
// //
// Report DXE Core image information to the PE/COFF Extra Action Library // Report DXE Core image information to the PE/COFF Extra Action Library
@ -499,16 +499,12 @@ DxeMain (
// //
// Initialize the DXE Dispatcher // Initialize the DXE Dispatcher
// //
PERF_START (NULL,"CoreInitializeDispatcher", "DxeMain", 0) ;
CoreInitializeDispatcher (); CoreInitializeDispatcher ();
PERF_END (NULL,"CoreInitializeDispatcher", "DxeMain", 0) ;
// //
// Invoke the DXE Dispatcher // Invoke the DXE Dispatcher
// //
PERF_START (NULL, "CoreDispatcher", "DxeMain", 0);
CoreDispatcher (); CoreDispatcher ();
PERF_END (NULL, "CoreDispatcher", "DxeMain", 0);
// //
// Display Architectural protocols that were not loaded if this is DEBUG build // Display Architectural protocols that were not loaded if this is DEBUG build

View File

@ -627,13 +627,13 @@ CoreConnectSingleController (
for (Index = 0; (Index < NumberOfSortedDriverBindingProtocols) && !DriverFound; Index++) { for (Index = 0; (Index < NumberOfSortedDriverBindingProtocols) && !DriverFound; Index++) {
if (SortedDriverBindingProtocols[Index] != NULL) { if (SortedDriverBindingProtocols[Index] != NULL) {
DriverBinding = SortedDriverBindingProtocols[Index]; DriverBinding = SortedDriverBindingProtocols[Index];
PERF_START (DriverBinding->DriverBindingHandle, "DB:Support:", NULL, 0); PERF_DRIVER_BINDING_SUPPORT_BEGIN (DriverBinding->DriverBindingHandle, ControllerHandle);
Status = DriverBinding->Supported( Status = DriverBinding->Supported(
DriverBinding, DriverBinding,
ControllerHandle, ControllerHandle,
RemainingDevicePath RemainingDevicePath
); );
PERF_END (DriverBinding->DriverBindingHandle, "DB:Support:", NULL, 0); PERF_DRIVER_BINDING_SUPPORT_END (DriverBinding->DriverBindingHandle, ControllerHandle);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
SortedDriverBindingProtocols[Index] = NULL; SortedDriverBindingProtocols[Index] = NULL;
DriverFound = TRUE; DriverFound = TRUE;
@ -642,13 +642,13 @@ CoreConnectSingleController (
// A driver was found that supports ControllerHandle, so attempt to start the driver // A driver was found that supports ControllerHandle, so attempt to start the driver
// on ControllerHandle. // on ControllerHandle.
// //
PERF_START (DriverBinding->DriverBindingHandle, "DB:Start:", NULL, 0); PERF_DRIVER_BINDING_START_BEGIN (DriverBinding->DriverBindingHandle, ControllerHandle);
Status = DriverBinding->Start ( Status = DriverBinding->Start (
DriverBinding, DriverBinding,
ControllerHandle, ControllerHandle,
RemainingDevicePath RemainingDevicePath
); );
PERF_END (DriverBinding->DriverBindingHandle, "DB:Start:", NULL, 0); PERF_DRIVER_BINDING_START_END (DriverBinding->DriverBindingHandle, ControllerHandle);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
// //

View File

@ -1436,13 +1436,9 @@ CoreLoadImage (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT64 Tick;
EFI_HANDLE Handle; EFI_HANDLE Handle;
Tick = 0; PERF_LOAD_IMAGE_BEGIN (NULL);
PERF_CODE (
Tick = GetPerformanceCounter ();
);
Status = CoreLoadImageCommon ( Status = CoreLoadImageCommon (
BootPolicy, BootPolicy,
@ -1465,8 +1461,7 @@ CoreLoadImage (
Handle = *ImageHandle; Handle = *ImageHandle;
} }
PERF_START (Handle, "LoadImage:", NULL, Tick); PERF_LOAD_IMAGE_END (Handle);
PERF_END (Handle, "LoadImage:", NULL, 0);
return Status; return Status;
} }
@ -1526,13 +1521,9 @@ CoreLoadImageEx (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINT64 Tick;
EFI_HANDLE Handle; EFI_HANDLE Handle;
Tick = 0; PERF_LOAD_IMAGE_BEGIN (NULL);
PERF_CODE (
Tick = GetPerformanceCounter ();
);
Status = CoreLoadImageCommon ( Status = CoreLoadImageCommon (
TRUE, TRUE,
@ -1555,8 +1546,7 @@ CoreLoadImageEx (
Handle = *ImageHandle; Handle = *ImageHandle;
} }
PERF_START (Handle, "LoadImage:", NULL, Tick); PERF_LOAD_IMAGE_END (Handle);
PERF_END (Handle, "LoadImage:", NULL, 0);
return Status; return Status;
} }
@ -1594,10 +1584,8 @@ CoreStartImage (
LOADED_IMAGE_PRIVATE_DATA *LastImage; LOADED_IMAGE_PRIVATE_DATA *LastImage;
UINT64 HandleDatabaseKey; UINT64 HandleDatabaseKey;
UINTN SetJumpFlag; UINTN SetJumpFlag;
UINT64 Tick;
EFI_HANDLE Handle; EFI_HANDLE Handle;
Tick = 0;
Handle = ImageHandle; Handle = ImageHandle;
Image = CoreLoadedImageInfo (ImageHandle); Image = CoreLoadedImageInfo (ImageHandle);
@ -1621,9 +1609,7 @@ CoreStartImage (
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
PERF_CODE ( PERF_START_IMAGE_BEGIN (Handle);
Tick = GetPerformanceCounter ();
);
// //
@ -1647,8 +1633,7 @@ CoreStartImage (
// Image may be unloaded after return with failure, // Image may be unloaded after return with failure,
// then ImageHandle may be invalid, so use NULL handle to record perf log. // then ImageHandle may be invalid, so use NULL handle to record perf log.
// //
PERF_START (NULL, "StartImage:", NULL, Tick); PERF_START_IMAGE_END (NULL);
PERF_END (NULL, "StartImage:", NULL, 0);
// //
// Pop the current start image context // Pop the current start image context
@ -1763,8 +1748,7 @@ CoreStartImage (
// //
// Done // Done
// //
PERF_START (Handle, "StartImage:", NULL, Tick); PERF_START_IMAGE_END (Handle);
PERF_END (Handle, "StartImage:", NULL, 0);
return Status; return Status;
} }

View File

@ -1000,9 +1000,9 @@ PeiDispatcher (
// //
PeimEntryPoint = (EFI_PEIM_ENTRY_POINT2)(UINTN)EntryPoint; PeimEntryPoint = (EFI_PEIM_ENTRY_POINT2)(UINTN)EntryPoint;
PERF_START (PeimFileHandle, "PEIM", NULL, 0); PERF_START_IMAGE_BEGIN (PeimFileHandle);
PeimEntryPoint(PeimFileHandle, (const EFI_PEI_SERVICES **) &Private->Ps); PeimEntryPoint(PeimFileHandle, (const EFI_PEI_SERVICES **) &Private->Ps);
PERF_END (PeimFileHandle, "PEIM", NULL, 0); PERF_START_IMAGE_END (PeimFileHandle);
} }
// //
@ -1109,7 +1109,7 @@ PeiDispatcher (
// The PEIM has its dependencies satisfied, and its entry point // The PEIM has its dependencies satisfied, and its entry point
// has been found, so invoke it. // has been found, so invoke it.
// //
PERF_START (PeimFileHandle, "PEIM", NULL, 0); PERF_START_IMAGE_BEGIN (PeimFileHandle);
REPORT_STATUS_CODE_WITH_EXTENDED_DATA ( REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
EFI_PROGRESS_CODE, EFI_PROGRESS_CODE,
@ -1145,7 +1145,7 @@ PeiDispatcher (
(VOID *)(&PeimFileHandle), (VOID *)(&PeimFileHandle),
sizeof (PeimFileHandle) sizeof (PeimFileHandle)
); );
PERF_END (PeimFileHandle, "PEIM", NULL, 0); PERF_START_IMAGE_END (PeimFileHandle);
} }
} }

View File

@ -352,18 +352,17 @@ PeiCore (
// Update performance measurements // Update performance measurements
// //
if (OldCoreData == NULL) { if (OldCoreData == NULL) {
PERF_START (NULL, "SEC", NULL, 1); PERF_EVENT ("SEC"); // Means the end of SEC phase.
PERF_END (NULL, "SEC", NULL, 0);
// //
// If first pass, start performance measurement. // If first pass, start performance measurement.
// //
PERF_START (NULL,"PEI", NULL, 0); PERF_CROSSMODULE_BEGIN ("PEI");
PERF_START (NULL,"PreMem", NULL, 0); PERF_INMODULE_BEGIN ("PreMem");
} else { } else {
PERF_END (NULL,"PreMem", NULL, 0); PERF_INMODULE_END ("PreMem");
PERF_START (NULL,"PostMem", NULL, 0); PERF_INMODULE_BEGIN ("PostMem");
} }
// //
@ -411,7 +410,7 @@ PeiCore (
// //
// Alert any listeners that there is permanent memory available // Alert any listeners that there is permanent memory available
// //
PERF_START (NULL,"DisMem", NULL, 0); PERF_INMODULE_BEGIN ("DisMem");
Status = PeiServicesInstallPpi (&mMemoryDiscoveredPpi); Status = PeiServicesInstallPpi (&mMemoryDiscoveredPpi);
// //
@ -419,7 +418,7 @@ PeiCore (
// //
ProcessNotifyList (&PrivateData); ProcessNotifyList (&PrivateData);
PERF_END (NULL,"DisMem", NULL, 0); PERF_INMODULE_END ("DisMem");
} }
// //
@ -437,7 +436,7 @@ PeiCore (
// //
// Measure PEI Core execution time. // Measure PEI Core execution time.
// //
PERF_END (NULL, "PostMem", NULL, 0); PERF_INMODULE_END ("PostMem");
// //
// Lookup DXE IPL PPI // Lookup DXE IPL PPI

View File

@ -321,12 +321,8 @@ SmmLoadImage (
EFI_DEVICE_PATH_PROTOCOL *HandleFilePath; EFI_DEVICE_PATH_PROTOCOL *HandleFilePath;
EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
UINT64 Tick;
Tick = 0; PERF_LOAD_IMAGE_BEGIN (DriverEntry->ImageHandle);
PERF_CODE (
Tick = GetPerformanceCounter ();
);
Buffer = NULL; Buffer = NULL;
Size = 0; Size = 0;
@ -641,8 +637,7 @@ SmmLoadImage (
&DriverEntry->SmmLoadedImage &DriverEntry->SmmLoadedImage
); );
PERF_START (DriverEntry->ImageHandle, "LoadImage:", NULL, Tick); PERF_LOAD_IMAGE_END (DriverEntry->ImageHandle);
PERF_END (DriverEntry->ImageHandle, "LoadImage:", NULL, 0);
// //
// Print the load address and the PDB file name if it is available // Print the load address and the PDB file name if it is available
@ -909,9 +904,9 @@ SmmDispatcher (
// For each SMM driver, pass NULL as ImageHandle // For each SMM driver, pass NULL as ImageHandle
// //
RegisterSmramProfileImage (DriverEntry, TRUE); RegisterSmramProfileImage (DriverEntry, TRUE);
PERF_START (DriverEntry->ImageHandle, "StartImage:", NULL, 0); PERF_START_IMAGE_BEGIN (DriverEntry->ImageHandle);
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint)(DriverEntry->ImageHandle, gST); Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint)(DriverEntry->ImageHandle, gST);
PERF_END (DriverEntry->ImageHandle, "StartImage:", NULL, 0); PERF_START_IMAGE_END (DriverEntry->ImageHandle);
if (EFI_ERROR(Status)){ if (EFI_ERROR(Status)){
UnregisterSmramProfileImage (DriverEntry, TRUE); UnregisterSmramProfileImage (DriverEntry, TRUE);
SmmFreePages(DriverEntry->ImageBuffer, DriverEntry->NumberOfPage); SmmFreePages(DriverEntry->ImageBuffer, DriverEntry->NumberOfPage);

View File

@ -644,7 +644,7 @@ SmmEntryPoint (
VOID *CommunicationBuffer; VOID *CommunicationBuffer;
UINTN BufferSize; UINTN BufferSize;
PERF_START (NULL, "SMM", NULL, 0) ; PERF_INMODULE_BEGIN ("SMM");
// //
// Update SMST with contents of the SmmEntryContext structure // Update SMST with contents of the SmmEntryContext structure
@ -739,7 +739,7 @@ SmmEntryPoint (
gSmmCorePrivate->InSmm = FALSE; gSmmCorePrivate->InSmm = FALSE;
} }
PERF_END (NULL, "SMM", NULL, 0) ; PERF_INMODULE_END ("SMM");
} }
/** /**

View File

@ -45,7 +45,7 @@ BmEndOfBdsPerfCode (
// //
// Record the performance data for End of BDS // Record the performance data for End of BDS
// //
PERF_END(NULL, "BDS", NULL, 0); PERF_CROSSMODULE_END("BDS");
return ; return ;
} }

View File

@ -722,23 +722,20 @@ EfiBootManagerConnectAllDefaultConsoles (
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
OneConnected = TRUE; OneConnected = TRUE;
} }
PERF_START (NULL, "ConOutReady", "BDS", 1); PERF_EVENT ("ConOutReady");
PERF_END (NULL, "ConOutReady", "BDS", 0);
Status = EfiBootManagerConnectConsoleVariable (ConIn); Status = EfiBootManagerConnectConsoleVariable (ConIn);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
OneConnected = TRUE; OneConnected = TRUE;
} }
PERF_START (NULL, "ConInReady", "BDS", 1); PERF_EVENT ("ConInReady");
PERF_END (NULL, "ConInReady", "BDS", 0);
Status = EfiBootManagerConnectConsoleVariable (ErrOut); Status = EfiBootManagerConnectConsoleVariable (ErrOut);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
OneConnected = TRUE; OneConnected = TRUE;
} }
PERF_START (NULL, "ErrOutReady", "BDS", 1); PERF_EVENT ("ErrOutReady");
PERF_END (NULL, "ErrOutReady", "BDS", 0);
SystemTableUpdated = FALSE; SystemTableUpdated = FALSE;
// //

View File

@ -725,8 +725,8 @@ BdsEntry (
// //
// Insert the performance probe // Insert the performance probe
// //
PERF_END (NULL, "DXE", NULL, 0); PERF_CROSSMODULE_END("DXE");
PERF_START (NULL, "BDS", NULL, 0); PERF_CROSSMODULE_BEGIN("BDS");
DEBUG ((EFI_D_INFO, "[Bds] Entry...\n")); DEBUG ((EFI_D_INFO, "[Bds] Entry...\n"));
// //
@ -888,9 +888,9 @@ BdsEntry (
// > Signal ReadyToLock event // > Signal ReadyToLock event
// > Authentication action: 1. connect Auth devices; 2. Identify auto logon user. // > Authentication action: 1. connect Auth devices; 2. Identify auto logon user.
// //
PERF_START (NULL, "PlatformBootManagerBeforeConsole", "BDS", 0); PERF_INMODULE_BEGIN("PlatformBootManagerBeforeConsole");
PlatformBootManagerBeforeConsole (); PlatformBootManagerBeforeConsole ();
PERF_END (NULL, "PlatformBootManagerBeforeConsole", "BDS", 0); PERF_INMODULE_END("PlatformBootManagerBeforeConsole");
// //
// Initialize hotkey service // Initialize hotkey service
@ -907,7 +907,7 @@ BdsEntry (
// //
// Connect consoles // Connect consoles
// //
PERF_START (NULL, "EfiBootManagerConnectAllDefaultConsoles", "BDS", 0); PERF_INMODULE_BEGIN("EfiBootManagerConnectAllDefaultConsoles");
if (PcdGetBool (PcdConInConnectOnDemand)) { if (PcdGetBool (PcdConInConnectOnDemand)) {
EfiBootManagerConnectConsoleVariable (ConOut); EfiBootManagerConnectConsoleVariable (ConOut);
EfiBootManagerConnectConsoleVariable (ErrOut); EfiBootManagerConnectConsoleVariable (ErrOut);
@ -917,7 +917,7 @@ BdsEntry (
} else { } else {
EfiBootManagerConnectAllDefaultConsoles (); EfiBootManagerConnectAllDefaultConsoles ();
} }
PERF_END (NULL, "EfiBootManagerConnectAllDefaultConsoles", "BDS", 0); PERF_INMODULE_END("EfiBootManagerConnectAllDefaultConsoles");
// //
// Do the platform specific action after the console is ready // Do the platform specific action after the console is ready
@ -930,9 +930,9 @@ BdsEntry (
// > Dispatch aditional option roms // > Dispatch aditional option roms
// > Special boot: e.g.: USB boot, enter UI // > Special boot: e.g.: USB boot, enter UI
// //
PERF_START (NULL, "PlatformBootManagerAfterConsole", "BDS", 0); PERF_INMODULE_BEGIN("PlatformBootManagerAfterConsole");
PlatformBootManagerAfterConsole (); PlatformBootManagerAfterConsole ();
PERF_END (NULL, "PlatformBootManagerAfterConsole", "BDS", 0); PERF_INMODULE_END("PlatformBootManagerAfterConsole");
// //
// Boot to Boot Manager Menu when EFI_OS_INDICATIONS_BOOT_TO_FW_UI is set. Skip HotkeyBoot // Boot to Boot Manager Menu when EFI_OS_INDICATIONS_BOOT_TO_FW_UI is set. Skip HotkeyBoot
// //
@ -1025,10 +1025,9 @@ BdsEntry (
// //
// Execute Key#### // Execute Key####
// //
PERF_START (NULL, "BdsWait", "BDS", 0); PERF_INMODULE_BEGIN ("BdsWait");
BdsWait (HotkeyTriggered); BdsWait (HotkeyTriggered);
PERF_END (NULL, "BdsWait", "BDS", 0); PERF_INMODULE_END ("BdsWait");
// //
// BdsReadKeys() can be removed after all keyboard drivers invoke callback in timer callback. // BdsReadKeys() can be removed after all keyboard drivers invoke callback in timer callback.
// //