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 SPDX-License-Identifier: BSD-2-Clause-Patent
14 #ifndef _DP_INTELNAL_H_
15 #define _DP_INTELNAL_H_
17 #define DP_GAUGE_STRING_LENGTH 36
20 /// Module-Global Variables
22 extern EFI_HII_HANDLE mDpHiiHandle
;
23 extern CHAR16 mGaugeString
[DP_GAUGE_STRING_LENGTH
+ 1];
24 extern CHAR16 mUnicodeToken
[DXE_PERFORMANCE_STRING_SIZE
];
25 extern UINT64 mInterestThreshold
;
26 extern BOOLEAN mShowId
;
27 extern UINT8
*mBootPerformanceTable
;
28 extern UINTN mBootPerformanceTableLength
;
29 extern MEASUREMENT_RECORD
*mMeasurementList
;
30 extern UINTN mMeasurementNum
;
31 extern UINT64 mResetEnd
;
33 extern PERF_SUMMARY_DATA SummaryData
; ///< Create the SummaryData structure and init. to ZERO.
35 /// Items for which to gather cumulative statistics.
36 extern PERF_CUM_DATA CumData
[];
38 /// Number of items for which we are gathering cumulative statistics.
39 extern UINT32
const NumCum
;
44 Calculate an event's duration in timer ticks.
46 Given the count direction and the event's start and end timer values,
47 calculate the duration of the event in timer ticks. Information for
48 the current measurement is pointed to by the parameter.
50 If the measurement's start time is 1, it indicates that the developer
51 is indicating that the measurement began at the release of reset.
52 The start time is adjusted to the timer's starting count before performing
53 the elapsed time calculation.
55 The calculated duration, in ticks, is the absolute difference between
56 the measurement's ending and starting counts.
58 @param Measurement Pointer to a MEASUREMENT_RECORD structure containing
59 data for the current measurement.
61 @return The 64-bit duration of the event.
65 IN OUT MEASUREMENT_RECORD
*Measurement
69 Determine whether the Measurement record is for an EFI Phase.
71 The Token and Module members of the measurement record are checked.
72 Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL.
74 @param[in] Measurement A pointer to the Measurement record to test.
76 @retval TRUE The measurement record is for an EFI Phase.
77 @retval FALSE The measurement record is NOT for an EFI Phase.
81 IN MEASUREMENT_RECORD
*Measurement
85 Determine whether the Measurement record is for core code.
87 @param[in] Measurement A pointer to the Measurement record to test.
89 @retval TRUE The measurement record is used for core.
90 @retval FALSE The measurement record is NOT used for core.
95 IN MEASUREMENT_RECORD
*Measurement
99 Get the file name portion of the Pdb File Name.
101 The portion of the Pdb File Name between the last backslash and
102 either a following period or the end of the string is converted
103 to Unicode and copied into UnicodeBuffer. The name is truncated,
104 if necessary, to ensure that UnicodeBuffer is not overrun.
106 @param[in] PdbFileName Pdb file name.
107 @param[out] UnicodeBuffer The resultant Unicode File Name.
111 DpGetShortPdbFileName (
112 IN CHAR8
*PdbFileName
,
113 OUT CHAR16
*UnicodeBuffer
117 Get a human readable name for an image handle.
118 The following methods will be tried orderly:
120 2. ComponentName2 protocol
124 6. Unknown Driver Name
128 @post The resulting Unicode name string is stored in the
129 mGaugeString global array.
133 DpGetNameFromHandle (
138 Calculate the Duration in microseconds.
140 Duration is multiplied by 1000, instead of Frequency being divided by 1000 or
141 multiplying the result by 1000, in order to maintain precision. Since Duration is
142 a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.
144 The time is calculated as (Duration * 1000) / Timer_Frequency.
146 @param[in] Duration The event duration in timer ticks.
148 @return A 64-bit value which is the Elapsed time in microseconds.
151 DurationInMicroSeconds (
156 Get index of Measurement Record's match in the CumData array.
158 If the Measurement's Token value matches a Token in one of the CumData
159 records, the index of the matching record is returned. The returned
160 index is a signed value so that negative values can indicate that
161 the Measurement didn't match any entry in the CumData array.
163 @param[in] Measurement A pointer to a Measurement Record to match against the CumData array.
165 @retval <0 Token is not in the CumData array.
166 @retval >=0 Return value is the index into CumData where Token is found.
170 IN MEASUREMENT_RECORD
*Measurement
174 Collect verbose statistics about the logged performance measurements.
176 General Summary information for all Trace measurements is gathered and
177 stored within the SummaryData structure. This information is both
178 used internally by subsequent reporting functions, and displayed
179 at the end of verbose reports.
181 @pre The SummaryData and CumData structures must be initialized
182 prior to calling this function.
184 @post The SummaryData and CumData structures contain statistics for the
185 current performance logs.
187 @param[in, out] CustomCumulativeData The pointer to the custom cumulative data.
192 IN OUT PERF_CUM_DATA
*CustomCumulativeData OPTIONAL
196 Gather and print ALL Trace Records.
198 Displays all "interesting" Trace measurements in order.<BR>
199 The number of records displayed is controlled by:
200 - records with a duration less than mInterestThreshold microseconds are not displayed.
201 - No more than Limit records are displayed. A Limit of zero will not limit the output.
202 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
205 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
206 The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
207 They must not be in use by a calling function.
209 @param[in] Limit The number of records to print. Zero is ALL.
210 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
212 @retval EFI_SUCCESS The operation was successful.
213 @retval EFI_ABORTED The user aborts the operation.
214 @return Others from a call to gBS->LocateHandleBuffer().
219 IN BOOLEAN ExcludeFlag
223 Gather and print Raw Trace Records.
225 All Trace measurements with a duration greater than or equal to
226 mInterestThreshold are printed without interpretation.
228 The number of records displayed is controlled by:
229 - records with a duration less than mInterestThreshold microseconds are not displayed.
230 - No more than Limit records are displayed. A Limit of zero will not limit the output.
231 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
234 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
236 @param[in] Limit The number of records to print. Zero is ALL.
237 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
238 @retval EFI_SUCCESS The operation was successful.
239 @retval EFI_ABORTED The user aborts the operation.
244 IN BOOLEAN ExcludeFlag
248 Gather and print Major Phase metrics.
257 Gather and print Handle data.
259 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
261 @retval EFI_SUCCESS The operation was successful.
262 @retval EFI_ABORTED The user aborts the operation.
263 @return Others from a call to gBS->LocateHandleBuffer().
267 IN BOOLEAN ExcludeFlag
271 Gather and print PEIM data.
273 Only prints complete PEIM records
275 @retval EFI_SUCCESS The operation was successful.
276 @retval EFI_ABORTED The user aborts the operation.
284 Gather and print global data.
286 Strips out incomplete or "Execution Phase" records
287 Only prints records where Handle is NULL
288 Increment TIndex for every record, even skipped ones, so that we have an
289 indication of every measurement record taken.
291 @retval EFI_SUCCESS The operation was successful.
292 @retval EFI_ABORTED The user aborts the operation.
300 Gather and print cumulative data.
302 Traverse the measurement records and:<BR>
303 For each record with a Token listed in the CumData array:<BR>
304 - Update the instance count and the total, minimum, and maximum durations.
305 Finally, print the gathered cumulative statistics.
307 @param[in] CustomCumulativeData The pointer to the custom cumulative data.
312 IN PERF_CUM_DATA
*CustomCumulativeData OPTIONAL