]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h
MdeModulePkg BrotliLib: Rename function with the specific lib name
[mirror_edk2.git] / MdeModulePkg / Library / DxeCorePerformanceLib / DxeCorePerformanceLibInternal.h
1 /** @file
2 Master header files for DxeCorePerformanceLib instance.
3
4 This header file holds the prototypes of the Performance and PerformanceEx Protocol published by this
5 library instance at its constructor.
6
7 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef _DXE_CORE_PERFORMANCE_LIB_INTERNAL_H_
19 #define _DXE_CORE_PERFORMANCE_LIB_INTERNAL_H_
20
21
22 #include <PiDxe.h>
23
24 #include <Guid/Performance.h>
25 #include <Guid/ExtendedFirmwarePerformance.h>
26 #include <Guid/ZeroGuid.h>
27 #include <Guid/EventGroup.h>
28 #include <Guid/FirmwarePerformance.h>
29 #include <Guid/PiSmmCommunicationRegionTable.h>
30
31 #include <Protocol/DriverBinding.h>
32 #include <Protocol/LoadedImage.h>
33 #include <Protocol/ComponentName2.h>
34 #include <Protocol/DevicePathToText.h>
35 #include <Protocol/SmmCommunication.h>
36
37 #include <Library/PerformanceLib.h>
38 #include <Library/DebugLib.h>
39 #include <Library/HobLib.h>
40 #include <Library/BaseLib.h>
41 #include <Library/BaseMemoryLib.h>
42 #include <Library/TimerLib.h>
43 #include <Library/PcdLib.h>
44 #include <Library/UefiBootServicesTableLib.h>
45 #include <Library/UefiRuntimeServicesTableLib.h>
46 #include <Library/MemoryAllocationLib.h>
47 #include <Library/UefiLib.h>
48 #include <Library/ReportStatusCodeLib.h>
49 #include <Library/DxeServicesLib.h>
50 #include <Library/PeCoffGetEntryPointLib.h>
51
52 //
53 // Interface declarations for PerformanceEx Protocol.
54 //
55 /**
56 Adds a record at the end of the performance measurement log
57 that records the start time of a performance measurement.
58
59 Adds a record to the end of the performance measurement log
60 that contains the Handle, Token, Module and Identifier.
61 The end time of the new record must be set to zero.
62 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
63 If TimeStamp is zero, the start time in the record is filled in with the value
64 read from the current time stamp.
65
66 @param Handle Pointer to environment specific context used
67 to identify the component being measured.
68 @param Token Pointer to a Null-terminated ASCII string
69 that identifies the component being measured.
70 @param Module Pointer to a Null-terminated ASCII string
71 that identifies the module being measured.
72 @param TimeStamp 64-bit time stamp.
73 @param Identifier 32-bit identifier. If the value is 0, the created record
74 is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.
75
76 @retval EFI_SUCCESS The data was read correctly from the device.
77 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
78
79 **/
80 EFI_STATUS
81 EFIAPI
82 StartGaugeEx (
83 IN CONST VOID *Handle, OPTIONAL
84 IN CONST CHAR8 *Token, OPTIONAL
85 IN CONST CHAR8 *Module, OPTIONAL
86 IN UINT64 TimeStamp,
87 IN UINT32 Identifier
88 );
89
90 /**
91 Searches the performance measurement log from the beginning of the log
92 for the first matching record that contains a zero end time and fills in a valid end time.
93
94 Searches the performance measurement log from the beginning of the log
95 for the first record that matches Handle, Token, Module and Identifier and has an end time value of zero.
96 If the record can not be found then return EFI_NOT_FOUND.
97 If the record is found and TimeStamp is not zero,
98 then the end time in the record is filled in with the value specified by TimeStamp.
99 If the record is found and TimeStamp is zero, then the end time in the matching record
100 is filled in with the current time stamp value.
101
102 @param Handle Pointer to environment specific context used
103 to identify the component being measured.
104 @param Token Pointer to a Null-terminated ASCII string
105 that identifies the component being measured.
106 @param Module Pointer to a Null-terminated ASCII string
107 that identifies the module being measured.
108 @param TimeStamp 64-bit time stamp.
109 @param Identifier 32-bit identifier. If the value is 0, the found record
110 is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.
111
112 @retval EFI_SUCCESS The end of the measurement was recorded.
113 @retval EFI_NOT_FOUND The specified measurement record could not be found.
114
115 **/
116 EFI_STATUS
117 EFIAPI
118 EndGaugeEx (
119 IN CONST VOID *Handle, OPTIONAL
120 IN CONST CHAR8 *Token, OPTIONAL
121 IN CONST CHAR8 *Module, OPTIONAL
122 IN UINT64 TimeStamp,
123 IN UINT32 Identifier
124 );
125
126 /**
127 Retrieves a previously logged performance measurement.
128 It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,
129 and then assign the Identifier with 0.
130
131 Retrieves the performance log entry from the performance log specified by LogEntryKey.
132 If it stands for a valid entry, then EFI_SUCCESS is returned and
133 GaugeDataEntryEx stores the pointer to that entry.
134
135 @param LogEntryKey The key for the previous performance measurement log entry.
136 If 0, then the first performance measurement log entry is retrieved.
137 @param GaugeDataEntryEx The indirect pointer to the extended gauge data entry specified by LogEntryKey
138 if the retrieval is successful.
139
140 @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.
141 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).
142 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).
143 @retval EFI_INVALIDE_PARAMETER GaugeDataEntryEx is NULL.
144
145 **/
146 EFI_STATUS
147 EFIAPI
148 GetGaugeEx (
149 IN UINTN LogEntryKey,
150 OUT GAUGE_DATA_ENTRY_EX **GaugeDataEntryEx
151 );
152
153 //
154 // Interface declarations for Performance Protocol.
155 //
156 /**
157 Adds a record at the end of the performance measurement log
158 that records the start time of a performance measurement.
159
160 Adds a record to the end of the performance measurement log
161 that contains the Handle, Token, and Module.
162 The end time of the new record must be set to zero.
163 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
164 If TimeStamp is zero, the start time in the record is filled in with the value
165 read from the current time stamp.
166
167 @param Handle Pointer to environment specific context used
168 to identify the component being measured.
169 @param Token Pointer to a Null-terminated ASCII string
170 that identifies the component being measured.
171 @param Module Pointer to a Null-terminated ASCII string
172 that identifies the module being measured.
173 @param TimeStamp 64-bit time stamp.
174
175 @retval EFI_SUCCESS The data was read correctly from the device.
176 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
177
178 **/
179 EFI_STATUS
180 EFIAPI
181 StartGauge (
182 IN CONST VOID *Handle, OPTIONAL
183 IN CONST CHAR8 *Token, OPTIONAL
184 IN CONST CHAR8 *Module, OPTIONAL
185 IN UINT64 TimeStamp
186 );
187
188 /**
189 Searches the performance measurement log from the beginning of the log
190 for the first matching record that contains a zero end time and fills in a valid end time.
191
192 Searches the performance measurement log from the beginning of the log
193 for the first record that matches Handle, Token, and Module and has an end time value of zero.
194 If the record can not be found then return EFI_NOT_FOUND.
195 If the record is found and TimeStamp is not zero,
196 then the end time in the record is filled in with the value specified by TimeStamp.
197 If the record is found and TimeStamp is zero, then the end time in the matching record
198 is filled in with the current time stamp value.
199
200 @param Handle Pointer to environment specific context used
201 to identify the component being measured.
202 @param Token Pointer to a Null-terminated ASCII string
203 that identifies the component being measured.
204 @param Module Pointer to a Null-terminated ASCII string
205 that identifies the module being measured.
206 @param TimeStamp 64-bit time stamp.
207
208 @retval EFI_SUCCESS The end of the measurement was recorded.
209 @retval EFI_NOT_FOUND The specified measurement record could not be found.
210
211 **/
212 EFI_STATUS
213 EFIAPI
214 EndGauge (
215 IN CONST VOID *Handle, OPTIONAL
216 IN CONST CHAR8 *Token, OPTIONAL
217 IN CONST CHAR8 *Module, OPTIONAL
218 IN UINT64 TimeStamp
219 );
220
221 /**
222 Retrieves a previously logged performance measurement.
223 It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,
224 and then eliminate the Identifier.
225
226 Retrieves the performance log entry from the performance log specified by LogEntryKey.
227 If it stands for a valid entry, then EFI_SUCCESS is returned and
228 GaugeDataEntry stores the pointer to that entry.
229
230 @param LogEntryKey The key for the previous performance measurement log entry.
231 If 0, then the first performance measurement log entry is retrieved.
232 @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey
233 if the retrieval is successful.
234
235 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.
236 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).
237 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).
238 @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.
239
240 **/
241 EFI_STATUS
242 EFIAPI
243 GetGauge (
244 IN UINTN LogEntryKey,
245 OUT GAUGE_DATA_ENTRY **GaugeDataEntry
246 );
247
248
249 #endif