1 | /** @file
|
---|
2 | Header file for 'dp' command functions.
|
---|
3 |
|
---|
4 | Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _DP_H_
|
---|
10 | #define _DP_H_
|
---|
11 |
|
---|
12 |
|
---|
13 | #include <Uefi.h>
|
---|
14 |
|
---|
15 | #include <Guid/Performance.h>
|
---|
16 | #include <Guid/ExtendedFirmwarePerformance.h>
|
---|
17 | #include <Guid/FirmwarePerformance.h>
|
---|
18 |
|
---|
19 | #include <Protocol/HiiPackageList.h>
|
---|
20 | #include <Protocol/DevicePath.h>
|
---|
21 | #include <Protocol/LoadedImage.h>
|
---|
22 | #include <Protocol/UnicodeCollation.h>
|
---|
23 |
|
---|
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>
|
---|
38 |
|
---|
39 | extern EFI_HANDLE mDpHiiHandle;
|
---|
40 |
|
---|
41 | #define DP_MAJOR_VERSION 2
|
---|
42 | #define DP_MINOR_VERSION 5
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * The value assigned to DP_DEBUG controls which debug output
|
---|
46 | * is generated. Set it to ZERO to disable.
|
---|
47 | **/
|
---|
48 | #define DP_DEBUG 0
|
---|
49 |
|
---|
50 | #define DEFAULT_THRESHOLD 1000 ///< One millisecond.
|
---|
51 | #define DEFAULT_DISPLAYCOUNT 50
|
---|
52 | #define MAXIMUM_DISPLAYCOUNT 999999 ///< Arbitrary maximum reasonable number.
|
---|
53 |
|
---|
54 | #define PERF_MAXDUR 0xFFFFFFFFFFFFFFFFULL
|
---|
55 |
|
---|
56 | /// Determine whether 0 <= C < L. If L == 0, return true regardless of C.
|
---|
57 | #define WITHIN_LIMIT( C, L) ( ((L) == 0) || ((C) < (L)) )
|
---|
58 |
|
---|
59 | /// Structure for storing Timer specific information.
|
---|
60 | typedef struct {
|
---|
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.
|
---|
65 | } TIMER_INFO;
|
---|
66 |
|
---|
67 | /** Initialize one PERF_CUM_DATA structure instance for token t.
|
---|
68 | *
|
---|
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];
|
---|
75 | **/
|
---|
76 | #define PERF_INIT_CUM_DATA(t) { 0ULL, PERF_MAXDUR, 0ULL, (t), 0U }
|
---|
77 |
|
---|
78 | typedef struct {
|
---|
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.
|
---|
84 | } PERF_CUM_DATA;
|
---|
85 |
|
---|
86 | typedef struct {
|
---|
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.
|
---|
93 | } PERF_SUMMARY_DATA;
|
---|
94 |
|
---|
95 | typedef struct {
|
---|
96 | CONST VOID *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;
|
---|
103 |
|
---|
104 | typedef struct {
|
---|
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.
|
---|
110 | } PROFILE_RECORD;
|
---|
111 |
|
---|
112 | /**
|
---|
113 | Dump performance data.
|
---|
114 |
|
---|
115 | @param[in] ImageHandle The image handle.
|
---|
116 | @param[in] SystemTable The system table.
|
---|
117 |
|
---|
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.
|
---|
122 | **/
|
---|
123 | SHELL_STATUS
|
---|
124 | RunDp (
|
---|
125 | IN EFI_HANDLE ImageHandle,
|
---|
126 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
127 | );
|
---|
128 |
|
---|
129 | /**
|
---|
130 | Retrive HII package list from ImageHandle and publish to HII database.
|
---|
131 |
|
---|
132 | @param ImageHandle The image handle of the process.
|
---|
133 |
|
---|
134 | @return HII handle.
|
---|
135 | **/
|
---|
136 | EFI_HANDLE
|
---|
137 | InitializeHiiPackage (
|
---|
138 | EFI_HANDLE ImageHandle
|
---|
139 | );
|
---|
140 | #endif // _DP_H_
|
---|