2 This file defines performance-related definitions, including the format of:
4 * performance protocol interfaces
5 * performance variables.
7 Copyright (c) 2009, Intel Corporation. <BR>
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #ifndef __PERFORMANCE_DATA_H__
19 #define __PERFORMANCE_DATA_H__
22 // PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.
24 #define PEI_PERFORMANCE_STRING_SIZE 8
25 #define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1)
28 EFI_PHYSICAL_ADDRESS Handle
;
29 CHAR8 Token
[PEI_PERFORMANCE_STRING_SIZE
]; ///> Measured token string name
30 CHAR8 Module
[PEI_PERFORMANCE_STRING_SIZE
]; ///> Module string name
31 UINT64 StartTimeStamp
; ///> Start time point
32 UINT64 EndTimeStamp
; ///> End time point
33 } PEI_PERFORMANCE_LOG_ENTRY
;
36 // The header must be aligned at 8 bytes.
39 UINT32 NumberOfEntries
; ///> The number of all performance log entries
41 } PEI_PERFORMANCE_LOG_HEADER
;
45 // The data structure for performance data in ACPI memory.
47 #define PERFORMANCE_SIGNATURE SIGNATURE_32 ('P', 'e', 'r', 'f')
48 #define PERF_TOKEN_SIZE 28
49 #define PERF_TOKEN_LENGTH (PERF_TOKEN_SIZE - 1)
50 #define PERF_PEI_ENTRY_MAX_NUM 50
53 CHAR8 Token
[PERF_TOKEN_SIZE
];
61 PERF_DATA S3Entry
[PERF_PEI_ENTRY_MAX_NUM
];
68 #define PERFORMANCE_PROTOCOL_GUID \
69 { 0x76b6bdfa, 0x2acd, 0x4462, {0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }
72 // Forward reference for pure ANSI compatibility
74 typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL
;
77 // DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.
79 #define DXE_PERFORMANCE_STRING_SIZE 32
80 #define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)
83 // The default guage entries number for DXE phase.
85 #define INIT_DXE_GAUGE_DATA_ENTRIES 800
88 EFI_PHYSICAL_ADDRESS Handle
;
89 CHAR8 Token
[DXE_PERFORMANCE_STRING_SIZE
]; ///> Measured token string name
90 CHAR8 Module
[DXE_PERFORMANCE_STRING_SIZE
]; ///> Module string name
91 UINT64 StartTimeStamp
; ///> Start time point
92 UINT64 EndTimeStamp
; ///> End time point
96 // The header must be aligned at 8 bytes
99 UINT32 NumberOfEntries
; ///> The number of all performance gauge entries
104 Adds a record at the end of the performance measurement log
105 that records the start time of a performance measurement.
107 The added record contains the Handle, Token, and Module.
108 The end time of the new record is not recorded, so it is set to zero.
109 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.
110 If TimeStamp is zero, the start time in the record is filled in with the value
111 read from the current time stamp.
113 @param Handle Pointer to environment specific context used
114 to identify the component being measured.
115 @param Token Pointer to a Null-terminated ASCII string
116 that identifies the component being measured.
117 @param Module Pointer to a Null-terminated ASCII string
118 that identifies the module being measured.
119 @param TimeStamp 64-bit time stamp.
121 @retval EFI_SUCCESS The data was read correctly from the device.
122 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.
127 (EFIAPI
* PERFORMANCE_START_GAUGE
)(
128 IN CONST VOID
*Handle
, OPTIONAL
129 IN CONST CHAR8
*Token
, OPTIONAL
130 IN CONST CHAR8
*Module
, OPTIONAL
135 Searches the performance measurement log from the beginning of the log
136 for the first matching record that contains a zero end time and fills in a valid end time.
138 Searches the performance measurement log from the beginning of the log
139 for the first record that matches Handle, Token, and Module and has an end time value of zero.
140 If the record can not be found then return EFI_NOT_FOUND.
141 If the record is found and TimeStamp is not zero,
142 then the end time in the record is filled in with the value specified by TimeStamp.
143 If the record is found and TimeStamp is zero, then the end time in the matching record
144 is filled in with the current time stamp value.
146 @param Handle Pointer to environment specific context used
147 to identify the component being measured.
148 @param Token Pointer to a Null-terminated ASCII string
149 that identifies the component being measured.
150 @param Module Pointer to a Null-terminated ASCII string
151 that identifies the module being measured.
152 @param TimeStamp 64-bit time stamp.
154 @retval EFI_SUCCESS The end of the measurement was recorded.
155 @retval EFI_NOT_FOUND The specified measurement record could not be found.
160 (EFIAPI
* PERFORMANCE_END_GAUGE
)(
161 IN CONST VOID
*Handle
, OPTIONAL
162 IN CONST CHAR8
*Token
, OPTIONAL
163 IN CONST CHAR8
*Module
, OPTIONAL
168 Retrieves a previously logged performance measurement.
170 Retrieves the performance log entry from the performance log specified by LogEntryKey.
171 If it stands for a valid entry, then EFI_SUCCESS is returned and
172 GaugeDataEntry stores the pointer to that entry.
174 @param LogEntryKey The key for the previous performance measurement log entry.
175 If 0, then the first performance measurement log entry is retrieved.
176 @param GaugeDataEntry Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey.
178 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.
179 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.
180 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL.
185 (EFIAPI
* PERFORMANCE_GET_GAUGE
)(
186 IN UINTN LogEntryKey
,
187 OUT GAUGE_DATA_ENTRY
**GaugeDataEntry
190 struct _PERFORMANCE_PROTOCOL
{
191 PERFORMANCE_START_GAUGE StartGauge
;
192 PERFORMANCE_END_GAUGE EndGauge
;
193 PERFORMANCE_GET_GAUGE GetGauge
;
196 extern EFI_GUID gPerformanceProtocolGuid
;