ShellPkg/Dp: Make the help info align with code
[mirror_edk2.git] / ShellPkg / DynamicCommand / DpDynamicCommand / Dp.h
CommitLineData
d41bc92c 1/** @file\r
92034c4c 2 Header file for 'dp' command functions.\r
d41bc92c 3\r
115eae65 4 Copyright (c) 2009 - 2018, 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
92034c4c 12\r
d41bc92c 13**/\r
14\r
92034c4c
RN
15#ifndef _DP_H_\r
16#define _DP_H_\r
17\r
18\r
19#include <Uefi.h>\r
20\r
21#include <Guid/Performance.h>\r
115eae65
DB
22#include <Guid/ExtendedFirmwarePerformance.h>\r
23#include <Guid/FirmwarePerformance.h>\r
24#include <Guid/Acpi.h>\r
d41bc92c 25\r
92034c4c
RN
26#include <Protocol/HiiPackageList.h>\r
27#include <Protocol/DevicePath.h>\r
28#include <Protocol/LoadedImage.h>\r
29#include <Protocol/UnicodeCollation.h>\r
30\r
31#include <Library/BaseLib.h>\r
32#include <Library/BaseMemoryLib.h>\r
33#include <Library/DebugLib.h>\r
34#include <Library/MemoryAllocationLib.h>\r
d41bc92c 35#include <Library/ShellLib.h>\r
92034c4c
RN
36#include <Library/UefiLib.h>\r
37#include <Library/UefiRuntimeServicesTableLib.h>\r
38#include <Library/UefiBootServicesTableLib.h>\r
39#include <Library/PcdLib.h>\r
40#include <Library/SortLib.h>\r
41#include <Library/HiiLib.h>\r
42#include <Library/FileHandleLib.h>\r
43#include <Library/UefiHiiServicesLib.h>\r
44\r
45extern EFI_HANDLE mDpHiiHandle;\r
d41bc92c 46\r
47#define DP_MAJOR_VERSION 2\r
115eae65 48#define DP_MINOR_VERSION 5\r
d41bc92c 49\r
50/**\r
51 * The value assigned to DP_DEBUG controls which debug output\r
52 * is generated. Set it to ZERO to disable.\r
53**/\r
54#define DP_DEBUG 0\r
55\r
d41bc92c 56#define DEFAULT_THRESHOLD 1000 ///< One millisecond.\r
57#define DEFAULT_DISPLAYCOUNT 50\r
58#define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.\r
59\r
60#define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL\r
61\r
62/// Determine whether 0 <= C < L. If L == 0, return true regardless of C.\r
63#define WITHIN_LIMIT( C, L) ( ((L) == 0) || ((C) < (L)) )\r
64\r
65/// Structure for storing Timer specific information.\r
66typedef struct {\r
67 UINT64 StartCount; ///< Value timer is initialized with.\r
68 UINT64 EndCount; ///< Value timer has just before it wraps.\r
69 UINT32 Frequency; ///< Timer count frequency in KHz.\r
70 BOOLEAN CountUp; ///< TRUE if the counter counts up.\r
71} TIMER_INFO;\r
72\r
73/** Initialize one PERF_CUM_DATA structure instance for token t.\r
74 *\r
75 * This parameterized macro takes a single argument, t, which is expected\r
76 * to resolve to a pointer to an ASCII string literal. This parameter may\r
77 * take any one of the following forms:\r
78 * - PERF_INIT_CUM_DATA("Token") A string literal\r
79 * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer;\r
80 * - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N];\r
81**/\r
82#define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }\r
83\r
84typedef struct {\r
85 UINT64 Duration; ///< Cumulative duration for this item.\r
86 UINT64 MinDur; ///< Smallest duration encountered.\r
87 UINT64 MaxDur; ///< Largest duration encountered.\r
88 CHAR8 *Name; ///< ASCII name of this item.\r
89 UINT32 Count; ///< Total number of measurements accumulated.\r
90} PERF_CUM_DATA;\r
91\r
92typedef struct {\r
93 UINT32 NumTrace; ///< Number of recorded TRACE performance measurements.\r
d41bc92c 94 UINT32 NumIncomplete; ///< Number of measurements with no END value.\r
95 UINT32 NumSummary; ///< Number of summary section measurements.\r
96 UINT32 NumHandles; ///< Number of measurements with handles.\r
97 UINT32 NumPEIMs; ///< Number of measurements of PEIMs.\r
98 UINT32 NumGlobal; ///< Number of measurements with END value and NULL handle.\r
99} PERF_SUMMARY_DATA;\r
100\r
101typedef struct {\r
102 CONST VOID *Handle;\r
103 CONST CHAR8 *Token; ///< Measured token string name.\r
104 CONST CHAR8 *Module; ///< Module string name.\r
105 UINT64 StartTimeStamp; ///< Start time point.\r
106 UINT64 EndTimeStamp; ///< End time point.\r
107 UINT32 Identifier; ///< Identifier.\r
108} MEASUREMENT_RECORD;\r
109\r
110typedef struct {\r
111 CHAR8 *Name; ///< Measured token string name.\r
112 UINT64 CumulativeTime; ///< Accumulated Elapsed Time.\r
113 UINT64 MinTime; ///< Minimum Elapsed Time.\r
114 UINT64 MaxTime; ///< Maximum Elapsed Time.\r
115 UINT32 Count; ///< Number of measurements accumulated.\r
116} PROFILE_RECORD;\r
117\r
92034c4c
RN
118/**\r
119 Dump performance data.\r
120\r
121 @param[in] ImageHandle The image handle.\r
122 @param[in] SystemTable The system table.\r
123\r
124 @retval SHELL_SUCCESS Command completed successfully.\r
125 @retval SHELL_INVALID_PARAMETER Command usage error.\r
126 @retval SHELL_ABORTED The user aborts the operation.\r
127 @retval value Unknown error.\r
128**/\r
129SHELL_STATUS\r
130RunDp (\r
131 IN EFI_HANDLE ImageHandle,\r
132 IN EFI_SYSTEM_TABLE *SystemTable\r
133 );\r
134\r
135/**\r
136 Retrive HII package list from ImageHandle and publish to HII database.\r
137\r
138 @param ImageHandle The image handle of the process.\r
139\r
140 @return HII handle.\r
141**/\r
142EFI_HANDLE\r
143InitializeHiiPackage (\r
144 EFI_HANDLE ImageHandle\r
145 );\r
146#endif // _DP_H_\r