]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/DynamicCommand/DpDynamicCommand/DpProfile.c
ShellPkg/Dp: Initialize summary date when run DP
[mirror_edk2.git] / ShellPkg / DynamicCommand / DpDynamicCommand / DpProfile.c
CommitLineData
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
92034c4c 31/**\r
d41bc92c 32 Gather and print ALL Profiling Records.\r
92034c4c 33\r
d41bc92c 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
92034c4c 40\r
d41bc92c 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
92034c4c 44\r
d41bc92c 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
92034c4c 47\r
d41bc92c 48**/\r
49VOID\r
50DumpAllProfile(\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
92034c4c
RN
58 StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);\r
59 StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);\r
d41bc92c 60\r
92034c4c 61 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,\r
d41bc92c 62 (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
63 FreePool (StringPtr);\r
64 FreePool (StringPtrUnknown);\r
65}\r
66\r
92034c4c 67/**\r
d41bc92c 68 Gather and print Raw Profile Records.\r
92034c4c 69\r
d41bc92c 70 All Profile measurements with a duration greater than or equal to\r
71 mInterestThreshold are printed without interpretation.\r
92034c4c 72\r
d41bc92c 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
92034c4c 78\r
d41bc92c 79 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
92034c4c 80\r
d41bc92c 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
92034c4c 83\r
d41bc92c 84**/\r
85VOID\r
86DumpRawProfile(\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
92034c4c
RN
94 StringPtrUnknown = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL);\r
95 StringPtr = HiiGetString (mDpHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);\r
96 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DP_SECTION_HEADER), mDpHiiHandle,\r
d41bc92c 97 (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
98 FreePool (StringPtr);\r
99 FreePool (StringPtrUnknown);\r
100}\r