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