]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c
Removed MdePkg usage of ModuleName: in file headers
[mirror_edk2.git] / MdePkg / Library / BasePerformanceLibNull / PerformanceLib.c
1 /** @file
2 Base Performance Library which provides no service.
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 //
16 // The package level header files this module uses
17 //
18 #include <Base.h>
19 //
20 // The protocols, PPI and GUID defintions for this module
21 //
22 //
23 // The Library classes this module consumes
24 //
25 #include <Library/PerformanceLib.h>
26 #include <Library/DebugLib.h>
27 #include <Library/PcdLib.h>
28
29 /**
30 Creates a record for the beginning of a performance measurement.
31
32 Creates a record that contains the Handle, Token, and Module.
33 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
34 If TimeStamp is zero, then this function reads the current time stamp
35 and adds that time stamp value to the record as the start time.
36
37 @param Handle Pointer to environment specific context used
38 to identify the component being measured.
39 @param Token Pointer to a Null-terminated ASCII string
40 that identifies the component being measured.
41 @param Module Pointer to a Null-terminated ASCII string
42 that identifies the module being measured.
43 @param TimeStamp 64-bit time stamp.
44
45 @retval RETURN_SUCCESS The start of the measurement was recorded.
46 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
47
48 **/
49 RETURN_STATUS
50 EFIAPI
51 StartPerformanceMeasurement (
52 IN CONST VOID *Handle, OPTIONAL
53 IN CONST CHAR8 *Token,
54 IN CONST CHAR8 *Module,
55 IN UINT64 TimeStamp
56 )
57 {
58 return RETURN_SUCCESS;
59 }
60
61 /**
62 Fills in the end time of a performance measurement.
63
64 Looks up the record that matches Handle, Token, and Module.
65 If the record can not be found then return RETURN_NOT_FOUND.
66 If the record is found and TimeStamp is not zero,
67 then TimeStamp is added to the record as the end time.
68 If the record is found and TimeStamp is zero, then this function reads
69 the current time stamp and adds that time stamp value to the record as the end time.
70 If this function is called multiple times for the same record, then the end time is overwritten.
71
72 @param Handle Pointer to environment specific context used
73 to identify the component being measured.
74 @param Token Pointer to a Null-terminated ASCII string
75 that identifies the component being measured.
76 @param Module Pointer to a Null-terminated ASCII string
77 that identifies the module being measured.
78 @param TimeStamp 64-bit time stamp.
79
80 @retval RETURN_SUCCESS The end of the measurement was recorded.
81 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
82
83 **/
84 RETURN_STATUS
85 EFIAPI
86 EndPerformanceMeasurement (
87 IN CONST VOID *Handle, OPTIONAL
88 IN CONST CHAR8 *Token,
89 IN CONST CHAR8 *Module,
90 IN UINT64 TimeStamp
91 )
92 {
93 return RETURN_SUCCESS;
94 }
95
96 /**
97 Attempts to retrieve a performance measurement log entry from the performance measurement log.
98
99 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
100 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
101 and the key for the second entry in the log is returned. If the performance log is empty,
102 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
103 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
104 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
105 retrieved and an implementation specific non-zero key value that specifies the end of the performance
106 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
107 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
108 the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
109 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
110 If Handle is NULL, then ASSERT().
111 If Token is NULL, then ASSERT().
112 If Module is NULL, then ASSERT().
113 If StartTimeStamp is NULL, then ASSERT().
114 If EndTimeStamp is NULL, then ASSERT().
115
116 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
117 0, then the first performance measurement log entry is retrieved.
118 On exit, the key of the next performance lof entry entry.
119 @param Handle Pointer to environment specific context used to identify the component
120 being measured.
121 @param Token Pointer to a Null-terminated ASCII string that identifies the component
122 being measured.
123 @param Module Pointer to a Null-terminated ASCII string that identifies the module
124 being measured.
125 @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
126 was started.
127 @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement
128 was ended.
129
130 @return The key for the next performance log entry (in general case).
131
132 **/
133 UINTN
134 EFIAPI
135 GetPerformanceMeasurement (
136 IN UINTN LogEntryKey,
137 OUT CONST VOID **Handle,
138 OUT CONST CHAR8 **Token,
139 OUT CONST CHAR8 **Module,
140 OUT UINT64 *StartTimeStamp,
141 OUT UINT64 *EndTimeStamp
142 )
143 {
144 ASSERT (Handle != NULL);
145 ASSERT (Token != NULL);
146 ASSERT (Module != NULL);
147 ASSERT (StartTimeStamp != NULL);
148 ASSERT (EndTimeStamp != NULL);
149
150 return 0;
151 }
152
153 /**
154 Returns TRUE if the performance measurement macros are enabled.
155
156 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
157 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
158
159 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
160 PcdPerformanceLibraryPropertyMask is set.
161 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
162 PcdPerformanceLibraryPropertyMask is clear.
163
164 **/
165 BOOLEAN
166 EFIAPI
167 PerformanceMeasurementEnabled (
168 VOID
169 )
170 {
171 return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
172 }