2 Declarations of objects defined internally to the Dp Application.
4 Declarations of data and functions which are private to the Dp application.
5 This file should never be referenced by anything other than components of the
6 Dp application. In addition to global data, function declarations for
7 DpUtilities.c, DpTrace.c, and DpProfile.c are included here.
9 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
10 (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>
11 This program and the accompanying materials
12 are licensed and made available under the terms and conditions of the BSD License
13 which accompanies this distribution. The full text of the license may be found at
14 http://opensource.org/licenses/bsd-license.php
16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #ifndef _DP_INTELNAL_H_
20 #define _DP_INTELNAL_H_
22 #define DP_GAUGE_STRING_LENGTH 36
25 /// Module-Global Variables
27 extern EFI_HII_HANDLE mDpHiiHandle
;
28 extern CHAR16 mGaugeString
[DP_GAUGE_STRING_LENGTH
+ 1];
29 extern CHAR16 mUnicodeToken
[DXE_PERFORMANCE_STRING_SIZE
];
30 extern UINT64 mInterestThreshold
;
31 extern BOOLEAN mShowId
;
32 extern UINT8
*mBootPerformanceTable
;
33 extern UINTN mBootPerformanceTableLength
;
34 extern MEASUREMENT_RECORD
*mMeasurementList
;
35 extern UINTN mMeasurementNum
;
37 extern PERF_SUMMARY_DATA SummaryData
; ///< Create the SummaryData structure and init. to ZERO.
39 /// Items for which to gather cumulative statistics.
40 extern PERF_CUM_DATA CumData
[];
42 /// Number of items for which we are gathering cumulative statistics.
43 extern UINT32
const NumCum
;
48 Calculate an event's duration in timer ticks.
50 Given the count direction and the event's start and end timer values,
51 calculate the duration of the event in timer ticks. Information for
52 the current measurement is pointed to by the parameter.
54 If the measurement's start time is 1, it indicates that the developer
55 is indicating that the measurement began at the release of reset.
56 The start time is adjusted to the timer's starting count before performing
57 the elapsed time calculation.
59 The calculated duration, in ticks, is the absolute difference between
60 the measurement's ending and starting counts.
62 @param Measurement Pointer to a MEASUREMENT_RECORD structure containing
63 data for the current measurement.
65 @return The 64-bit duration of the event.
69 IN OUT MEASUREMENT_RECORD
*Measurement
73 Determine whether the Measurement record is for an EFI Phase.
75 The Token and Module members of the measurement record are checked.
76 Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL.
78 @param[in] Measurement A pointer to the Measurement record to test.
80 @retval TRUE The measurement record is for an EFI Phase.
81 @retval FALSE The measurement record is NOT for an EFI Phase.
85 IN MEASUREMENT_RECORD
*Measurement
89 Determine whether the Measurement record is for core code.
91 @param[in] Measurement A pointer to the Measurement record to test.
93 @retval TRUE The measurement record is used for core.
94 @retval FALSE The measurement record is NOT used for core.
99 IN MEASUREMENT_RECORD
*Measurement
103 Get the file name portion of the Pdb File Name.
105 The portion of the Pdb File Name between the last backslash and
106 either a following period or the end of the string is converted
107 to Unicode and copied into UnicodeBuffer. The name is truncated,
108 if necessary, to ensure that UnicodeBuffer is not overrun.
110 @param[in] PdbFileName Pdb file name.
111 @param[out] UnicodeBuffer The resultant Unicode File Name.
115 DpGetShortPdbFileName (
116 IN CHAR8
*PdbFileName
,
117 OUT CHAR16
*UnicodeBuffer
121 Get a human readable name for an image handle.
122 The following methods will be tried orderly:
124 2. ComponentName2 protocol
128 6. Unknown Driver Name
132 @post The resulting Unicode name string is stored in the
133 mGaugeString global array.
137 DpGetNameFromHandle (
142 Calculate the Duration in microseconds.
144 Duration is multiplied by 1000, instead of Frequency being divided by 1000 or
145 multiplying the result by 1000, in order to maintain precision. Since Duration is
146 a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.
148 The time is calculated as (Duration * 1000) / Timer_Frequency.
150 @param[in] Duration The event duration in timer ticks.
152 @return A 64-bit value which is the Elapsed time in microseconds.
155 DurationInMicroSeconds (
160 Get index of Measurement Record's match in the CumData array.
162 If the Measurement's Token value matches a Token in one of the CumData
163 records, the index of the matching record is returned. The returned
164 index is a signed value so that negative values can indicate that
165 the Measurement didn't match any entry in the CumData array.
167 @param[in] Measurement A pointer to a Measurement Record to match against the CumData array.
169 @retval <0 Token is not in the CumData array.
170 @retval >=0 Return value is the index into CumData where Token is found.
174 IN MEASUREMENT_RECORD
*Measurement
178 Collect verbose statistics about the logged performance measurements.
180 General Summary information for all Trace measurements is gathered and
181 stored within the SummaryData structure. This information is both
182 used internally by subsequent reporting functions, and displayed
183 at the end of verbose reports.
185 @pre The SummaryData and CumData structures must be initialized
186 prior to calling this function.
188 @post The SummaryData and CumData structures contain statistics for the
189 current performance logs.
191 @param[in, out] CustomCumulativeData The pointer to the custom cumulative data.
196 IN OUT PERF_CUM_DATA
*CustomCumulativeData OPTIONAL
200 Gather and print ALL Trace Records.
202 Displays all "interesting" Trace measurements in order.<BR>
203 The number of records displayed is controlled by:
204 - records with a duration less than mInterestThreshold microseconds are not displayed.
205 - No more than Limit records are displayed. A Limit of zero will not limit the output.
206 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
209 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
210 The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
211 They must not be in use by a calling function.
213 @param[in] Limit The number of records to print. Zero is ALL.
214 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
216 @retval EFI_SUCCESS The operation was successful.
217 @retval EFI_ABORTED The user aborts the operation.
218 @return Others from a call to gBS->LocateHandleBuffer().
223 IN BOOLEAN ExcludeFlag
227 Gather and print Raw Trace Records.
229 All Trace measurements with a duration greater than or equal to
230 mInterestThreshold are printed without interpretation.
232 The number of records displayed is controlled by:
233 - records with a duration less than mInterestThreshold microseconds are not displayed.
234 - No more than Limit records are displayed. A Limit of zero will not limit the output.
235 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
238 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
240 @param[in] Limit The number of records to print. Zero is ALL.
241 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
242 @retval EFI_SUCCESS The operation was successful.
243 @retval EFI_ABORTED The user aborts the operation.
248 IN BOOLEAN ExcludeFlag
252 Gather and print Major Phase metrics.
262 Gather and print Handle data.
264 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
266 @retval EFI_SUCCESS The operation was successful.
267 @retval EFI_ABORTED The user aborts the operation.
268 @return Others from a call to gBS->LocateHandleBuffer().
272 IN BOOLEAN ExcludeFlag
277 Gather and print PEIM data.
279 Only prints complete PEIM records
281 @retval EFI_SUCCESS The operation was successful.
282 @retval EFI_ABORTED The user aborts the operation.
290 Gather and print global data.
292 Strips out incomplete or "Execution Phase" records
293 Only prints records where Handle is NULL
294 Increment TIndex for every record, even skipped ones, so that we have an
295 indication of every measurement record taken.
297 @retval EFI_SUCCESS The operation was successful.
298 @retval EFI_ABORTED The user aborts the operation.
306 Gather and print cumulative data.
308 Traverse the measurement records and:<BR>
309 For each record with a Token listed in the CumData array:<BR>
310 - Update the instance count and the total, minimum, and maximum durations.
311 Finally, print the gathered cumulative statistics.
313 @param[in] CustomCumulativeData The pointer to the custom cumulative data.
318 IN PERF_CUM_DATA
*CustomCumulativeData OPTIONAL