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