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
14 #include <Guid/Performance.h>
15 #include <Guid/ExtendedFirmwarePerformance.h>
16 #include <Guid/FirmwarePerformance.h>
18 #include <Protocol/HiiPackageList.h>
19 #include <Protocol/DevicePath.h>
20 #include <Protocol/LoadedImage.h>
21 #include <Protocol/UnicodeCollation.h>
23 #include <Library/BaseLib.h>
24 #include <Library/BaseMemoryLib.h>
25 #include <Library/DebugLib.h>
26 #include <Library/MemoryAllocationLib.h>
27 #include <Library/ShellLib.h>
28 #include <Library/UefiLib.h>
29 #include <Library/UefiRuntimeServicesTableLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31 #include <Library/PcdLib.h>
32 #include <Library/SortLib.h>
33 #include <Library/HiiLib.h>
34 #include <Library/FileHandleLib.h>
35 #include <Library/UefiHiiServicesLib.h>
36 #include <Library/PerformanceLib.h>
38 extern EFI_HII_HANDLE mDpHiiHandle
;
40 #define DP_MAJOR_VERSION 2
41 #define DP_MINOR_VERSION 5
44 * The value assigned to DP_DEBUG controls which debug output
45 * is generated. Set it to ZERO to disable.
49 #define DEFAULT_THRESHOLD 1000 ///< One millisecond.
50 #define DEFAULT_DISPLAYCOUNT 50
51 #define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.
53 #define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL
55 /// Determine whether 0 <= C < L. If L == 0, return true regardless of C.
56 #define WITHIN_LIMIT(C, L) ( ((L) == 0) || ((C) < (L)) )
58 /// Structure for storing Timer specific information.
60 UINT64 StartCount
; ///< Value timer is initialized with.
61 UINT64 EndCount
; ///< Value timer has just before it wraps.
62 UINT32 Frequency
; ///< Timer count frequency in KHz.
63 BOOLEAN CountUp
; ///< TRUE if the counter counts up.
66 /** Initialize one PERF_CUM_DATA structure instance for token t.
68 * This parameterized macro takes a single argument, t, which is expected
69 * to resolve to a pointer to an ASCII string literal. This parameter may
70 * take any one of the following forms:
71 * - PERF_INIT_CUM_DATA("Token") A string literal
72 * - PERF_INIT_CUM_DATA(pointer) A pointer -- CHAR8 *pointer;
73 * - PERF_INIT_CUM_DATA(array) Address of an array -- CHAR8 array[N];
75 #define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
78 UINT64 Duration
; ///< Cumulative duration for this item.
79 UINT64 MinDur
; ///< Smallest duration encountered.
80 UINT64 MaxDur
; ///< Largest duration encountered.
81 CHAR8
*Name
; ///< ASCII name of this item.
82 UINT32 Count
; ///< Total number of measurements accumulated.
86 UINT32 NumTrace
; ///< Number of recorded TRACE performance measurements.
87 UINT32 NumIncomplete
; ///< Number of measurements with no END value.
88 UINT32 NumSummary
; ///< Number of summary section measurements.
89 UINT32 NumHandles
; ///< Number of measurements with handles.
90 UINT32 NumPEIMs
; ///< Number of measurements of PEIMs.
91 UINT32 NumGlobal
; ///< Number of measurements with END value and NULL handle.
96 CONST CHAR8
*Token
; ///< Measured token string name.
97 CONST CHAR8
*Module
; ///< Module string name.
98 UINT64 StartTimeStamp
; ///< Start time point.
99 UINT64 EndTimeStamp
; ///< End time point.
100 UINT32 Identifier
; ///< Identifier.
101 } MEASUREMENT_RECORD
;
104 CHAR8
*Name
; ///< Measured token string name.
105 UINT64 CumulativeTime
; ///< Accumulated Elapsed Time.
106 UINT64 MinTime
; ///< Minimum Elapsed Time.
107 UINT64 MaxTime
; ///< Maximum Elapsed Time.
108 UINT32 Count
; ///< Number of measurements accumulated.
112 Dump performance data.
114 @param[in] ImageHandle The image handle.
115 @param[in] SystemTable The system table.
117 @retval SHELL_SUCCESS Command completed successfully.
118 @retval SHELL_INVALID_PARAMETER Command usage error.
119 @retval SHELL_ABORTED The user aborts the operation.
120 @retval value Unknown error.
124 IN EFI_HANDLE ImageHandle
,
125 IN EFI_SYSTEM_TABLE
*SystemTable
129 Retrieve HII package list from ImageHandle and publish to HII database.
131 @param ImageHandle The image handle of the process.
136 InitializeHiiPackage (
137 EFI_HANDLE ImageHandle