]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Declarations of objects defined internally to the Dp Application.\r | |
3 | \r | |
4 | Declarations of data and functions which are private to the Dp application.\r | |
5 | This file should never be referenced by anything other than components of the\r | |
6 | Dp application. In addition to global data, function declarations for\r | |
7 | DpUtilities.c, DpTrace.c, and DpProfile.c are included here.\r | |
8 | \r | |
9 | Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.\r | |
10 | (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r | |
11 | This program and the accompanying materials\r | |
12 | are licensed and made available under the terms and conditions of the BSD License\r | |
13 | which accompanies this distribution. The full text of the license may be found at\r | |
14 | http://opensource.org/licenses/bsd-license.php\r | |
15 | \r | |
16 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
17 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
18 | **/\r | |
19 | #ifndef _DP_INTELNAL_H_\r | |
20 | #define _DP_INTELNAL_H_\r | |
21 | \r | |
22 | #define DP_GAUGE_STRING_LENGTH 36\r | |
23 | \r | |
24 | //\r | |
25 | /// Module-Global Variables\r | |
26 | ///@{\r | |
27 | extern EFI_HII_HANDLE mDpHiiHandle;\r | |
28 | extern CHAR16 mGaugeString[DP_GAUGE_STRING_LENGTH + 1];\r | |
29 | extern CHAR16 mUnicodeToken[DXE_PERFORMANCE_STRING_SIZE];\r | |
30 | extern UINT64 mInterestThreshold;\r | |
31 | extern BOOLEAN mShowId;\r | |
32 | extern UINT8 *mBootPerformanceTable;\r | |
33 | extern UINTN mBootPerformanceTableLength;\r | |
34 | extern MEASUREMENT_RECORD *mMeasurementList;\r | |
35 | extern UINTN mMeasurementNum;\r | |
36 | \r | |
37 | extern PERF_SUMMARY_DATA SummaryData; ///< Create the SummaryData structure and init. to ZERO.\r | |
38 | \r | |
39 | /// Items for which to gather cumulative statistics.\r | |
40 | extern PERF_CUM_DATA CumData[];\r | |
41 | \r | |
42 | /// Number of items for which we are gathering cumulative statistics.\r | |
43 | extern UINT32 const NumCum;\r | |
44 | \r | |
45 | ///@}\r | |
46 | \r | |
47 | /**\r | |
48 | Calculate an event's duration in timer ticks.\r | |
49 | \r | |
50 | Given the count direction and the event's start and end timer values,\r | |
51 | calculate the duration of the event in timer ticks. Information for\r | |
52 | the current measurement is pointed to by the parameter.\r | |
53 | \r | |
54 | If the measurement's start time is 1, it indicates that the developer\r | |
55 | is indicating that the measurement began at the release of reset.\r | |
56 | The start time is adjusted to the timer's starting count before performing\r | |
57 | the elapsed time calculation.\r | |
58 | \r | |
59 | The calculated duration, in ticks, is the absolute difference between\r | |
60 | the measurement's ending and starting counts.\r | |
61 | \r | |
62 | @param Measurement Pointer to a MEASUREMENT_RECORD structure containing\r | |
63 | data for the current measurement.\r | |
64 | \r | |
65 | @return The 64-bit duration of the event.\r | |
66 | **/\r | |
67 | UINT64\r | |
68 | GetDuration (\r | |
69 | IN OUT MEASUREMENT_RECORD *Measurement\r | |
70 | );\r | |
71 | \r | |
72 | /**\r | |
73 | Determine whether the Measurement record is for an EFI Phase.\r | |
74 | \r | |
75 | The Token and Module members of the measurement record are checked.\r | |
76 | Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL.\r | |
77 | \r | |
78 | @param[in] Measurement A pointer to the Measurement record to test.\r | |
79 | \r | |
80 | @retval TRUE The measurement record is for an EFI Phase.\r | |
81 | @retval FALSE The measurement record is NOT for an EFI Phase.\r | |
82 | **/\r | |
83 | BOOLEAN\r | |
84 | IsPhase(\r | |
85 | IN MEASUREMENT_RECORD *Measurement\r | |
86 | );\r | |
87 | \r | |
88 | /**\r | |
89 | Determine whether the Measurement record is for core code.\r | |
90 | \r | |
91 | @param[in] Measurement A pointer to the Measurement record to test.\r | |
92 | \r | |
93 | @retval TRUE The measurement record is used for core.\r | |
94 | @retval FALSE The measurement record is NOT used for core.\r | |
95 | \r | |
96 | **/\r | |
97 | BOOLEAN\r | |
98 | IsCorePerf(\r | |
99 | IN MEASUREMENT_RECORD *Measurement\r | |
100 | );\r | |
101 | \r | |
102 | /**\r | |
103 | Get the file name portion of the Pdb File Name.\r | |
104 | \r | |
105 | The portion of the Pdb File Name between the last backslash and\r | |
106 | either a following period or the end of the string is converted\r | |
107 | to Unicode and copied into UnicodeBuffer. The name is truncated,\r | |
108 | if necessary, to ensure that UnicodeBuffer is not overrun.\r | |
109 | \r | |
110 | @param[in] PdbFileName Pdb file name.\r | |
111 | @param[out] UnicodeBuffer The resultant Unicode File Name.\r | |
112 | \r | |
113 | **/\r | |
114 | VOID\r | |
115 | DpGetShortPdbFileName (\r | |
116 | IN CHAR8 *PdbFileName,\r | |
117 | OUT CHAR16 *UnicodeBuffer\r | |
118 | );\r | |
119 | \r | |
120 | /**\r | |
121 | Get a human readable name for an image handle.\r | |
122 | The following methods will be tried orderly:\r | |
123 | 1. Image PDB\r | |
124 | 2. ComponentName2 protocol\r | |
125 | 3. FFS UI section\r | |
126 | 4. Image GUID\r | |
127 | 5. Image DevicePath\r | |
128 | 6. Unknown Driver Name\r | |
129 | \r | |
130 | @param[in] Handle\r | |
131 | \r | |
132 | @post The resulting Unicode name string is stored in the\r | |
133 | mGaugeString global array.\r | |
134 | \r | |
135 | **/\r | |
136 | VOID\r | |
137 | DpGetNameFromHandle (\r | |
138 | IN EFI_HANDLE Handle\r | |
139 | );\r | |
140 | \r | |
141 | /**\r | |
142 | Calculate the Duration in microseconds.\r | |
143 | \r | |
144 | Duration is multiplied by 1000, instead of Frequency being divided by 1000 or\r | |
145 | multiplying the result by 1000, in order to maintain precision. Since Duration is\r | |
146 | a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.\r | |
147 | \r | |
148 | The time is calculated as (Duration * 1000) / Timer_Frequency.\r | |
149 | \r | |
150 | @param[in] Duration The event duration in timer ticks.\r | |
151 | \r | |
152 | @return A 64-bit value which is the Elapsed time in microseconds.\r | |
153 | **/\r | |
154 | UINT64\r | |
155 | DurationInMicroSeconds (\r | |
156 | IN UINT64 Duration\r | |
157 | );\r | |
158 | \r | |
159 | /**\r | |
160 | Get index of Measurement Record's match in the CumData array.\r | |
161 | \r | |
162 | If the Measurement's Token value matches a Token in one of the CumData\r | |
163 | records, the index of the matching record is returned. The returned\r | |
164 | index is a signed value so that negative values can indicate that\r | |
165 | the Measurement didn't match any entry in the CumData array.\r | |
166 | \r | |
167 | @param[in] Measurement A pointer to a Measurement Record to match against the CumData array.\r | |
168 | \r | |
169 | @retval <0 Token is not in the CumData array.\r | |
170 | @retval >=0 Return value is the index into CumData where Token is found.\r | |
171 | **/\r | |
172 | INTN\r | |
173 | GetCumulativeItem(\r | |
174 | IN MEASUREMENT_RECORD *Measurement\r | |
175 | );\r | |
176 | \r | |
177 | /**\r | |
178 | Collect verbose statistics about the logged performance measurements.\r | |
179 | \r | |
180 | General Summary information for all Trace measurements is gathered and\r | |
181 | stored within the SummaryData structure. This information is both\r | |
182 | used internally by subsequent reporting functions, and displayed\r | |
183 | at the end of verbose reports.\r | |
184 | \r | |
185 | @pre The SummaryData and CumData structures must be initialized\r | |
186 | prior to calling this function.\r | |
187 | \r | |
188 | @post The SummaryData and CumData structures contain statistics for the\r | |
189 | current performance logs.\r | |
190 | \r | |
191 | @param[in, out] CustomCumulativeData The pointer to the custom cumulative data.\r | |
192 | \r | |
193 | **/\r | |
194 | VOID\r | |
195 | GatherStatistics(\r | |
196 | IN OUT PERF_CUM_DATA *CustomCumulativeData OPTIONAL\r | |
197 | );\r | |
198 | \r | |
199 | /**\r | |
200 | Gather and print ALL Trace Records.\r | |
201 | \r | |
202 | Displays all "interesting" Trace measurements in order.<BR>\r | |
203 | The number of records displayed is controlled by:\r | |
204 | - records with a duration less than mInterestThreshold microseconds are not displayed.\r | |
205 | - No more than Limit records are displayed. A Limit of zero will not limit the output.\r | |
206 | - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r | |
207 | displayed.\r | |
208 | \r | |
209 | @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r | |
210 | The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.\r | |
211 | They must not be in use by a calling function.\r | |
212 | \r | |
213 | @param[in] Limit The number of records to print. Zero is ALL.\r | |
214 | @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r | |
215 | \r | |
216 | @retval EFI_SUCCESS The operation was successful.\r | |
217 | @retval EFI_ABORTED The user aborts the operation.\r | |
218 | @return Others from a call to gBS->LocateHandleBuffer().\r | |
219 | **/\r | |
220 | EFI_STATUS\r | |
221 | DumpAllTrace(\r | |
222 | IN UINTN Limit,\r | |
223 | IN BOOLEAN ExcludeFlag\r | |
224 | );\r | |
225 | \r | |
226 | /**\r | |
227 | Gather and print Raw Trace Records.\r | |
228 | \r | |
229 | All Trace measurements with a duration greater than or equal to\r | |
230 | mInterestThreshold are printed without interpretation.\r | |
231 | \r | |
232 | The number of records displayed is controlled by:\r | |
233 | - records with a duration less than mInterestThreshold microseconds are not displayed.\r | |
234 | - No more than Limit records are displayed. A Limit of zero will not limit the output.\r | |
235 | - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not\r | |
236 | displayed.\r | |
237 | \r | |
238 | @pre The mInterestThreshold global variable is set to the shortest duration to be printed.\r | |
239 | \r | |
240 | @param[in] Limit The number of records to print. Zero is ALL.\r | |
241 | @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r | |
242 | @retval EFI_SUCCESS The operation was successful.\r | |
243 | @retval EFI_ABORTED The user aborts the operation.\r | |
244 | **/\r | |
245 | EFI_STATUS\r | |
246 | DumpRawTrace(\r | |
247 | IN UINTN Limit,\r | |
248 | IN BOOLEAN ExcludeFlag\r | |
249 | );\r | |
250 | \r | |
251 | /**\r | |
252 | Gather and print Major Phase metrics.\r | |
253 | \r | |
254 | **/\r | |
255 | VOID\r | |
256 | ProcessPhases(\r | |
257 | VOID\r | |
258 | );\r | |
259 | \r | |
260 | \r | |
261 | /**\r | |
262 | Gather and print Handle data.\r | |
263 | \r | |
264 | @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.\r | |
265 | \r | |
266 | @retval EFI_SUCCESS The operation was successful.\r | |
267 | @retval EFI_ABORTED The user aborts the operation.\r | |
268 | @return Others from a call to gBS->LocateHandleBuffer().\r | |
269 | **/\r | |
270 | EFI_STATUS\r | |
271 | ProcessHandles(\r | |
272 | IN BOOLEAN ExcludeFlag\r | |
273 | );\r | |
274 | \r | |
275 | \r | |
276 | /**\r | |
277 | Gather and print PEIM data.\r | |
278 | \r | |
279 | Only prints complete PEIM records\r | |
280 | \r | |
281 | @retval EFI_SUCCESS The operation was successful.\r | |
282 | @retval EFI_ABORTED The user aborts the operation.\r | |
283 | **/\r | |
284 | EFI_STATUS\r | |
285 | ProcessPeims(\r | |
286 | VOID\r | |
287 | );\r | |
288 | \r | |
289 | /**\r | |
290 | Gather and print global data.\r | |
291 | \r | |
292 | Strips out incomplete or "Execution Phase" records\r | |
293 | Only prints records where Handle is NULL\r | |
294 | Increment TIndex for every record, even skipped ones, so that we have an\r | |
295 | indication of every measurement record taken.\r | |
296 | \r | |
297 | @retval EFI_SUCCESS The operation was successful.\r | |
298 | @retval EFI_ABORTED The user aborts the operation.\r | |
299 | **/\r | |
300 | EFI_STATUS\r | |
301 | ProcessGlobal(\r | |
302 | VOID\r | |
303 | );\r | |
304 | \r | |
305 | /**\r | |
306 | Gather and print cumulative data.\r | |
307 | \r | |
308 | Traverse the measurement records and:<BR>\r | |
309 | For each record with a Token listed in the CumData array:<BR>\r | |
310 | - Update the instance count and the total, minimum, and maximum durations.\r | |
311 | Finally, print the gathered cumulative statistics.\r | |
312 | \r | |
313 | @param[in] CustomCumulativeData The pointer to the custom cumulative data.\r | |
314 | \r | |
315 | **/\r | |
316 | VOID\r | |
317 | ProcessCumulative(\r | |
318 | IN PERF_CUM_DATA *CustomCumulativeData OPTIONAL\r | |
319 | );\r | |
320 | \r | |
321 | #endif\r |