]> git.proxmox.com Git - mirror_edk2.git/blame - PerformancePkg/Dp_App/DpProfile.c
PerformancePkg Dp_App: Remove TimerLib dependency
[mirror_edk2.git] / PerformancePkg / Dp_App / DpProfile.c
CommitLineData
c06ad33e 1/** @file\r
86da563d
ED
2 Measured Profiling reporting for the Dp utility.\r
3\r
13935109 4 Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
86da563d
ED
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
c06ad33e 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
c06ad33e 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
9dd74618
ED
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
c06ad33e 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
88359546 56 EFI_STRING StringPtrUnknown;\r
c06ad33e 57\r
88359546 58 StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
c06ad33e 59 StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_PROFILE), NULL);\r
88359546 60\r
c06ad33e 61 PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
88359546
ED
62 (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
63 FreePool (StringPtr);\r
64 FreePool (StringPtrUnknown);\r
c06ad33e 65 return;\r
66}\r
67\r
9dd74618
ED
68/** \r
69 Gather and print Raw Profile Records.\r
70 \r
71 All Profile measurements with a duration greater than or equal to\r
72 mInterestThreshold are printed without interpretation.\r
73 \r
74 The number of records displayed is controlled by:\r
75 - records with a duration less than mInterestThreshold microseconds are not displayed.\r
76 - No more than Limit records are displayed. A Limit of zero will not limit the output.\r
77 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r
78 displayed.\r
79 \r
80 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r
81 \r
82 @param[in] Limit The number of records to print. Zero is ALL.\r
83 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r
84 \r
c06ad33e 85**/\r
86VOID\r
87DumpRawProfile(\r
88 IN UINTN Limit,\r
89 IN BOOLEAN ExcludeFlag\r
90 )\r
91{\r
92 EFI_STRING StringPtr;\r
88359546 93 EFI_STRING StringPtrUnknown;\r
c06ad33e 94\r
88359546 95 StringPtrUnknown = HiiGetString (gHiiHandle, STRING_TOKEN (STR_ALIT_UNKNOWN), NULL); \r
c06ad33e 96 StringPtr = HiiGetString (gHiiHandle, STRING_TOKEN (STR_DP_SECTION_RAWPROFILE), NULL);\r
97 PrintToken( STRING_TOKEN (STR_DP_SECTION_HEADER),\r
88359546
ED
98 (StringPtr == NULL) ? StringPtrUnknown: StringPtr);\r
99 FreePool (StringPtr);\r
100 FreePool (StringPtrUnknown);\r
c06ad33e 101 return;\r
102}\r