X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FDynamicCommand%2FDpDynamicCommand%2FDp.c;h=d8451dbf59fa9f78160ca9ee540f60b112b37093;hb=d25cf17cea52ade0ab9e9e551cf8f03792ed1da5;hp=aa9c2cdf7a83b5a82bcf85c0b62f78ee112463d1;hpb=4109d0d7547b650670f67a56daec7a31f64e3d24;p=mirror_edk2.git diff --git a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c index aa9c2cdf7a..d8451dbf59 100644 --- a/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c +++ b/ShellPkg/DynamicCommand/DpDynamicCommand/Dp.c @@ -392,7 +392,7 @@ BuildCachedGuidHandleTable ( FreePool (HandleBuffer); HandleBuffer = NULL; } - return Status; + return EFI_SUCCESS; } /** @@ -674,6 +674,24 @@ InitCumulativeData ( } } +/** + Initialize the Summary data. + +**/ +VOID +InitSummaryData ( + VOID + ) +{ + SummaryData.NumTrace = 0; + SummaryData.NumProfile = 0 ; + SummaryData.NumIncomplete = 0; + SummaryData.NumSummary = 0; + SummaryData.NumHandles = 0; + SummaryData.NumPEIMs = 0; + SummaryData.NumGlobal = 0; +} + /** Dump performance data. @@ -731,35 +749,6 @@ RunDp ( Status = ShellInitialize(); ASSERT_EFI_ERROR(Status); - // - // DP dump performance data by parsing FPDT table in ACPI table. - // Folloing 3 steps are to get the measurement form the FPDT table. - // - - // - //1. Get FPDT from ACPI table. - // - Status = GetBootPerformanceTable (); - if (EFI_ERROR(Status)) { - return Status; - } - - // - //2. Cache the ModuleGuid and hanlde mapping table. - // - Status = BuildCachedGuidHandleTable(); - if (EFI_ERROR (Status)) { - return Status; - } - - // - //3. Build the measurement array form the FPDT records. - // - Status = BuildMeasurementList (); - if (EFI_ERROR(Status)) { - return Status; - } - // // Process Command Line arguments // @@ -811,11 +800,48 @@ RunDp ( #endif // PROFILING_IMPLEMENTED } + // + // DP dump performance data by parsing FPDT table in ACPI table. + // Folloing 3 steps are to get the measurement form the FPDT table. + // + + // + //1. Get FPDT from ACPI table. + // + Status = GetBootPerformanceTable (); + if (EFI_ERROR (Status)) { + ShellStatus = Status; + goto Done; + } + + // + //2. Cache the ModuleGuid and hanlde mapping table. + // + Status = BuildCachedGuidHandleTable(); + if (EFI_ERROR (Status)) { + ShellStatus = Status; + goto Done; + } + + // + //3. Build the measurement array form the FPDT records. + // + Status = BuildMeasurementList (); + if (EFI_ERROR (Status)) { + ShellStatus = SHELL_OUT_OF_RESOURCES; + goto Done; + } + // // Initialize the pre-defined cumulative data. // InitCumulativeData (); + // + // Initialize the Summary data. + // + InitSummaryData (); + // // Init the custom cumulative data. // @@ -823,7 +849,8 @@ RunDp ( if (CustomCumulativeToken != NULL) { CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA)); if (CustomCumulativeData == NULL) { - return SHELL_OUT_OF_RESOURCES; + ShellStatus = SHELL_OUT_OF_RESOURCES; + goto Done; } CustomCumulativeData->MinDur = PERF_MAXDUR; CustomCumulativeData->MaxDur = 0; @@ -832,8 +859,8 @@ RunDp ( NameSize = StrLen (CustomCumulativeToken) + 1; CustomCumulativeData->Name = AllocateZeroPool (NameSize); if (CustomCumulativeData->Name == NULL) { - FreePool (CustomCumulativeData); - return SHELL_OUT_OF_RESOURCES; + ShellStatus = SHELL_OUT_OF_RESOURCES; + goto Done; } UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize); }