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