]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c
Minor grammatical work--mostly adding periods. Items with ONLY period added did...
[mirror_edk2.git] / MdePkg / Library / BasePerformanceLibNull / PerformanceLib.c
1 /** @file
2 Base Performance Library which provides no service.
3
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 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 #include <Base.h>
17
18
19 #include <Library/PerformanceLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/PcdLib.h>
22
23 /**
24 Creates a record for the beginning of a performance measurement.
25
26 Creates a record that contains the Handle, Token, and Module.
27 If TimeStamp is not zero, then TimeStamp is added to the record as the start time.
28 If TimeStamp is zero, then this function reads the current time stamp
29 and adds that time stamp value to the record as the start time.
30
31 @param Handle The pointer to environment specific context used
32 to identify the component being measured.
33 @param Token The pointer to a Null-terminated ASCII string
34 that identifies the component being measured.
35 @param Module The pointer to a Null-terminated ASCII string
36 that identifies the module being measured.
37 @param TimeStamp 64-bit time stamp.
38
39 @retval RETURN_SUCCESS The start of the measurement was recorded.
40 @retval RETURN_OUT_OF_RESOURCES There are not enough resources to record the measurement.
41 @retval RETURN_DEVICE_ERROR A device error reading the time stamp.
42
43 **/
44 RETURN_STATUS
45 EFIAPI
46 StartPerformanceMeasurement (
47 IN CONST VOID *Handle, OPTIONAL
48 IN CONST CHAR8 *Token, OPTIONAL
49 IN CONST CHAR8 *Module, OPTIONAL
50 IN UINT64 TimeStamp
51 )
52 {
53 return RETURN_SUCCESS;
54 }
55
56 /**
57 Fills in the end time of a performance measurement.
58
59 Looks up the record that matches Handle, Token, and Module.
60 If the record can not be found then return RETURN_NOT_FOUND.
61 If the record is found and TimeStamp is not zero,
62 then TimeStamp is added to the record as the end time.
63 If the record is found and TimeStamp is zero, then this function reads
64 the current time stamp and adds that time stamp value to the record as the end time.
65 If this function is called multiple times for the same record, then the end time is overwritten.
66
67 @param Handle The pointer to environment specific context used
68 to identify the component being measured.
69 @param Token The pointer to a Null-terminated ASCII string
70 that identifies the component being measured.
71 @param Module The pointer to a Null-terminated ASCII string
72 that identifies the module being measured.
73 @param TimeStamp 64-bit time stamp.
74
75 @retval RETURN_SUCCESS The end of the measurement was recorded.
76 @retval RETURN_NOT_FOUND The specified measurement record could not be found.
77 @retval RETURN_DEVICE_ERROR A device error reading the time stamp.
78
79 **/
80 RETURN_STATUS
81 EFIAPI
82 EndPerformanceMeasurement (
83 IN CONST VOID *Handle, OPTIONAL
84 IN CONST CHAR8 *Token, OPTIONAL
85 IN CONST CHAR8 *Module, OPTIONAL
86 IN UINT64 TimeStamp
87 )
88 {
89 return RETURN_SUCCESS;
90 }
91
92 /**
93 Attempts to retrieve a performance measurement log entry from the performance measurement log.
94
95 Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is
96 zero on entry, then an attempt is made to retrieve the first entry from the performance log,
97 and the key for the second entry in the log is returned. If the performance log is empty,
98 then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance
99 log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is
100 returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is
101 retrieved and an implementation specific non-zero key value that specifies the end of the performance
102 log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry
103 is retrieved and zero is returned. In the cases where a performance log entry can be returned,
104 the log entry is returned in Handle, Token, Module, StartTimeStamp, and EndTimeStamp.
105 If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().
106 If Handle is NULL, then ASSERT().
107 If Token is NULL, then ASSERT().
108 If Module is NULL, then ASSERT().
109 If StartTimeStamp is NULL, then ASSERT().
110 If EndTimeStamp is NULL, then ASSERT().
111
112 @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.
113 0, then the first performance measurement log entry is retrieved.
114 On exit, the key of the next performance lof entry entry.
115 @param Handle The pointer to environment specific context used to identify the component
116 being measured.
117 @param Token The pointer to a Null-terminated ASCII string that identifies the component
118 being measured.
119 @param Module The pointer to a Null-terminated ASCII string that identifies the module
120 being measured.
121 @param StartTimeStamp The pointer to the 64-bit time stamp that was recorded when the measurement
122 was started.
123 @param EndTimeStamp The pointer to the 64-bit time stamp that was recorded when the measurement
124 was ended.
125
126 @return The key for the next performance log entry (in general case).
127
128 **/
129 UINTN
130 EFIAPI
131 GetPerformanceMeasurement (
132 IN UINTN LogEntryKey,
133 OUT CONST VOID **Handle,
134 OUT CONST CHAR8 **Token,
135 OUT CONST CHAR8 **Module,
136 OUT UINT64 *StartTimeStamp,
137 OUT UINT64 *EndTimeStamp
138 )
139 {
140 ASSERT (Handle != NULL);
141 ASSERT (Token != NULL);
142 ASSERT (Module != NULL);
143 ASSERT (StartTimeStamp != NULL);
144 ASSERT (EndTimeStamp != NULL);
145
146 return 0;
147 }
148
149 /**
150 Returns TRUE if the performance measurement macros are enabled.
151
152 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
153 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
154
155 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
156 PcdPerformanceLibraryPropertyMask is set.
157 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
158 PcdPerformanceLibraryPropertyMask is clear.
159
160 **/
161 BOOLEAN
162 EFIAPI
163 PerformanceMeasurementEnabled (
164 VOID
165 )
166 {
167 return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
168 }