summaryrefslogtreecommitdiffstats
path: root/PerformancePkg
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-19 01:42:32 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2011-04-19 01:42:32 +0000
commitb70e7ae019cd1371ffe66d1a5bbceac3fbf2d9b4 (patch)
tree500e65a21c6d87e25dad20c9fe9bfeb2d1fc930d /PerformancePkg
parent0d18fb2565ec66a35dbe6fce0df267f23c8ef9f0 (diff)
downloadedk2-b70e7ae019cd1371ffe66d1a5bbceac3fbf2d9b4.tar.gz
edk2-b70e7ae019cd1371ffe66d1a5bbceac3fbf2d9b4.tar.bz2
edk2-b70e7ae019cd1371ffe66d1a5bbceac3fbf2d9b4.zip
sync patch r10980, r11006, r11045, r11054 from main trunk.
Add security check to make code run safe. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010@11555 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'PerformancePkg')
-rw-r--r--PerformancePkg/Dp_App/Dp.c4
-rw-r--r--PerformancePkg/Dp_App/DpInternal.h2
-rw-r--r--PerformancePkg/Dp_App/DpTrace.c40
-rw-r--r--PerformancePkg/PerformancePkg.dsc1
4 files changed, 33 insertions, 14 deletions
diff --git a/PerformancePkg/Dp_App/Dp.c b/PerformancePkg/Dp_App/Dp.c
index 39eba4134c..6622aa5bb5 100644
--- a/PerformancePkg/Dp_App/Dp.c
+++ b/PerformancePkg/Dp_App/Dp.c
@@ -196,7 +196,7 @@ InitializeDp (
else {
// Boolean Options
VerboseMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_LV));
- SummaryMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_US) ||
+ SummaryMode = (BOOLEAN) (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_US) ||
ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_LS));
AllMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_UA));
RawMode = (ShellCommandLineGetFlag (ParamPackage, STR_DP_OPTION_UR));
@@ -262,7 +262,7 @@ InitializeDp (
(! RawMode)
) {
StringPtr = HiiGetString (gHiiHandle,
- TimerInfo.CountUp ? STRING_TOKEN (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN),
+ (EFI_STRING_ID) (TimerInfo.CountUp ? STRING_TOKEN (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN)),
NULL);
ASSERT (StringPtr != NULL);
PrintToken (STRING_TOKEN (STR_DP_TIMER_PROPERTIES), // Print Timer count range and direction
diff --git a/PerformancePkg/Dp_App/DpInternal.h b/PerformancePkg/Dp_App/DpInternal.h
index 8a4ce885cc..76abe99968 100644
--- a/PerformancePkg/Dp_App/DpInternal.h
+++ b/PerformancePkg/Dp_App/DpInternal.h
@@ -25,7 +25,7 @@ extern CHAR16 mGaugeString[DXE_PERFORMANCE_STRING_SIZE];
extern CHAR16 mUnicodeToken[PERF_TOKEN_LENGTH + 1];
extern UINT64 mInterestThreshold;
-extern PERF_SUMMARY_DATA SummaryData;; ///< Create the SummaryData structure and init. to ZERO.
+extern PERF_SUMMARY_DATA SummaryData; ///< Create the SummaryData structure and init. to ZERO.
/// Timer Specific Information.
extern TIMER_INFO TimerInfo;
diff --git a/PerformancePkg/Dp_App/DpTrace.c b/PerformancePkg/Dp_App/DpTrace.c
index 593c269f72..a5f5d0c874 100644
--- a/PerformancePkg/Dp_App/DpTrace.c
+++ b/PerformancePkg/Dp_App/DpTrace.c
@@ -50,7 +50,7 @@ GatherStatistics(
MEASUREMENT_RECORD Measurement;
UINT64 Duration;
UINTN LogEntryKey;
- UINTN TIndex;
+ INTN TIndex;
LogEntryKey = 0;
while ((LogEntryKey = GetPerformanceMeasurement (
@@ -143,11 +143,14 @@ DumpAllTrace(
// Get Handle information
//
Size = 0;
- HandleBuffer = NULL;
+ HandleBuffer = &TempHandle;
Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, &TempHandle);
if (Status == EFI_BUFFER_TOO_SMALL) {
HandleBuffer = AllocatePool (Size);
ASSERT (HandleBuffer != NULL);
+ if (HandleBuffer == NULL) {
+ return;
+ }
Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, HandleBuffer);
}
if (EFI_ERROR (Status)) {
@@ -222,7 +225,9 @@ DumpAllTrace(
);
}
}
- FreePool (HandleBuffer);
+ if (HandleBuffer != &TempHandle) {
+ FreePool (HandleBuffer);
+ }
}
/** Gather and print Raw Trace Records.
@@ -457,11 +462,14 @@ ProcessHandles(
(StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);
Size = 0;
- HandleBuffer = NULL;
+ HandleBuffer = &TempHandle;
Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, &TempHandle);
if (Status == EFI_BUFFER_TOO_SMALL) {
HandleBuffer = AllocatePool (Size);
ASSERT (HandleBuffer != NULL);
+ if (HandleBuffer == NULL) {
+ return Status;
+ }
Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, HandleBuffer);
}
if (EFI_ERROR (Status)) {
@@ -520,7 +528,9 @@ ProcessHandles(
}
}
}
- FreePool (HandleBuffer);
+ if (HandleBuffer != &TempHandle) {
+ FreePool (HandleBuffer);
+ }
return Status;
}
@@ -654,7 +664,10 @@ ProcessCumulative(
VOID
)
{
- UINT64 avgval; // the computed average duration
+ UINT64 AvgDur; // the computed average duration
+ UINT64 Dur;
+ UINT64 MinDur;
+ UINT64 MaxDur;
EFI_STRING StringPtr;
UINTN TIndex;
@@ -668,14 +681,19 @@ ProcessCumulative(
PrintToken (STRING_TOKEN (STR_DP_DASHES));
for ( TIndex = 0; TIndex < NumCum; ++TIndex) {
- avgval = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count);
+ AvgDur = DivU64x32 (CumData[TIndex].Duration, CumData[TIndex].Count);
+ AvgDur = DurationInMicroSeconds(AvgDur);
+ Dur = DurationInMicroSeconds(CumData[TIndex].Duration);
+ MaxDur = DurationInMicroSeconds(CumData[TIndex].MaxDur);
+ MinDur = DurationInMicroSeconds(CumData[TIndex].MinDur);
+
PrintToken (STRING_TOKEN (STR_DP_CUMULATIVE_STATS),
CumData[TIndex].Name,
CumData[TIndex].Count,
- DurationInMicroSeconds(CumData[TIndex].Duration),
- DurationInMicroSeconds(avgval),
- DurationInMicroSeconds(CumData[TIndex].MinDur),
- DurationInMicroSeconds(CumData[TIndex].MaxDur)
+ Dur,
+ AvgDur,
+ MinDur,
+ MaxDur
);
}
}
diff --git a/PerformancePkg/PerformancePkg.dsc b/PerformancePkg/PerformancePkg.dsc
index 77219a7f70..414c17e8cd 100644
--- a/PerformancePkg/PerformancePkg.dsc
+++ b/PerformancePkg/PerformancePkg.dsc
@@ -64,6 +64,7 @@
[LibraryClasses.IPF]
PalLib|MdePkg/Library/UefiPalLib/UefiPalLib.inf
+ TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
[Components.IA32, Components.X64]
PerformancePkg/Library/TscTimerLib/TscTimerLib.inf