]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLibInternal.h
MdeModulePkg: Add performance property configuration table
[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 - 2017, 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
26 #include <Library/PerformanceLib.h>
27 #include <Library/DebugLib.h>
28 #include <Library/HobLib.h>
29 #include <Library/BaseLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/TimerLib.h>
32 #include <Library/PcdLib.h>
33 #include <Library/UefiBootServicesTableLib.h>
34 #include <Library/MemoryAllocationLib.h>
35 #include <Library/UefiLib.h>
36
37 //
38 // Interface declarations for PerformanceEx Protocol.
39 //
40 /**
41 Adds a record at the end of the performance measurement log
42 that records the start time of a performance measurement.
43
44 Adds a record to the end of the performance measurement log
45 that contains the Handle, Token, Module and Identifier.
46 The end time of the new record must be set to zero.
47 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
48 If TimeStamp is zero, the start time in the record is filled in with the value
49 read from the current time stamp.
50
51 @param Handle Pointer to environment specific context used
52 to identify the component being measured.
53 @param Token Pointer to a Null-terminated ASCII string
54 that identifies the component being measured.
55 @param Module Pointer to a Null-terminated ASCII string
56 that identifies the module being measured.
57 @param TimeStamp 64-bit time stamp.
58 @param Identifier 32-bit identifier. If the value is 0, the created record
59 is same as the one created by StartGauge of PERFORMANCE_PROTOCOL.
60
61 @retval EFI_SUCCESS The data was read correctly from the device.
62 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
63
64 **/
65 EFI_STATUS
66 EFIAPI
67 StartGaugeEx (
68 IN CONST VOID *Handle, OPTIONAL
69 IN CONST CHAR8 *Token, OPTIONAL
70 IN CONST CHAR8 *Module, OPTIONAL
71 IN UINT64 TimeStamp,
72 IN UINT32 Identifier
73 );
74
75 /**
76 Searches the performance measurement log from the beginning of the log
77 for the first matching record that contains a zero end time and fills in a valid end time.
78
79 Searches the performance measurement log from the beginning of the log
80 for the first record that matches Handle, Token, Module and Identifier and has an end time value of zero.
81 If the record can not be found then return EFI_NOT_FOUND.
82 If the record is found and TimeStamp is not zero,
83 then the end time in the record is filled in with the value specified by TimeStamp.
84 If the record is found and TimeStamp is zero, then the end time in the matching record
85 is filled in with the current time stamp value.
86
87 @param Handle Pointer to environment specific context used
88 to identify the component being measured.
89 @param Token Pointer to a Null-terminated ASCII string
90 that identifies the component being measured.
91 @param Module Pointer to a Null-terminated ASCII string
92 that identifies the module being measured.
93 @param TimeStamp 64-bit time stamp.
94 @param Identifier 32-bit identifier. If the value is 0, the found record
95 is same as the one found by EndGauge of PERFORMANCE_PROTOCOL.
96
97 @retval EFI_SUCCESS The end of the measurement was recorded.
98 @retval EFI_NOT_FOUND The specified measurement record could not be found.
99
100 **/
101 EFI_STATUS
102 EFIAPI
103 EndGaugeEx (
104 IN CONST VOID *Handle, OPTIONAL
105 IN CONST CHAR8 *Token, OPTIONAL
106 IN CONST CHAR8 *Module, OPTIONAL
107 IN UINT64 TimeStamp,
108 IN UINT32 Identifier
109 );
110
111 /**
112 Retrieves a previously logged performance measurement.
113 It can also retrieve the log created by StartGauge and EndGauge of PERFORMANCE_PROTOCOL,
114 and then assign the Identifier with 0.
115
116 Retrieves the performance log entry from the performance log specified by LogEntryKey.
117 If it stands for a valid entry, then EFI_SUCCESS is returned and
118 GaugeDataEntryEx stores the pointer to that entry.
119
120 @param LogEntryKey The key for the previous performance measurement log entry.
121 If 0, then the first performance measurement log entry is retrieved.
122 @param GaugeDataEntryEx The indirect pointer to the extended gauge data entry specified by LogEntryKey
123 if the retrieval is successful.
124
125 @retval EFI_SUCCESS The GuageDataEntryEx is successfully found based on LogEntryKey.
126 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).
127 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).
128 @retval EFI_INVALIDE_PARAMETER GaugeDataEntryEx is NULL.
129
130 **/
131 EFI_STATUS
132 EFIAPI
133 GetGaugeEx (
134 IN UINTN LogEntryKey,
135 OUT GAUGE_DATA_ENTRY_EX **GaugeDataEntryEx
136 );
137
138 //
139 // Interface declarations for Performance Protocol.
140 //
141 /**
142 Adds a record at the end of the performance measurement log
143 that records the start time of a performance measurement.
144
145 Adds a record to the end of the performance measurement log
146 that contains the Handle, Token, and Module.
147 The end time of the new record must be set to zero.
148 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
149 If TimeStamp is zero, the start time in the record is filled in with the value
150 read from the current time stamp.
151
152 @param Handle Pointer to environment specific context used
153 to identify the component being measured.
154 @param Token Pointer to a Null-terminated ASCII string
155 that identifies the component being measured.
156 @param Module Pointer to a Null-terminated ASCII string
157 that identifies the module being measured.
158 @param TimeStamp 64-bit time stamp.
159
160 @retval EFI_SUCCESS The data was read correctly from the device.
161 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
162
163 **/
164 EFI_STATUS
165 EFIAPI
166 StartGauge (
167 IN CONST VOID *Handle, OPTIONAL
168 IN CONST CHAR8 *Token, OPTIONAL
169 IN CONST CHAR8 *Module, OPTIONAL
170 IN UINT64 TimeStamp
171 );
172
173 /**
174 Searches the performance measurement log from the beginning of the log
175 for the first matching record that contains a zero end time and fills in a valid end time.
176
177 Searches the performance measurement log from the beginning of the log
178 for the first record that matches Handle, Token, and Module and has an end time value of zero.
179 If the record can not be found then return EFI_NOT_FOUND.
180 If the record is found and TimeStamp is not zero,
181 then the end time in the record is filled in with the value specified by TimeStamp.
182 If the record is found and TimeStamp is zero, then the end time in the matching record
183 is filled in with the current time stamp value.
184
185 @param Handle Pointer to environment specific context used
186 to identify the component being measured.
187 @param Token Pointer to a Null-terminated ASCII string
188 that identifies the component being measured.
189 @param Module Pointer to a Null-terminated ASCII string
190 that identifies the module being measured.
191 @param TimeStamp 64-bit time stamp.
192
193 @retval EFI_SUCCESS The end of the measurement was recorded.
194 @retval EFI_NOT_FOUND The specified measurement record could not be found.
195
196 **/
197 EFI_STATUS
198 EFIAPI
199 EndGauge (
200 IN CONST VOID *Handle, OPTIONAL
201 IN CONST CHAR8 *Token, OPTIONAL
202 IN CONST CHAR8 *Module, OPTIONAL
203 IN UINT64 TimeStamp
204 );
205
206 /**
207 Retrieves a previously logged performance measurement.
208 It can also retrieve the log created by StartGaugeEx and EndGaugeEx of PERFORMANCE_EX_PROTOCOL,
209 and then eliminate the Identifier.
210
211 Retrieves the performance log entry from the performance log specified by LogEntryKey.
212 If it stands for a valid entry, then EFI_SUCCESS is returned and
213 GaugeDataEntry stores the pointer to that entry.
214
215 @param LogEntryKey The key for the previous performance measurement log entry.
216 If 0, then the first performance measurement log entry is retrieved.
217 @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey
218 if the retrieval is successful.
219
220 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.
221 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).
222 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).
223 @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.
224
225 **/
226 EFI_STATUS
227 EFIAPI
228 GetGauge (
229 IN UINTN LogEntryKey,
230 OUT GAUGE_DATA_ENTRY **GaugeDataEntry
231 );
232
233
234 #endif