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