]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Guid/Performance.h
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Include / Guid / Performance.h
CommitLineData
1e354c03 1/** @file\r
e9b67286 2 This file defines performance-related definitions, including the format of:\r
64a80549 3 * performance GUID HOB.\r
4 * performance protocol interfaces.\r
e9b67286 5 * performance variables. \r
88f20127 6\r
cd5ebaa0 7Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
64a80549 8This program and the accompanying materials are licensed and made available under \r
9the terms and conditions of the BSD License that accompanies this distribution. \r
10The full text of the license may be found at\r
11http://opensource.org/licenses/bsd-license.php. \r
88f20127 12\r
64a80549 13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
88f20127 14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
1e354c03 16**/\r
88f20127 17\r
72aff63a 18#ifndef __PERFORMANCE_DATA_H__\r
19#define __PERFORMANCE_DATA_H__\r
20\r
21//\r
22// PEI_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
23//\r
24#define PEI_PERFORMANCE_STRING_SIZE 8\r
25#define PEI_PERFORMANCE_STRING_LENGTH (PEI_PERFORMANCE_STRING_SIZE - 1)\r
26\r
27typedef struct {\r
28 EFI_PHYSICAL_ADDRESS Handle;\r
64a80549 29 CHAR8 Token[PEI_PERFORMANCE_STRING_SIZE]; ///< Measured token string name. \r
30 CHAR8 Module[PEI_PERFORMANCE_STRING_SIZE]; ///< Module string name.\r
31 UINT64 StartTimeStamp; ///< Start time point.\r
32 UINT64 EndTimeStamp; ///< End time point.\r
72aff63a 33} PEI_PERFORMANCE_LOG_ENTRY;\r
34\r
35//\r
36// The header must be aligned at 8 bytes.\r
37// \r
38typedef struct {\r
64a80549 39 UINT32 NumberOfEntries; ///< The number of all performance log entries.\r
72aff63a 40 UINT32 Reserved;\r
41} PEI_PERFORMANCE_LOG_HEADER;\r
42\r
43\r
44//\r
45// The data structure for performance data in ACPI memory.\r
46//\r
47#define PERFORMANCE_SIGNATURE SIGNATURE_32 ('P', 'e', 'r', 'f')\r
48#define PERF_TOKEN_SIZE 28\r
49#define PERF_TOKEN_LENGTH (PERF_TOKEN_SIZE - 1)\r
50#define PERF_PEI_ENTRY_MAX_NUM 50\r
51\r
52typedef struct {\r
53 CHAR8 Token[PERF_TOKEN_SIZE];\r
54 UINT32 Duration;\r
55} PERF_DATA;\r
56\r
57typedef struct {\r
58 UINT64 BootToOs;\r
59 UINT64 S3Resume;\r
60 UINT32 S3EntryNum;\r
61 PERF_DATA S3Entry[PERF_PEI_ENTRY_MAX_NUM];\r
62 UINT64 CpuFreq;\r
63 UINT64 BDSRaw;\r
64 UINT32 Count;\r
65 UINT32 Signiture;\r
66} PERF_HEADER;\r
88f20127 67\r
68#define PERFORMANCE_PROTOCOL_GUID \\r
69 { 0x76b6bdfa, 0x2acd, 0x4462, {0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }\r
70\r
71//\r
72aff63a 72// Forward reference for pure ANSI compatibility\r
88f20127 73//\r
74typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL;\r
75\r
88f20127 76//\r
77// DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
78//\r
79#define DXE_PERFORMANCE_STRING_SIZE 32\r
80#define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)\r
81\r
82//\r
83// The default guage entries number for DXE phase.\r
84//\r
85#define INIT_DXE_GAUGE_DATA_ENTRIES 800\r
86\r
87typedef struct {\r
88 EFI_PHYSICAL_ADDRESS Handle;\r
64a80549 89 CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///< Measured token string name. \r
90 CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///< Module string name.\r
91 UINT64 StartTimeStamp; ///< Start time point.\r
92 UINT64 EndTimeStamp; ///< End time point.\r
88f20127 93} GAUGE_DATA_ENTRY;\r
94\r
95//\r
96// The header must be aligned at 8 bytes\r
97//\r
98typedef struct {\r
64a80549 99 UINT32 NumberOfEntries; ///< The number of all performance gauge entries.\r
88f20127 100 UINT32 Reserved;\r
101} GAUGE_DATA_HEADER;\r
102\r
103/**\r
104 Adds a record at the end of the performance measurement log\r
105 that records the start time of a performance measurement.\r
106\r
e9b67286 107 The added record contains the Handle, Token, and Module.\r
108 The end time of the new record is not recorded, so it is set to zero.\r
88f20127 109 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
110 If TimeStamp is zero, the start time in the record is filled in with the value\r
111 read from the current time stamp.\r
112\r
64a80549 113 @param Handle The pointer to environment specific context used\r
88f20127 114 to identify the component being measured.\r
64a80549 115 @param Token The pointer to a Null-terminated ASCII string\r
88f20127 116 that identifies the component being measured.\r
64a80549 117 @param Module The pointer to a Null-terminated ASCII string\r
88f20127 118 that identifies the module being measured.\r
64a80549 119 @param TimeStamp The 64-bit time stamp.\r
88f20127 120\r
121 @retval EFI_SUCCESS The data was read correctly from the device.\r
122 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
123\r
124**/\r
125typedef\r
126EFI_STATUS\r
7d839888 127(EFIAPI * PERFORMANCE_START_GAUGE)(\r
88f20127 128 IN CONST VOID *Handle, OPTIONAL\r
129 IN CONST CHAR8 *Token, OPTIONAL\r
130 IN CONST CHAR8 *Module, OPTIONAL\r
131 IN UINT64 TimeStamp\r
132 );\r
133\r
134/**\r
135 Searches the performance measurement log from the beginning of the log\r
136 for the first matching record that contains a zero end time and fills in a valid end time.\r
137\r
138 Searches the performance measurement log from the beginning of the log\r
64a80549 139 for the first record that matches Handle, Token, and Module, and has an end time value of zero.\r
88f20127 140 If the record can not be found then return EFI_NOT_FOUND.\r
141 If the record is found and TimeStamp is not zero,\r
142 then the end time in the record is filled in with the value specified by TimeStamp.\r
143 If the record is found and TimeStamp is zero, then the end time in the matching record\r
144 is filled in with the current time stamp value.\r
145\r
64a80549 146 @param Handle The pointer to environment specific context used\r
88f20127 147 to identify the component being measured.\r
64a80549 148 @param Token The pointer to a Null-terminated ASCII string\r
88f20127 149 that identifies the component being measured.\r
64a80549 150 @param Module The pointer to a Null-terminated ASCII string\r
88f20127 151 that identifies the module being measured.\r
64a80549 152 @param TimeStamp The 64-bit time stamp.\r
88f20127 153\r
154 @retval EFI_SUCCESS The end of the measurement was recorded.\r
155 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
156\r
157**/\r
158typedef\r
159EFI_STATUS\r
7d839888 160(EFIAPI * PERFORMANCE_END_GAUGE)(\r
88f20127 161 IN CONST VOID *Handle, OPTIONAL\r
162 IN CONST CHAR8 *Token, OPTIONAL\r
163 IN CONST CHAR8 *Module, OPTIONAL\r
164 IN UINT64 TimeStamp\r
165 );\r
166\r
167/**\r
168 Retrieves a previously logged performance measurement.\r
169\r
170 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
171 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
172 GaugeDataEntry stores the pointer to that entry.\r
173\r
174 @param LogEntryKey The key for the previous performance measurement log entry.\r
175 If 0, then the first performance measurement log entry is retrieved.\r
e9b67286 176 @param GaugeDataEntry Out parameter for the indirect pointer to the gauge data entry specified by LogEntryKey.\r
177 \r
d7db0902 178 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.\r
e9b67286 179 @retval EFI_NOT_FOUND There is no entry after the measurement referred to by LogEntryKey.\r
180 @retval EFI_INVALID_PARAMETER The LogEntryKey is not a valid entry, or GaugeDataEntry is NULL.\r
88f20127 181\r
182**/\r
183typedef\r
184EFI_STATUS\r
7d839888 185(EFIAPI * PERFORMANCE_GET_GAUGE)(\r
88f20127 186 IN UINTN LogEntryKey,\r
187 OUT GAUGE_DATA_ENTRY **GaugeDataEntry\r
188 );\r
189\r
190struct _PERFORMANCE_PROTOCOL {\r
191 PERFORMANCE_START_GAUGE StartGauge;\r
192 PERFORMANCE_END_GAUGE EndGauge;\r
193 PERFORMANCE_GET_GAUGE GetGauge;\r
194};\r
195\r
196extern EFI_GUID gPerformanceProtocolGuid;\r
197\r
198#endif\r