]> git.proxmox.com Git - mirror_edk2.git/blob - PerformancePkg/Dp_App/Dp.c
PerformancePkg: Make Dp print help information with -? flag in Shell.
[mirror_edk2.git] / PerformancePkg / Dp_App / Dp.c
1 /** @file
2 Shell application for Displaying Performance Metrics.
3
4 The Dp application reads performance data and presents it in several
5 different formats depending upon the needs of the user. Both
6 Trace and Measured Profiling information is processed and presented.
7
8 Dp uses the "PerformanceLib" to read the measurement records.
9 The "TimerLib" provides information about the timer, such as frequency,
10 beginning, and ending counter values.
11 Measurement records contain identifying information (Handle, Token, Module)
12 and start and end time values.
13 Dp uses this information to group records in different ways. It also uses
14 timer information to calculate elapsed time for each measurement.
15
16 Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
17 (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
18 This program and the accompanying materials
19 are licensed and made available under the terms and conditions of the BSD License
20 which accompanies this distribution. The full text of the license may be found at
21 http://opensource.org/licenses/bsd-license.php
22
23 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
24 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 **/
26
27 #include <Library/UefiApplicationEntryPoint.h>
28 #include <Library/UefiBootServicesTableLib.h>
29 #include <Library/ShellLib.h>
30 #include <Library/BaseLib.h>
31 #include <Library/MemoryAllocationLib.h>
32 #include <Library/DebugLib.h>
33 #include <Library/TimerLib.h>
34 #include <Library/UefiLib.h>
35 #include <Library/UefiHiiServicesLib.h>
36 #include <Library/HiiLib.h>
37 #include <Library/PcdLib.h>
38
39 #include <Guid/Performance.h>
40
41 #include <PerformanceTokens.h>
42 #include "Dp.h"
43 #include "Literals.h"
44 #include "DpInternal.h"
45
46 //
47 // String token ID of help message text.
48 // Shell supports to find help message in the resource section of an application image if
49 // .MAN file is not found. This global variable is added to make build tool recognizes
50 // that the help string is consumed by user and then build tool will add the string into
51 // the resource section. Thus the application can use '-?' option to show help message in
52 // Shell.
53 //
54 GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mDpStrEngHelpTokenId = STRING_TOKEN (STR_DP_HELP_INFORMATION);
55
56 //
57 /// Module-Global Variables
58 ///@{
59 EFI_HII_HANDLE gHiiHandle;
60 SHELL_PARAM_ITEM *DpParamList = NULL;
61 CHAR16 *mPrintTokenBuffer = NULL;
62 CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];
63 CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];
64 UINT64 mInterestThreshold;
65 BOOLEAN mShowId = FALSE;
66
67 PERF_SUMMARY_DATA SummaryData = { 0 }; ///< Create the SummaryData structure and init. to ZERO.
68
69 /// Timer Specific Information.
70 TIMER_INFO TimerInfo;
71
72 /// Items for which to gather cumulative statistics.
73 PERF_CUM_DATA CumData[] = {
74 PERF_INIT_CUM_DATA (LOAD_IMAGE_TOK),
75 PERF_INIT_CUM_DATA (START_IMAGE_TOK),
76 PERF_INIT_CUM_DATA (DRIVERBINDING_START_TOK),
77 PERF_INIT_CUM_DATA (DRIVERBINDING_SUPPORT_TOK)
78 };
79
80 /// Number of items for which we are gathering cumulative statistics.
81 UINT32 const NumCum = sizeof(CumData) / sizeof(PERF_CUM_DATA);
82
83 PARAM_ITEM_LIST ParamList[] = {
84 {STRING_TOKEN (STR_DP_OPTION_QH), TypeFlag}, // -? Help
85 {STRING_TOKEN (STR_DP_OPTION_LH), TypeFlag}, // -h Help
86 {STRING_TOKEN (STR_DP_OPTION_UH), TypeFlag}, // -H Help
87 {STRING_TOKEN (STR_DP_OPTION_LV), TypeFlag}, // -v Verbose Mode
88 {STRING_TOKEN (STR_DP_OPTION_UA), TypeFlag}, // -A All, Cooked
89 {STRING_TOKEN (STR_DP_OPTION_UR), TypeFlag}, // -R RAW All
90 {STRING_TOKEN (STR_DP_OPTION_LS), TypeFlag}, // -s Summary
91 #if PROFILING_IMPLEMENTED
92 {STRING_TOKEN (STR_DP_OPTION_UP), TypeFlag}, // -P Dump Profile Data
93 {STRING_TOKEN (STR_DP_OPTION_UT), TypeFlag}, // -T Dump Trace Data
94 #endif
95 {STRING_TOKEN (STR_DP_OPTION_LX), TypeFlag}, // -x eXclude Cumulative Items
96 {STRING_TOKEN (STR_DP_OPTION_LI), TypeFlag}, // -i Display Identifier
97 {STRING_TOKEN (STR_DP_OPTION_LC), TypeValue}, // -c Display cumulative data.
98 {STRING_TOKEN (STR_DP_OPTION_LN), TypeValue}, // -n # Number of records to display for A and R
99 {STRING_TOKEN (STR_DP_OPTION_LT), TypeValue} // -t # Threshold of interest
100 };
101
102 ///@}
103
104 /**
105 Transfer the param list value and get the command line parse.
106
107 **/
108 VOID
109 InitialShellParamList( void )
110 {
111 UINT32 ListIndex;
112 UINT32 ListLength;
113
114 //
115 // Allocate one more for the end tag.
116 //
117 ListLength = sizeof (ParamList) / sizeof (ParamList[0]) + 1;
118 DpParamList = AllocatePool (sizeof (SHELL_PARAM_ITEM) * ListLength);
119 ASSERT (DpParamList != NULL);
120
121 for (ListIndex = 0; ListIndex < ListLength - 1; ListIndex ++)
122 {
123 DpParamList[ListIndex].Name = HiiGetString (gHiiHandle, ParamList[ListIndex].Token, NULL);
124 DpParamList[ListIndex].Type = ParamList[ListIndex].Type;
125 }
126 DpParamList[ListIndex].Name = NULL;
127 DpParamList[ListIndex].Type = TypeMax;
128 }
129
130 /**
131 Display Usage and Help information.
132 **/
133 VOID
134 ShowHelp( void )
135 {
136 PrintToken (STRING_TOKEN (STR_DP_HELP_HEAD));
137 #if PROFILING_IMPLEMENTED
138 PrintToken (STRING_TOKEN (STR_DP_HELP_FLAGS));
139 #else
140 PrintToken (STRING_TOKEN (STR_DP_HELP_FLAGS_2));
141 #endif // PROFILING_IMPLEMENTED
142 PrintToken (STRING_TOKEN (STR_DP_HELP_PAGINATE));
143 PrintToken (STRING_TOKEN (STR_DP_HELP_VERBOSE));
144 PrintToken (STRING_TOKEN (STR_DP_HELP_EXCLUDE));
145 PrintToken (STRING_TOKEN (STR_DP_HELP_STAT));
146 PrintToken (STRING_TOKEN (STR_DP_HELP_ALL));
147 PrintToken (STRING_TOKEN (STR_DP_HELP_RAW));
148 #if PROFILING_IMPLEMENTED
149 PrintToken (STRING_TOKEN (STR_DP_HELP_TRACE));
150 PrintToken (STRING_TOKEN (STR_DP_HELP_PROFILE));
151 #endif // PROFILING_IMPLEMENTED
152 PrintToken (STRING_TOKEN (STR_DP_HELP_THRESHOLD));
153 PrintToken (STRING_TOKEN (STR_DP_HELP_COUNT));
154 PrintToken (STRING_TOKEN (STR_DP_HELP_ID));
155 PrintToken (STRING_TOKEN (STR_DP_HELP_CUM_DATA));
156 PrintToken (STRING_TOKEN (STR_DP_HELP_HELP));
157 Print(L"\n");
158 }
159
160 /**
161 Display the trailing Verbose information.
162 **/
163 VOID
164 DumpStatistics( void )
165 {
166 EFI_STRING StringPtr;
167 EFI_STRING StringPtrUnknown;
168 StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_STATISTICS), NULL);
169 StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);
170 PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),
171 (StringPtr == NULL) ? StringPtrUnknown : StringPtr);
172
173 PrintToken( STRING_TOKEN (STR_DP_STATS_NUMTRACE), SummaryData.NumTrace);
174 PrintToken( STRING_TOKEN (STR_DP_STATS_NUMINCOMPLETE), SummaryData.NumIncomplete);
175 PrintToken( STRING_TOKEN (STR_DP_STATS_NUMPHASES), SummaryData.NumSummary);
176 PrintToken( STRING_TOKEN (STR_DP_STATS_NUMHANDLES), SummaryData.NumHandles, SummaryData.NumTrace - SummaryData.NumHandles);
177 PrintToken( STRING_TOKEN (STR_DP_STATS_NUMPEIMS), SummaryData.NumPEIMs);
178 PrintToken( STRING_TOKEN (STR_DP_STATS_NUMGLOBALS), SummaryData.NumGlobal);
179 #if PROFILING_IMPLEMENTED
180 PrintToken( STRING_TOKEN (STR_DP_STATS_NUMPROFILE), SummaryData.NumProfile);
181 #endif // PROFILING_IMPLEMENTED
182 FreePool (StringPtr);
183 FreePool (StringPtrUnknown);
184 }
185
186 /**
187 Initialize the cumulative data.
188
189 **/
190 VOID
191 InitCumulativeData (
192 VOID
193 )
194 {
195 UINTN Index;
196
197 for (Index = 0; Index < NumCum; ++Index) {
198 CumData[Index].Count = 0;
199 CumData[Index].MinDur = PERF_MAXDUR;
200 CumData[Index].MaxDur = 0;
201 CumData[Index].Duration = 0;
202 }
203 }
204
205 /**
206 Dump performance data.
207
208 @param[in] ImageHandle The image handle.
209 @param[in] SystemTable The system table.
210
211 @retval EFI_SUCCESS Command completed successfully.
212 @retval EFI_INVALID_PARAMETER Command usage error.
213 @retval EFI_ABORTED The user aborts the operation.
214 @retval value Unknown error.
215 **/
216 EFI_STATUS
217 EFIAPI
218 InitializeDp (
219 IN EFI_HANDLE ImageHandle,
220 IN EFI_SYSTEM_TABLE *SystemTable
221 )
222 {
223 UINT64 Freq;
224 UINT64 Ticker;
225 UINT32 ListIndex;
226
227 LIST_ENTRY *ParamPackage;
228 CONST CHAR16 *CmdLineArg;
229 EFI_STRING StringPtr;
230 UINTN Number2Display;
231
232 EFI_STATUS Status;
233 BOOLEAN SummaryMode;
234 BOOLEAN VerboseMode;
235 BOOLEAN AllMode;
236 BOOLEAN RawMode;
237 BOOLEAN TraceMode;
238 BOOLEAN ProfileMode;
239 BOOLEAN ExcludeMode;
240 BOOLEAN CumulativeMode;
241 CONST CHAR16 *CustomCumulativeToken;
242 PERF_CUM_DATA *CustomCumulativeData;
243 EFI_HII_PACKAGE_LIST_HEADER *PackageList;
244
245 EFI_STRING StringDpOptionQh;
246 EFI_STRING StringDpOptionLh;
247 EFI_STRING StringDpOptionUh;
248 EFI_STRING StringDpOptionLv;
249 EFI_STRING StringDpOptionUs;
250 EFI_STRING StringDpOptionLs;
251 EFI_STRING StringDpOptionUa;
252 EFI_STRING StringDpOptionUr;
253 EFI_STRING StringDpOptionUt;
254 EFI_STRING StringDpOptionUp;
255 EFI_STRING StringDpOptionLx;
256 EFI_STRING StringDpOptionLn;
257 EFI_STRING StringDpOptionLt;
258 EFI_STRING StringDpOptionLi;
259 EFI_STRING StringDpOptionLc;
260
261 SummaryMode = FALSE;
262 VerboseMode = FALSE;
263 AllMode = FALSE;
264 RawMode = FALSE;
265 TraceMode = FALSE;
266 ProfileMode = FALSE;
267 ExcludeMode = FALSE;
268 CumulativeMode = FALSE;
269 CustomCumulativeData = NULL;
270
271 StringDpOptionQh = NULL;
272 StringDpOptionLh = NULL;
273 StringDpOptionUh = NULL;
274 StringDpOptionLv = NULL;
275 StringDpOptionUs = NULL;
276 StringDpOptionLs = NULL;
277 StringDpOptionUa = NULL;
278 StringDpOptionUr = NULL;
279 StringDpOptionUt = NULL;
280 StringDpOptionUp = NULL;
281 StringDpOptionLx = NULL;
282 StringDpOptionLn = NULL;
283 StringDpOptionLt = NULL;
284 StringDpOptionLi = NULL;
285 StringDpOptionLc = NULL;
286 StringPtr = NULL;
287
288 // Get DP's entry time as soon as possible.
289 // This is used as the Shell-Phase end time.
290 //
291 Ticker = GetPerformanceCounter ();
292
293 //
294 // Retrieve HII package list from ImageHandle
295 //
296 Status = gBS->OpenProtocol (
297 ImageHandle,
298 &gEfiHiiPackageListProtocolGuid,
299 (VOID **) &PackageList,
300 ImageHandle,
301 NULL,
302 EFI_OPEN_PROTOCOL_GET_PROTOCOL
303 );
304 if (EFI_ERROR (Status)) {
305 return Status;
306 }
307
308 //
309 // Publish HII package list to HII Database.
310 //
311 Status = gHiiDatabase->NewPackageList (
312 gHiiDatabase,
313 PackageList,
314 NULL,
315 &gHiiHandle
316 );
317 if (EFI_ERROR (Status)) {
318 return Status;
319 }
320 ASSERT (gHiiHandle != NULL);
321
322
323 // Initial the command list
324 //
325 InitialShellParamList ();
326
327 /****************************************************************************
328 **** Process Command Line arguments ****
329 ****************************************************************************/
330 Status = ShellCommandLineParse (DpParamList, &ParamPackage, NULL, TRUE);
331
332 if (EFI_ERROR(Status)) {
333 PrintToken (STRING_TOKEN (STR_DP_INVALID_ARG));
334 ShowHelp();
335 }
336 else {
337 StringDpOptionQh = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_QH), NULL);
338 StringDpOptionLh = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LH), NULL);
339 StringDpOptionUh = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UH), NULL);
340
341 if (ShellCommandLineGetFlag (ParamPackage, StringDpOptionQh) ||
342 ShellCommandLineGetFlag (ParamPackage, StringDpOptionLh) ||
343 ShellCommandLineGetFlag (ParamPackage, StringDpOptionUh))
344 {
345 ShowHelp();
346 }
347 else {
348 StringDpOptionLv = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LV), NULL);
349 StringDpOptionUs = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_US), NULL);
350 StringDpOptionLs = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LS), NULL);
351 StringDpOptionUa = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UA), NULL);
352 StringDpOptionUr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UR), NULL);
353 StringDpOptionUt = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UT), NULL);
354 StringDpOptionUp = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_UP), NULL);
355 StringDpOptionLx = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LX), NULL);
356 StringDpOptionLn = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LN), NULL);
357 StringDpOptionLt = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LT), NULL);
358 StringDpOptionLi = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LI), NULL);
359 StringDpOptionLc = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_OPTION_LC), NULL);
360
361 // Boolean Options
362 //
363 VerboseMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLv);
364 SummaryMode = (BOOLEAN) (ShellCommandLineGetFlag (ParamPackage, StringDpOptionUs) ||
365 ShellCommandLineGetFlag (ParamPackage, StringDpOptionLs));
366 AllMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUa);
367 RawMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUr);
368 #if PROFILING_IMPLEMENTED
369 TraceMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUt);
370 ProfileMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionUp);
371 #endif // PROFILING_IMPLEMENTED
372 ExcludeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLx);
373 mShowId = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLi);
374 CumulativeMode = ShellCommandLineGetFlag (ParamPackage, StringDpOptionLc);
375
376 // Options with Values
377 CmdLineArg = ShellCommandLineGetValue (ParamPackage, StringDpOptionLn);
378 if (CmdLineArg == NULL) {
379 Number2Display = DEFAULT_DISPLAYCOUNT;
380 }
381 else {
382 Number2Display = StrDecimalToUintn(CmdLineArg);
383 if (Number2Display == 0) {
384 Number2Display = MAXIMUM_DISPLAYCOUNT;
385 }
386 }
387 CmdLineArg = ShellCommandLineGetValue (ParamPackage, StringDpOptionLt);
388 if (CmdLineArg == NULL) {
389 mInterestThreshold = DEFAULT_THRESHOLD; // 1ms := 1,000 us
390 }
391 else {
392 mInterestThreshold = StrDecimalToUint64(CmdLineArg);
393 }
394 // Handle Flag combinations and default behaviors
395 // If both TraceMode and ProfileMode are FALSE, set them both to TRUE
396 if ((! TraceMode) && (! ProfileMode)) {
397 TraceMode = TRUE;
398 #if PROFILING_IMPLEMENTED
399 ProfileMode = TRUE;
400 #endif // PROFILING_IMPLEMENTED
401 }
402
403 //
404 // Init the custom cumulative data.
405 //
406 CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, StringDpOptionLc);
407 if (CustomCumulativeToken != NULL) {
408 CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA));
409 ASSERT (CustomCumulativeData != NULL);
410 CustomCumulativeData->MinDur = 0;
411 CustomCumulativeData->MaxDur = 0;
412 CustomCumulativeData->Count = 0;
413 CustomCumulativeData->Duration = 0;
414 CustomCumulativeData->Name = AllocateZeroPool (StrLen (CustomCumulativeToken) + 1);
415 UnicodeStrToAsciiStr (CustomCumulativeToken, CustomCumulativeData->Name);
416 }
417
418 /****************************************************************************
419 **** Timer specific processing ****
420 ****************************************************************************/
421 // Get the Performance counter characteristics:
422 // Freq = Frequency in Hz
423 // StartCount = Value loaded into the counter when it starts counting
424 // EndCount = Value counter counts to before it needs to be reset
425 //
426 Freq = GetPerformanceCounterProperties (&TimerInfo.StartCount, &TimerInfo.EndCount);
427
428 // Convert the Frequency from Hz to KHz
429 TimerInfo.Frequency = (UINT32)DivU64x32 (Freq, 1000);
430
431 // Determine in which direction the performance counter counts.
432 TimerInfo.CountUp = (BOOLEAN) (TimerInfo.EndCount >= TimerInfo.StartCount);
433
434 /****************************************************************************
435 **** Print heading ****
436 ****************************************************************************/
437 // print DP's build version
438 PrintToken (STRING_TOKEN (STR_DP_BUILD_REVISION), DP_MAJOR_VERSION, DP_MINOR_VERSION);
439
440 // print performance timer characteristics
441 PrintToken (STRING_TOKEN (STR_DP_KHZ), TimerInfo.Frequency); // Print Timer frequency in KHz
442
443 if ((VerboseMode) &&
444 (! RawMode)
445 ) {
446 StringPtr = HiiGetString (gHiiHandle,
447 (EFI_STRING_ID) (TimerInfo.CountUp ? STRING_TOKEN (STR_DP_UP) : STRING_TOKEN (STR_DP_DOWN)),
448 NULL);
449 ASSERT (StringPtr != NULL);
450 PrintToken (STRING_TOKEN (STR_DP_TIMER_PROPERTIES), // Print Timer count range and direction
451 StringPtr,
452 TimerInfo.StartCount,
453 TimerInfo.EndCount
454 );
455 PrintToken (STRING_TOKEN (STR_DP_VERBOSE_THRESHOLD), mInterestThreshold);
456 }
457
458 /* **************************************************************************
459 **** Print Sections based on command line options
460 ****
461 **** Option modes have the following priority:
462 **** v Verbose -- Valid in combination with any other options
463 **** t Threshold -- Modifies All, Raw, and Cooked output
464 **** Default is 0 for All and Raw mode
465 **** Default is DEFAULT_THRESHOLD for "Cooked" mode
466 **** n Number2Display Used by All and Raw mode. Otherwise ignored.
467 **** A All -- R and S options are ignored
468 **** R Raw -- S option is ignored
469 **** s Summary -- Modifies "Cooked" output only
470 **** Cooked (Default)
471 ****
472 **** The All, Raw, and Cooked modes are modified by the Trace and Profile
473 **** options.
474 **** !T && !P := (0) Default, Both are displayed
475 **** T && !P := (1) Only Trace records are displayed
476 **** !T && P := (2) Only Profile records are displayed
477 **** T && P := (3) Same as Default, both are displayed
478 ****************************************************************************/
479 GatherStatistics (CustomCumulativeData);
480 if (CumulativeMode) {
481 ProcessCumulative (CustomCumulativeData);
482 } else if (AllMode) {
483 if (TraceMode) {
484 Status = DumpAllTrace( Number2Display, ExcludeMode);
485 if (Status == EFI_ABORTED) {
486 goto Done;
487 }
488 }
489 if (ProfileMode) {
490 DumpAllProfile( Number2Display, ExcludeMode);
491 }
492 }
493 else if (RawMode) {
494 if (TraceMode) {
495 Status = DumpRawTrace( Number2Display, ExcludeMode);
496 if (Status == EFI_ABORTED) {
497 goto Done;
498 }
499 }
500 if (ProfileMode) {
501 DumpRawProfile( Number2Display, ExcludeMode);
502 }
503 }
504 else {
505 //------------- Begin Cooked Mode Processing
506 if (TraceMode) {
507 ProcessPhases ( Ticker );
508 if ( ! SummaryMode) {
509 Status = ProcessHandles ( ExcludeMode);
510 if (Status == EFI_ABORTED) {
511 goto Done;
512 }
513
514 Status = ProcessPeims ();
515 if (Status == EFI_ABORTED) {
516 goto Done;
517 }
518
519 Status = ProcessGlobal ();
520 if (Status == EFI_ABORTED) {
521 goto Done;
522 }
523
524 ProcessCumulative (NULL);
525 }
526 }
527 if (ProfileMode) {
528 DumpAllProfile( Number2Display, ExcludeMode);
529 }
530 } //------------- End of Cooked Mode Processing
531 if ( VerboseMode || SummaryMode) {
532 DumpStatistics();
533 }
534 }
535 }
536
537 Done:
538
539 //
540 // Free the memory allocate from HiiGetString
541 //
542 ListIndex = 0;
543 while (DpParamList[ListIndex].Name != NULL) {
544 FreePool (DpParamList[ListIndex].Name);
545 ListIndex ++;
546 }
547 FreePool (DpParamList);
548
549 SafeFreePool (StringDpOptionQh);
550 SafeFreePool (StringDpOptionLh);
551 SafeFreePool (StringDpOptionUh);
552 SafeFreePool (StringDpOptionLv);
553 SafeFreePool (StringDpOptionUs);
554 SafeFreePool (StringDpOptionLs);
555 SafeFreePool (StringDpOptionUa);
556 SafeFreePool (StringDpOptionUr);
557 SafeFreePool (StringDpOptionUt);
558 SafeFreePool (StringDpOptionUp);
559 SafeFreePool (StringDpOptionLx);
560 SafeFreePool (StringDpOptionLn);
561 SafeFreePool (StringDpOptionLt);
562 SafeFreePool (StringDpOptionLi);
563 SafeFreePool (StringDpOptionLc);
564 SafeFreePool (StringPtr);
565 SafeFreePool (mPrintTokenBuffer);
566
567 if (ParamPackage != NULL) {
568 ShellCommandLineFreeVarList (ParamPackage);
569 }
570 if (CustomCumulativeData != NULL) {
571 SafeFreePool (CustomCumulativeData->Name);
572 }
573 SafeFreePool (CustomCumulativeData);
574
575 HiiRemovePackages (gHiiHandle);
576 return Status;
577 }