d41bc92c |
1 | /** @file\r |
2 | Measured Profiling reporting for the Dp utility.\r |
3 | \r |
ef224032 |
4 | Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.\r |
d41bc92c |
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 |
d41bc92c |
19 | #include <Library/PeCoffGetEntryPointLib.h>\r |
20 | #include <Library/PerformanceLib.h>\r |
21 | #include <Library/PrintLib.h>\r |
22 | #include <Library/HiiLib.h>\r |
23 | #include <Library/PcdLib.h>\r |
24 | \r |
25 | #include <Guid/Performance.h>\r |
26 | \r |
27 | #include "Dp.h"\r |
28 | #include "Literals.h"\r |
29 | #include "DpInternal.h"\r |
30 | \r |
31 | /** \r |
32 | Gather and print ALL Profiling Records.\r |
33 | \r |
34 | Displays all "interesting" Profile measurements in order.\r |
35 | The number of records displayed is controlled by:\r |
36 | - records with a duration less than mInterestThreshold microseconds are not displayed.\r |
37 | - No more than Limit records are displayed. A Limit of zero will not limit the output.\r |
38 | - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r |
39 | displayed.\r |
40 | \r |
41 | @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r |
42 | The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.\r |
43 | They must not be in use by a calling function.\r |
44 | \r |
45 | @param[in] Limit The number of records to print. Zero is ALL.\r |
46 | @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r |
47 | \r |
48 | **/\r |
49 | VOID\r |
50 | DumpAllProfile(\r |
51 | IN UINTN Limit,\r |
52 | IN BOOLEAN ExcludeFlag\r |
53 | )\r |
54 | {\r |
55 | EFI_STRING StringPtr;\r |
56 | EFI_STRING StringPtrUnknown;\r |
57 | \r |
58 | StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r |
59 | StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);\r |
60 | \r |
61 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle, \r |
62 | (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r |
63 | FreePool (StringPtr);\r |
64 | FreePool (StringPtrUnknown);\r |
65 | }\r |
66 | \r |
67 | /** \r |
68 | Gather and print Raw Profile Records.\r |
69 | \r |
70 | All Profile measurements with a duration greater than or equal to\r |
71 | mInterestThreshold are printed without interpretation.\r |
72 | \r |
73 | The number of records displayed is controlled by:\r |
74 | - records with a duration less than mInterestThreshold microseconds are not displayed.\r |
75 | - No more than Limit records are displayed. A Limit of zero will not limit the output.\r |
76 | - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r |
77 | displayed.\r |
78 | \r |
79 | @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r |
80 | \r |
81 | @param[in] Limit The number of records to print. Zero is ALL.\r |
82 | @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r |
83 | \r |
84 | **/\r |
85 | VOID\r |
86 | DumpRawProfile(\r |
87 | IN UINTN Limit,\r |
88 | IN BOOLEAN ExcludeFlag\r |
89 | )\r |
90 | {\r |
91 | EFI_STRING StringPtr;\r |
92 | EFI_STRING StringPtrUnknown;\r |
93 | \r |
94 | StringPtrUnknown = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);\r |
95 | StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);\r |
96 | ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), gDpHiiHandle, \r |
97 | (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r |
98 | FreePool (StringPtr);\r |
99 | FreePool (StringPtrUnknown);\r |
100 | }\r |