]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BasePerformanceLibNull/PerformanceLib.c
01226cbb02abadbf94783910bf555f4c23de4f50
[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 Retrieves a previously logged performance measurement.
86
87 Retrieves the performance log entry from the performance log
88 that immediately follows the log entry specified by LogEntryKey.
89 If LogEntryKey is zero, then the first entry from the performance log is returned.
90 If the log entry specified by LogEntryKey is the last entry in the performance log,
91 then 0 is returned. Otherwise, the performance log entry is returned in Handle,
92 Token, Module, StartTimeStamp, and EndTimeStamp.
93 The key for the current performance log entry is returned.
94
95 @param LogEntryKey The key for the previous performance measurement log entry.
96 If 0, then the first performance measurement log entry is retrieved.
97 @param Handle Pointer to environment specific context used
98 to identify the component being measured.
99 @param Token Pointer to a Null-terminated ASCII string
100 that identifies the component being measured.
101 @param Module Pointer to a Null-terminated ASCII string
102 that identifies the module being measured.
103 @param StartTimeStamp The 64-bit time stamp that was recorded when the measurement was started.
104 @param EndTimeStamp The 64-bit time stamp that was recorded when the measurement was ended.
105
106 @return The key for the current performance log entry.
107
108 **/
109 UINTN
110 EFIAPI
111 GetPerformanceMeasurement (
112 UINTN LogEntryKey,
113 OUT CONST VOID **Handle,
114 OUT CONST CHAR8 **Token,
115 OUT CONST CHAR8 **Module,
116 OUT UINT64 *StartTimeStamp,
117 OUT UINT64 *EndTimeStamp
118 )
119 {
120 ASSERT (Handle != NULL);
121 ASSERT (Token != NULL);
122 ASSERT (Module != NULL);
123 ASSERT (StartTimeStamp != NULL);
124 ASSERT (EndTimeStamp != NULL);
125
126 return 0;
127 }
128
129 /**
130 Returns TRUE if the performance measurement macros are enabled.
131
132 This function returns TRUE if the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
133 PcdPerformanceLibraryPropertyMask is set. Otherwise FALSE is returned.
134
135 @retval TRUE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
136 PcdPerformanceLibraryPropertyMask is set.
137 @retval FALSE The PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of
138 PcdPerformanceLibraryPropertyMask is clear.
139
140 **/
141 BOOLEAN
142 EFIAPI
143 PerformanceMeasurementEnabled (
144 VOID
145 )
146 {
147 return ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
148 }