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