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