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