diff options
author | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-05-30 10:48:50 +0000 |
---|---|---|
committer | lzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-05-30 10:48:50 +0000 |
commit | f3235b77e42b12fafeeb9588d8be684335ab5015 (patch) | |
tree | ec3f63801ed4e0523517d7efc1bfc62e60341a54 /MdeModulePkg/Core/Dxe | |
parent | 7ea7eee3a587eac3988f55ca0d79cefbc325c789 (diff) | |
download | edk2-f3235b77e42b12fafeeb9588d8be684335ab5015.zip edk2-f3235b77e42b12fafeeb9588d8be684335ab5015.tar.gz edk2-f3235b77e42b12fafeeb9588d8be684335ab5015.tar.bz2 |
Record LoadImage perf log for LoadImageEx() and use NULL as Handle to record StartImage perf log when StartImage() fails.
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13379 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Core/Dxe')
-rw-r--r-- | MdeModulePkg/Core/Dxe/Image/Image.c | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 9a14328..32f3898 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -1441,7 +1441,16 @@ CoreLoadImageEx ( IN UINT32 Attribute
)
{
- return CoreLoadImageCommon (
+ EFI_STATUS Status;
+ UINT64 Tick;
+ EFI_HANDLE Handle;
+
+ Tick = 0;
+ PERF_CODE (
+ Tick = GetPerformanceCounter ();
+ );
+
+ Status = CoreLoadImageCommon (
TRUE,
ParentImageHandle,
FilePath,
@@ -1453,6 +1462,19 @@ CoreLoadImageEx ( EntryPoint,
Attribute
);
+
+ Handle = NULL;
+ if (!EFI_ERROR (Status)) {
+ //
+ // ImageHandle will be valid only Status is success.
+ //
+ Handle = *ImageHandle;
+ }
+
+ PERF_START (Handle, "LoadImage:", NULL, Tick);
+ PERF_END (Handle, "LoadImage:", NULL, 0);
+
+ return Status;
}
@@ -1487,6 +1509,11 @@ CoreStartImage ( LOADED_IMAGE_PRIVATE_DATA *LastImage;
UINT64 HandleDatabaseKey;
UINTN SetJumpFlag;
+ UINT64 Tick;
+ EFI_HANDLE Handle;
+
+ Tick = 0;
+ Handle = ImageHandle;
Image = CoreLoadedImageInfo (ImageHandle);
if (Image == NULL || Image->Started) {
@@ -1506,10 +1533,9 @@ CoreStartImage ( return EFI_UNSUPPORTED;
}
- //
- // Don't profile Objects or invalid start requests
- //
- PERF_START (ImageHandle, "StartImage:", NULL, 0);
+ PERF_CODE (
+ Tick = GetPerformanceCounter ();
+ );
//
@@ -1529,7 +1555,12 @@ CoreStartImage ( //
Image->JumpBuffer = AllocatePool (sizeof (BASE_LIBRARY_JUMP_BUFFER) + BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT);
if (Image->JumpBuffer == NULL) {
- PERF_END (ImageHandle, "StartImage:", NULL, 0);
+ //
+ // Image may be unloaded after return with failure,
+ // then ImageHandle may be invalid, so use NULL handle to record perf log.
+ //
+ PERF_START (NULL, "StartImage:", NULL, Tick);
+ PERF_END (NULL, "StartImage:", NULL, 0);
return EFI_OUT_OF_RESOURCES;
}
Image->JumpContext = ALIGN_POINTER (Image->JumpBuffer, BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT);
@@ -1620,12 +1651,17 @@ CoreStartImage ( //
if (EFI_ERROR (Image->Status) || Image->Type == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
CoreUnloadAndCloseImage (Image, TRUE);
+ //
+ // ImageHandle may be invalid after the image is unloaded, so use NULL handle to record perf log.
+ //
+ Handle = NULL;
}
//
// Done
//
- PERF_END (ImageHandle, "StartImage:", NULL, 0);
+ PERF_START (Handle, "StartImage:", NULL, Tick);
+ PERF_END (Handle, "StartImage:", NULL, 0);
return Status;
}
|