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