2 Header file for 'dp' command functions.
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
15 #include <Guid/Performance.h>
16 #include <Guid/ExtendedFirmwarePerformance.h>
17 #include <Guid/FirmwarePerformance.h>
19 #include <Protocol/HiiPackageList.h>
20 #include <Protocol/DevicePath.h>
21 #include <Protocol/LoadedImage.h>
22 #include <Protocol/UnicodeCollation.h>
24 #include <Library/BaseLib.h>
25 #include <Library/BaseMemoryLib.h>
26 #include <Library/DebugLib.h>
27 #include <Library/MemoryAllocationLib.h>
28 #include <Library/ShellLib.h>
29 #include <Library/UefiLib.h>
30 #include <Library/UefiRuntimeServicesTableLib.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/PcdLib.h>
33 #include <Library/SortLib.h>
34 #include <Library/HiiLib.h>
35 #include <Library/FileHandleLib.h>
36 #include <Library/UefiHiiServicesLib.h>
37 #include <Library/PerformanceLib.h>
39 extern EFI_HII_HANDLE mDpHiiHandle
;
41 #define DP_MAJOR_VERSION 2
42 #define DP_MINOR_VERSION 5
45 * The value assigned to DP_DEBUG controls which debug output
46 * is generated. Set it to ZERO to disable.
50 #define DEFAULT_THRESHOLD 1000 ///< One millisecond.
51 #define DEFAULT_DISPLAYCOUNT 50
52 #define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.
54 #define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL
56 /// Determine whether 0 <= C < L. If L == 0, return true regardless of C.
57 #define WITHIN_LIMIT( C, L) ( ((L) == 0) || ((C) < (L)) )
59 /// Structure for storing Timer specific information.
61 UINT64 StartCount
; ///< Value timer is initialized with.
62 UINT64 EndCount
; ///< Value timer has just before it wraps.
63 UINT32 Frequency
; ///< Timer count frequency in KHz.
64 BOOLEAN CountUp
; ///< TRUE if the counter counts up.
67 /** Initialize one PERF_CUM_DATA structure instance for token t.
69 * This parameterized macro takes a single argument, t, which is expected
70 * to resolve to a pointer to an ASCII string literal. This parameter may
71 * take any one of the following forms:
72 * - PERF_INIT_CUM_DATA("Token") A string literal
73 * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer;
74 * - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N];
76 #define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
79 UINT64 Duration
; ///< Cumulative duration for this item.
80 UINT64 MinDur
; ///< Smallest duration encountered.
81 UINT64 MaxDur
; ///< Largest duration encountered.
82 CHAR8
*Name
; ///< ASCII name of this item.
83 UINT32 Count
; ///< Total number of measurements accumulated.
87 UINT32 NumTrace
; ///< Number of recorded TRACE performance measurements.
88 UINT32 NumIncomplete
; ///< Number of measurements with no END value.
89 UINT32 NumSummary
; ///< Number of summary section measurements.
90 UINT32 NumHandles
; ///< Number of measurements with handles.
91 UINT32 NumPEIMs
; ///< Number of measurements of PEIMs.
92 UINT32 NumGlobal
; ///< Number of measurements with END value and NULL handle.
97 CONST CHAR8
*Token
; ///< Measured token string name.
98 CONST CHAR8
*Module
; ///< Module string name.
99 UINT64 StartTimeStamp
; ///< Start time point.
100 UINT64 EndTimeStamp
; ///< End time point.
101 UINT32 Identifier
; ///< Identifier.
102 } MEASUREMENT_RECORD
;
105 CHAR8
*Name
; ///< Measured token string name.
106 UINT64 CumulativeTime
; ///< Accumulated Elapsed Time.
107 UINT64 MinTime
; ///< Minimum Elapsed Time.
108 UINT64 MaxTime
; ///< Maximum Elapsed Time.
109 UINT32 Count
; ///< Number of measurements accumulated.
113 Dump performance data.
115 @param[in] ImageHandle The image handle.
116 @param[in] SystemTable The system table.
118 @retval SHELL_SUCCESS Command completed successfully.
119 @retval SHELL_INVALID_PARAMETER Command usage error.
120 @retval SHELL_ABORTED The user aborts the operation.
121 @retval value Unknown error.
125 IN EFI_HANDLE ImageHandle
,
126 IN EFI_SYSTEM_TABLE
*SystemTable
130 Retrive HII package list from ImageHandle and publish to HII database.
132 @param ImageHandle The image handle of the process.
137 InitializeHiiPackage (
138 EFI_HANDLE ImageHandle