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