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 - 2010, Intel Corporation. All rights reserved.<BR>
10 * This program and the accompanying materials
11 * are licensed and made available under the terms and conditions of the BSD License
12 * which accompanies this distribution. The full text of the license may be found at
13 * http://opensource.org/licenses/bsd-license.php
15 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #ifndef _DP_INTELNAL_H_
19 #define _DP_INTELNAL_H_
21 /// Module-Global Variables
23 extern EFI_HII_HANDLE gHiiHandle
;
24 extern CHAR16
*mPrintTokenBuffer
;
25 extern CHAR16 mGaugeString
[DXE_PERFORMANCE_STRING_SIZE
];
26 extern CHAR16 mUnicodeToken
[PERF_TOKEN_LENGTH
+ 1];
27 extern UINT64 mInterestThreshold
;
29 extern PERF_SUMMARY_DATA SummaryData
; ///< Create the SummaryData structure and init. to ZERO.
31 /// Timer Specific Information.
32 extern TIMER_INFO TimerInfo
;
34 /// Items for which to gather cumulative statistics.
35 extern PERF_CUM_DATA CumData
[];
37 /// Number of items for which we are gathering cumulative statistics.
38 extern UINT32
const NumCum
;
43 Calculate an event's duration in timer ticks.
45 Given the count direction and the event's start and end timer values,
46 calculate the duration of the event in timer ticks. Information for
47 the current measurement is pointed to by the parameter.
49 If the measurement's start time is 1, it indicates that the developer
50 is indicating that the measurement began at the release of reset.
51 The start time is adjusted to the timer's starting count before performing
52 the elapsed time calculation.
54 The calculated duration, in ticks, is the absolute difference between
55 the measurement's ending and starting counts.
57 @param Measurement Pointer to a MEASUREMENT_RECORD structure containing
58 data for the current measurement.
60 @return The 64-bit duration of the event.
64 IN OUT MEASUREMENT_RECORD
*Measurement
68 Determine whether the Measurement record is for an EFI Phase.
70 The Token and Module members of the measurement record are checked.
71 Module must be empty and Token must be one of SEC, PEI, DXE, BDS, or SHELL.
73 @param[in] Measurement A pointer to the Measurement record to test.
75 @retval TRUE The measurement record is for an EFI Phase.
76 @retval FALSE The measurement record is NOT for an EFI Phase.
80 IN MEASUREMENT_RECORD
*Measurement
84 Get the file name portion of the Pdb File Name.
86 The portion of the Pdb File Name between the last backslash and
87 either a following period or the end of the string is converted
88 to Unicode and copied into UnicodeBuffer. The name is truncated,
89 if necessary, to ensure that UnicodeBuffer is not overrun.
91 @param[in] PdbFileName Pdb file name.
92 @param[out] UnicodeBuffer The resultant Unicode File Name.
97 IN CHAR8
*PdbFileName
,
98 OUT CHAR16
*UnicodeBuffer
102 Get a human readable name for an image handle.
106 @post The resulting Unicode name string is stored in the
107 mGaugeString global array.
116 Calculate the Duration in microseconds.
118 Duration is multiplied by 1000, instead of Frequency being divided by 1000 or
119 multiplying the result by 1000, in order to maintain precision. Since Duration is
120 a 64-bit value, multiplying it by 1000 is unlikely to produce an overflow.
122 The time is calculated as (Duration * 1000) / Timer_Frequency.
124 @param[in] Duration The event duration in timer ticks.
126 @return A 64-bit value which is the Elapsed time in microseconds.
129 DurationInMicroSeconds (
134 Formatted Print using a Hii Token to reference the localized format string.
136 @param[in] Token A HII token associated with a localized Unicode string.
137 @param[in] ... The variable argument list.
139 @return The number of characters converted by UnicodeVSPrint().
149 Get index of Measurement Record's match in the CumData array.
151 If the Measurement's Token value matches a Token in one of the CumData
152 records, the index of the matching record is returned. The returned
153 index is a signed value so that negative values can indicate that
154 the Measurement didn't match any entry in the CumData array.
156 @param[in] Measurement A pointer to a Measurement Record to match against the CumData array.
158 @retval <0 Token is not in the CumData array.
159 @retval >=0 Return value is the index into CumData where Token is found.
163 IN MEASUREMENT_RECORD
*Measurement
167 Collect verbose statistics about the logged performance measurements.
169 General Summary information for all Trace measurements is gathered and
170 stored within the SummaryData structure. This information is both
171 used internally by subsequent reporting functions, and displayed
172 at the end of verbose reports.
174 @pre The SummaryData and CumData structures must be initialized
175 prior to calling this function.
177 @post The SummaryData and CumData structures contain statistics for the
178 current performance logs.
186 Gather and print ALL Trace Records.
188 Displays all "interesting" Trace measurements in order.<BR>
189 The number of records displayed is controlled by:
190 - records with a duration less than mInterestThreshold microseconds are not displayed.
191 - No more than Limit records are displayed. A Limit of zero will not limit the output.
192 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
195 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
196 The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
197 They must not be in use by a calling function.
199 @param[in] Limit The number of records to print. Zero is ALL.
200 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
206 IN BOOLEAN ExcludeFlag
210 Gather and print Raw Trace Records.
212 All Trace measurements with a duration greater than or equal to
213 mInterestThreshold are printed without interpretation.
215 The number of records displayed is controlled by:
216 - records with a duration less than mInterestThreshold microseconds are not displayed.
217 - No more than Limit records are displayed. A Limit of zero will not limit the output.
218 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
221 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
223 @param[in] Limit The number of records to print. Zero is ALL.
224 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
230 IN BOOLEAN ExcludeFlag
234 Gather and print Major Phase metrics.
236 @param[in] Ticker The timer value for the END of Shell phase
246 Gather and print Handle data.
248 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
250 @return Status from a call to gBS->LocateHandle().
254 IN BOOLEAN ExcludeFlag
259 Gather and print PEIM data.
261 Only prints complete PEIM records
270 Gather and print global data.
272 Strips out incomplete or "Execution Phase" records
273 Only prints records where Handle is NULL
274 Increment TIndex for every record, even skipped ones, so that we have an
275 indication of every measurement record taken.
284 Gather and print cumulative data.
286 Traverse the measurement records and:<BR>
287 For each record with a Token listed in the CumData array:<BR>
288 - Update the instance count and the total, minimum, and maximum durations.
289 Finally, print the gathered cumulative statistics.
298 Gather and print ALL Profiling Records.
300 Displays all "interesting" Profile measurements in order.
301 The number of records displayed is controlled by:
302 - records with a duration less than mInterestThreshold microseconds are not displayed.
303 - No more than Limit records are displayed. A Limit of zero will not limit the output.
304 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
307 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
308 The mGaugeString and mUnicodeToken global arrays are used for temporary string storage.
309 They must not be in use by a calling function.
311 @param[in] Limit The number of records to print. Zero is ALL.
312 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
318 IN BOOLEAN ExcludeFlag
322 Gather and print Raw Profile Records.
324 All Profile measurements with a duration greater than or equal to
325 mInterestThreshold are printed without interpretation.
327 The number of records displayed is controlled by:
328 - records with a duration less than mInterestThreshold microseconds are not displayed.
329 - No more than Limit records are displayed. A Limit of zero will not limit the output.
330 - If the ExcludeFlag is TRUE, records matching entries in the CumData array are not
333 @pre The mInterestThreshold global variable is set to the shortest duration to be printed.
335 @param[in] Limit The number of records to print. Zero is ALL.
336 @param[in] ExcludeFlag TRUE to exclude individual Cumulative items from display.
342 IN BOOLEAN ExcludeFlag