2 Header file for 'dp' command functions.
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #include <Guid/Performance.h>
22 #include <Guid/ExtendedFirmwarePerformance.h>
23 #include <Guid/FirmwarePerformance.h>
24 #include <Guid/Acpi.h>
26 #include <Protocol/HiiPackageList.h>
27 #include <Protocol/DevicePath.h>
28 #include <Protocol/LoadedImage.h>
29 #include <Protocol/UnicodeCollation.h>
31 #include <Library/BaseLib.h>
32 #include <Library/BaseMemoryLib.h>
33 #include <Library/DebugLib.h>
34 #include <Library/MemoryAllocationLib.h>
35 #include <Library/ShellLib.h>
36 #include <Library/UefiLib.h>
37 #include <Library/UefiRuntimeServicesTableLib.h>
38 #include <Library/UefiBootServicesTableLib.h>
39 #include <Library/PcdLib.h>
40 #include <Library/SortLib.h>
41 #include <Library/HiiLib.h>
42 #include <Library/FileHandleLib.h>
43 #include <Library/UefiHiiServicesLib.h>
45 extern EFI_HANDLE mDpHiiHandle
;
47 #define DP_MAJOR_VERSION 2
48 #define DP_MINOR_VERSION 5
51 * The value assigned to DP_DEBUG controls which debug output
52 * is generated. Set it to ZERO to disable.
57 * Set to 1 once Profiling has been implemented in order to enable
58 * profiling related options and report output.
60 #define PROFILING_IMPLEMENTED 0
62 #define DEFAULT_THRESHOLD 1000 ///< One millisecond.
63 #define DEFAULT_DISPLAYCOUNT 50
64 #define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.
66 #define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL
68 /// Determine whether 0 <= C < L. If L == 0, return true regardless of C.
69 #define WITHIN_LIMIT( C, L) ( ((L) == 0) || ((C) < (L)) )
71 /// Structure for storing Timer specific information.
73 UINT64 StartCount
; ///< Value timer is initialized with.
74 UINT64 EndCount
; ///< Value timer has just before it wraps.
75 UINT32 Frequency
; ///< Timer count frequency in KHz.
76 BOOLEAN CountUp
; ///< TRUE if the counter counts up.
79 /** Initialize one PERF_CUM_DATA structure instance for token t.
81 * This parameterized macro takes a single argument, t, which is expected
82 * to resolve to a pointer to an ASCII string literal. This parameter may
83 * take any one of the following forms:
84 * - PERF_INIT_CUM_DATA("Token") A string literal
85 * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer;
86 * - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N];
88 #define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
91 UINT64 Duration
; ///< Cumulative duration for this item.
92 UINT64 MinDur
; ///< Smallest duration encountered.
93 UINT64 MaxDur
; ///< Largest duration encountered.
94 CHAR8
*Name
; ///< ASCII name of this item.
95 UINT32 Count
; ///< Total number of measurements accumulated.
99 UINT32 NumTrace
; ///< Number of recorded TRACE performance measurements.
100 UINT32 NumProfile
; ///< Number of recorded PROFILE performance measurements.
101 UINT32 NumIncomplete
; ///< Number of measurements with no END value.
102 UINT32 NumSummary
; ///< Number of summary section measurements.
103 UINT32 NumHandles
; ///< Number of measurements with handles.
104 UINT32 NumPEIMs
; ///< Number of measurements of PEIMs.
105 UINT32 NumGlobal
; ///< Number of measurements with END value and NULL handle.
110 CONST CHAR8
*Token
; ///< Measured token string name.
111 CONST CHAR8
*Module
; ///< Module string name.
112 UINT64 StartTimeStamp
; ///< Start time point.
113 UINT64 EndTimeStamp
; ///< End time point.
114 UINT32 Identifier
; ///< Identifier.
115 } MEASUREMENT_RECORD
;
118 CHAR8
*Name
; ///< Measured token string name.
119 UINT64 CumulativeTime
; ///< Accumulated Elapsed Time.
120 UINT64 MinTime
; ///< Minimum Elapsed Time.
121 UINT64 MaxTime
; ///< Maximum Elapsed Time.
122 UINT32 Count
; ///< Number of measurements accumulated.
126 Dump performance data.
128 @param[in] ImageHandle The image handle.
129 @param[in] SystemTable The system table.
131 @retval SHELL_SUCCESS Command completed successfully.
132 @retval SHELL_INVALID_PARAMETER Command usage error.
133 @retval SHELL_ABORTED The user aborts the operation.
134 @retval value Unknown error.
138 IN EFI_HANDLE ImageHandle
,
139 IN EFI_SYSTEM_TABLE
*SystemTable
143 Retrive HII package list from ImageHandle and publish to HII database.
145 @param ImageHandle The image handle of the process.
150 InitializeHiiPackage (
151 EFI_HANDLE ImageHandle