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