UINTN NameSize;\r
SHELL_STATUS ShellStatus;\r
TIMER_INFO TimerInfo;\r
+ UINT64 Intermediate;\r
\r
StringPtr = NULL;\r
SummaryMode = FALSE;\r
if (EFI_ERROR(Status)) {\r
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_ARG), mDpHiiHandle);\r
return SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetCount(ParamPackage) > 1){\r
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_MANY), mDpHiiHandle);\r
+ return SHELL_INVALID_PARAMETER;\r
}\r
\r
//\r
mShowId = ShellCommandLineGetFlag (ParamPackage, L"-i");\r
CumulativeMode = ShellCommandLineGetFlag (ParamPackage, L"-c");\r
\r
+ if (AllMode && RawMode) {\r
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_CONFLICT_ARG), mDpHiiHandle, L"-A", L"-R");\r
+ return SHELL_INVALID_PARAMETER;\r
+ }\r
+\r
// Options with Values\r
- CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n");\r
- if (CmdLineArg == NULL) {\r
- Number2Display = DEFAULT_DISPLAYCOUNT;\r
- } else {\r
- Number2Display = StrDecimalToUintn(CmdLineArg);\r
- if (Number2Display == 0) {\r
- Number2Display = MAXIMUM_DISPLAYCOUNT;\r
+ if (ShellCommandLineGetFlag (ParamPackage, L"-n")) {\r
+ CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-n");\r
+ if (CmdLineArg == NULL) {\r
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_FEW), mDpHiiHandle);\r
+ return SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ if (!(RawMode || AllMode)) {\r
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_NO_RAW_ALL), mDpHiiHandle);\r
+ return SHELL_INVALID_PARAMETER;\r
+ }\r
+ Status = ShellConvertStringToUint64(CmdLineArg, &Intermediate, FALSE, TRUE);\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_NUM_ARG), mDpHiiHandle, L"-n");\r
+ return SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ Number2Display = (UINTN)Intermediate;\r
+ if (Number2Display == 0 || Number2Display > MAXIMUM_DISPLAYCOUNT) {\r
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_RANGE), mDpHiiHandle, L"-n", 0, MAXIMUM_DISPLAYCOUNT);\r
+ return SHELL_INVALID_PARAMETER;\r
+ }\r
+ }\r
}\r
+ } else {\r
+ Number2Display = DEFAULT_DISPLAYCOUNT;\r
}\r
\r
- CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-t");\r
- if (CmdLineArg == NULL) {\r
- mInterestThreshold = DEFAULT_THRESHOLD; // 1ms := 1,000 us\r
+ if (ShellCommandLineGetFlag (ParamPackage, L"-t")) {\r
+ CmdLineArg = ShellCommandLineGetValue (ParamPackage, L"-t");\r
+ if (CmdLineArg == NULL) {\r
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_FEW), mDpHiiHandle);\r
+ return SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ Status = ShellConvertStringToUint64(CmdLineArg, &Intermediate, FALSE, TRUE);\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_INVALID_NUM_ARG), mDpHiiHandle, L"-t");\r
+ return SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ mInterestThreshold = Intermediate;\r
+ }\r
+ }\r
} else {\r
- mInterestThreshold = StrDecimalToUint64(CmdLineArg);\r
+ mInterestThreshold = DEFAULT_THRESHOLD; // 1ms := 1,000 us\r
}\r
\r
+ if (ShellCommandLineGetFlag (ParamPackage, L"-c")) {\r
+ CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"-c");\r
+ if (CustomCumulativeToken == NULL) {\r
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_TOO_FEW), mDpHiiHandle);\r
+ return SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA));\r
+ if (CustomCumulativeData == NULL) {\r
+ ShellStatus = SHELL_OUT_OF_RESOURCES;\r
+ goto Done;\r
+ }\r
+ CustomCumulativeData->MinDur = PERF_MAXDUR;\r
+ CustomCumulativeData->MaxDur = 0;\r
+ CustomCumulativeData->Count = 0;\r
+ CustomCumulativeData->Duration = 0;\r
+ NameSize = StrLen (CustomCumulativeToken) + 1;\r
+ CustomCumulativeData->Name = AllocateZeroPool (NameSize);\r
+ if (CustomCumulativeData->Name == NULL) {\r
+ ShellStatus = SHELL_OUT_OF_RESOURCES;\r
+ goto Done;\r
+ }\r
+ UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize);\r
+ }\r
+ }\r
\r
//\r
// DP dump performance data by parsing FPDT table in ACPI table.\r
//\r
InitSummaryData ();\r
\r
- //\r
- // Init the custom cumulative data.\r
- //\r
- CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"-c");\r
- if (CustomCumulativeToken != NULL) {\r
- CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA));\r
- if (CustomCumulativeData == NULL) {\r
- ShellStatus = SHELL_OUT_OF_RESOURCES;\r
- goto Done;\r
- }\r
- CustomCumulativeData->MinDur = PERF_MAXDUR;\r
- CustomCumulativeData->MaxDur = 0;\r
- CustomCumulativeData->Count = 0;\r
- CustomCumulativeData->Duration = 0;\r
- NameSize = StrLen (CustomCumulativeToken) + 1;\r
- CustomCumulativeData->Name = AllocateZeroPool (NameSize);\r
- if (CustomCumulativeData->Name == NULL) {\r
- ShellStatus = SHELL_OUT_OF_RESOURCES;\r
- goto Done;\r
- }\r
- UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize);\r
- }\r
-\r
//\r
// Timer specific processing\r
//\r