]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Protocol/Performance.h
Correct typo in comments, clean IfrSupportLib.h
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / Performance.h
CommitLineData
1e354c03 1/** @file\r
2 Performance protocol interfaces to support cross module performance logging. \r
88f20127 3\r
1e354c03 4Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
88f20127 5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
1e354c03 13**/\r
88f20127 14\r
15#ifndef __PERFORMANCE_H__\r
16#define __PERFORMANCE_H__\r
17\r
18#define PERFORMANCE_PROTOCOL_GUID \\r
19 { 0x76b6bdfa, 0x2acd, 0x4462, {0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 0x37 } }\r
20\r
21//\r
22// Forward reference for pure ANSI compatability\r
23//\r
24typedef struct _PERFORMANCE_PROTOCOL PERFORMANCE_PROTOCOL;\r
25\r
34c4ae47 26#define SEC_TOK "SEC"\r
88f20127 27#define DXE_TOK "DXE"\r
28#define SHELL_TOK "SHELL"\r
29#define PEI_TOK "PEI"\r
30#define BDS_TOK "BDS"\r
34c4ae47 31#define DRIVERBINDING_START_TOK "DB:Start:"\r
32#define DRIVERBINDING_SUPPORT_TOK "DB:Support:"\r
33#define START_IMAGE_TOK "StartImage:"\r
34#define LOAD_IMAGE_TOK "LoadImage:"\r
88f20127 35\r
36//\r
37// DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
38//\r
39#define DXE_PERFORMANCE_STRING_SIZE 32\r
40#define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)\r
41\r
42//\r
43// The default guage entries number for DXE phase.\r
44//\r
45#define INIT_DXE_GAUGE_DATA_ENTRIES 800\r
46\r
47typedef struct {\r
48 EFI_PHYSICAL_ADDRESS Handle;\r
b9982883
LG
49 CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE]; ///> Measured token string name \r
50 CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE]; ///> Module string name\r
51 UINT64 StartTimeStamp; ///> Start time point\r
52 UINT64 EndTimeStamp; ///> End time point\r
88f20127 53} GAUGE_DATA_ENTRY;\r
54\r
55//\r
56// The header must be aligned at 8 bytes\r
57//\r
58typedef struct {\r
b9982883 59 UINT32 NumberOfEntries; ///> The number of all performance guage entries\r
88f20127 60 UINT32 Reserved;\r
61} GAUGE_DATA_HEADER;\r
62\r
63/**\r
64 Adds a record at the end of the performance measurement log\r
65 that records the start time of a performance measurement.\r
66\r
67 Adds a record to the end of the performance measurement log\r
68 that contains the Handle, Token, and Module.\r
69 The end time of the new record must be set to zero.\r
70 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
71 If TimeStamp is zero, the start time in the record is filled in with the value\r
72 read from the current time stamp.\r
73\r
74 @param Handle Pointer to environment specific context used\r
75 to identify the component being measured.\r
76 @param Token Pointer to a Null-terminated ASCII string\r
77 that identifies the component being measured.\r
78 @param Module Pointer to a Null-terminated ASCII string\r
79 that identifies the module being measured.\r
80 @param TimeStamp 64-bit time stamp.\r
81\r
82 @retval EFI_SUCCESS The data was read correctly from the device.\r
83 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
84\r
85**/\r
86typedef\r
87EFI_STATUS\r
7d839888 88(EFIAPI * PERFORMANCE_START_GAUGE)(\r
88f20127 89 IN CONST VOID *Handle, OPTIONAL\r
90 IN CONST CHAR8 *Token, OPTIONAL\r
91 IN CONST CHAR8 *Module, OPTIONAL\r
92 IN UINT64 TimeStamp\r
93 );\r
94\r
95/**\r
96 Searches the performance measurement log from the beginning of the log\r
97 for the first matching record that contains a zero end time and fills in a valid end time.\r
98\r
99 Searches the performance measurement log from the beginning of the log\r
100 for the first record that matches Handle, Token, and Module and has an end time value of zero.\r
101 If the record can not be found then return EFI_NOT_FOUND.\r
102 If the record is found and TimeStamp is not zero,\r
103 then the end time in the record is filled in with the value specified by TimeStamp.\r
104 If the record is found and TimeStamp is zero, then the end time in the matching record\r
105 is filled in with the current time stamp value.\r
106\r
107 @param Handle Pointer to environment specific context used\r
108 to identify the component being measured.\r
109 @param Token Pointer to a Null-terminated ASCII string\r
110 that identifies the component being measured.\r
111 @param Module Pointer to a Null-terminated ASCII string\r
112 that identifies the module being measured.\r
113 @param TimeStamp 64-bit time stamp.\r
114\r
115 @retval EFI_SUCCESS The end of the measurement was recorded.\r
116 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
117\r
118**/\r
119typedef\r
120EFI_STATUS\r
7d839888 121(EFIAPI * PERFORMANCE_END_GAUGE)(\r
88f20127 122 IN CONST VOID *Handle, OPTIONAL\r
123 IN CONST CHAR8 *Token, OPTIONAL\r
124 IN CONST CHAR8 *Module, OPTIONAL\r
125 IN UINT64 TimeStamp\r
126 );\r
127\r
128/**\r
129 Retrieves a previously logged performance measurement.\r
130\r
131 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
132 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
133 GaugeDataEntry stores the pointer to that entry.\r
134\r
135 @param LogEntryKey The key for the previous performance measurement log entry.\r
136 If 0, then the first performance measurement log entry is retrieved.\r
137 @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey\r
138 if the retrieval is successful.\r
139\r
d7db0902 140 @retval EFI_SUCCESS The GuageDataEntry is successfully found based on LogEntryKey.\r
88f20127 141 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r
142 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r
143 @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.\r
144\r
145**/\r
146typedef\r
147EFI_STATUS\r
7d839888 148(EFIAPI * PERFORMANCE_GET_GAUGE)(\r
88f20127 149 IN UINTN LogEntryKey,\r
150 OUT GAUGE_DATA_ENTRY **GaugeDataEntry\r
151 );\r
152\r
153struct _PERFORMANCE_PROTOCOL {\r
154 PERFORMANCE_START_GAUGE StartGauge;\r
155 PERFORMANCE_END_GAUGE EndGauge;\r
156 PERFORMANCE_GET_GAUGE GetGauge;\r
157};\r
158\r
159extern EFI_GUID gPerformanceProtocolGuid;\r
160\r
161#endif\r