]> git.proxmox.com Git - mirror_edk2.git/blame - PerformancePkg/Dp_App/DpProfile.c
Move some define code to the uni file. Also fixed some memory leak.
[mirror_edk2.git] / PerformancePkg / Dp_App / DpProfile.c
CommitLineData
c06ad33e 1/** @file\r
2 * Measured Profiling reporting for the Dp utility.\r
3 *\r
92ea1df8 4 * Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
c06ad33e 5 * This program and the accompanying materials\r
6 * are licensed and made available under the terms and conditions of the BSD License\r
7 * which accompanies this distribution. The full text of the license may be found at\r
8 * http://opensource.org/licenses/bsd-license.php\r
9 *\r
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12**/\r
13\r
14#include <Library/BaseLib.h>\r
15#include <Library/BaseMemoryLib.h>\r
16#include <Library/MemoryAllocationLib.h>\r
17#include <Library/DebugLib.h>\r
18#include <Library/UefiBootServicesTableLib.h>\r
19#include <Library/TimerLib.h>\r
20#include <Library/PeCoffGetEntryPointLib.h>\r
21#include <Library/PerformanceLib.h>\r
22#include <Library/PrintLib.h>\r
23#include <Library/HiiLib.h>\r
24#include <Library/PcdLib.h>\r
25\r
26#include <Guid/Performance.h>\r
27\r
28#include "Dp.h"\r
29#include "Literals.h"\r
30#include "DpInternal.h"\r
31\r
9dd74618
ED
32/** \r
33 Gather and print ALL Profiling Records.\r
34 \r
35 Displays all "interesting" Profile measurements in order.\r
36 The number of records displayed is controlled by:\r
37 - records with a duration less than mInterestThreshold microseconds are not displayed.\r
38 - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
39 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
40 displayed.\r
41 \r
42 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
43 The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.\r
44 They must not be in use by a calling function.\r
45 \r
46 @param[in] Limit The number of records to print. Zero is ALL.\r
47 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
48 \r
c06ad33e 49**/\r
50VOID\r
51DumpAllProfile(\r
52 IN UINTN Limit,\r
53 IN BOOLEAN ExcludeFlag\r
54 )\r
55{\r
56 EFI_STRING StringPtr;\r
88359546 57 EFI_STRING StringPtrUnknown;\r
c06ad33e 58\r
88359546 59 StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
c06ad33e 60 StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);\r
88359546 61\r
c06ad33e 62 PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
88359546
ED
63 (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
64 FreePool (StringPtr);\r
65 FreePool (StringPtrUnknown);\r
c06ad33e 66 return;\r
67}\r
68\r
9dd74618
ED
69/** \r
70 Gather and print Raw Profile Records.\r
71 \r
72 All Profile measurements with a duration greater than or equal to\r
73 mInterestThreshold are printed without interpretation.\r
74 \r
75 The number of records displayed is controlled by:\r
76 - records with a duration less than mInterestThreshold microseconds are not displayed.\r
77 - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
78 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
79 displayed.\r
80 \r
81 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
82 \r
83 @param[in] Limit The number of records to print. Zero is ALL.\r
84 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
85 \r
c06ad33e 86**/\r
87VOID\r
88DumpRawProfile(\r
89 IN UINTN Limit,\r
90 IN BOOLEAN ExcludeFlag\r
91 )\r
92{\r
93 EFI_STRING StringPtr;\r
88359546 94 EFI_STRING StringPtrUnknown;\r
c06ad33e 95\r
88359546 96 StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
c06ad33e 97 StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);\r
98 PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
88359546
ED
99 (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
100 FreePool (StringPtr);\r
101 FreePool (StringPtrUnknown);\r
c06ad33e 102 return;\r
103}\r