]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Protocol/Performance.h
Code scrube for MdeModule Definitions.
[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
26#define DXE_TOK "DXE"\r
27#define SHELL_TOK "SHELL"\r
28#define PEI_TOK "PEI"\r
29#define BDS_TOK "BDS"\r
30#define DRIVERBINDING_START_TOK "DriverBinding:Start"\r
31#define DRIVERBINDING_SUPPORT_TOK "DriverBinding:Support"\r
32#define START_IMAGE_TOK "StartImage"\r
33#define LOAD_IMAGE_TOK "LoadImage"\r
34\r
35//\r
36// DXE_PERFORMANCE_STRING_SIZE must be a multiple of 8.\r
37//\r
38#define DXE_PERFORMANCE_STRING_SIZE 32\r
39#define DXE_PERFORMANCE_STRING_LENGTH (DXE_PERFORMANCE_STRING_SIZE - 1)\r
40\r
41//\r
42// The default guage entries number for DXE phase.\r
43//\r
44#define INIT_DXE_GAUGE_DATA_ENTRIES 800\r
45\r
46typedef struct {\r
47 EFI_PHYSICAL_ADDRESS Handle;\r
48 CHAR8 Token[DXE_PERFORMANCE_STRING_SIZE];\r
49 CHAR8 Module[DXE_PERFORMANCE_STRING_SIZE];\r
50 UINT64 StartTimeStamp;\r
51 UINT64 EndTimeStamp;\r
52} GAUGE_DATA_ENTRY;\r
53\r
54//\r
55// The header must be aligned at 8 bytes\r
56//\r
57typedef struct {\r
58 UINT32 NumberOfEntries;\r
59 UINT32 Reserved;\r
60} GAUGE_DATA_HEADER;\r
61\r
62/**\r
63 Adds a record at the end of the performance measurement log\r
64 that records the start time of a performance measurement.\r
65\r
66 Adds a record to the end of the performance measurement log\r
67 that contains the Handle, Token, and Module.\r
68 The end time of the new record must be set to zero.\r
69 If TimeStamp is not zero, then TimeStamp is used to fill in the start time in the record.\r
70 If TimeStamp is zero, the start time in the record is filled in with the value\r
71 read from the current time stamp.\r
72\r
73 @param Handle Pointer to environment specific context used\r
74 to identify the component being measured.\r
75 @param Token Pointer to a Null-terminated ASCII string\r
76 that identifies the component being measured.\r
77 @param Module Pointer to a Null-terminated ASCII string\r
78 that identifies the module being measured.\r
79 @param TimeStamp 64-bit time stamp.\r
80\r
81 @retval EFI_SUCCESS The data was read correctly from the device.\r
82 @retval EFI_OUT_OF_RESOURCES There are not enough resources to record the measurement.\r
83\r
84**/\r
85typedef\r
86EFI_STATUS\r
87(EFIAPI * PERFORMANCE_START_GAUGE) (\r
88 IN CONST VOID *Handle, OPTIONAL\r
89 IN CONST CHAR8 *Token, OPTIONAL\r
90 IN CONST CHAR8 *Module, OPTIONAL\r
91 IN UINT64 TimeStamp\r
92 );\r
93\r
94/**\r
95 Searches the performance measurement log from the beginning of the log\r
96 for the first matching record that contains a zero end time and fills in a valid end time.\r
97\r
98 Searches the performance measurement log from the beginning of the log\r
99 for the first record that matches Handle, Token, and Module and has an end time value of zero.\r
100 If the record can not be found then return EFI_NOT_FOUND.\r
101 If the record is found and TimeStamp is not zero,\r
102 then the end time in the record is filled in with the value specified by TimeStamp.\r
103 If the record is found and TimeStamp is zero, then the end time in the matching record\r
104 is filled in with the current time stamp value.\r
105\r
106 @param Handle Pointer to environment specific context used\r
107 to identify the component being measured.\r
108 @param Token Pointer to a Null-terminated ASCII string\r
109 that identifies the component being measured.\r
110 @param Module Pointer to a Null-terminated ASCII string\r
111 that identifies the module being measured.\r
112 @param TimeStamp 64-bit time stamp.\r
113\r
114 @retval EFI_SUCCESS The end of the measurement was recorded.\r
115 @retval EFI_NOT_FOUND The specified measurement record could not be found.\r
116\r
117**/\r
118typedef\r
119EFI_STATUS\r
120(EFIAPI * PERFORMANCE_END_GAUGE) (\r
121 IN CONST VOID *Handle, OPTIONAL\r
122 IN CONST CHAR8 *Token, OPTIONAL\r
123 IN CONST CHAR8 *Module, OPTIONAL\r
124 IN UINT64 TimeStamp\r
125 );\r
126\r
127/**\r
128 Retrieves a previously logged performance measurement.\r
129\r
130 Retrieves the performance log entry from the performance log specified by LogEntryKey.\r
131 If it stands for a valid entry, then EFI_SUCCESS is returned and\r
132 GaugeDataEntry stores the pointer to that entry.\r
133\r
134 @param LogEntryKey The key for the previous performance measurement log entry.\r
135 If 0, then the first performance measurement log entry is retrieved.\r
136 @param GaugeDataEntry The indirect pointer to the gauge data entry specified by LogEntryKey\r
137 if the retrieval is successful.\r
138\r
139 @retval EFI_SUCCESS The GuageDataEntry is successfuly found based on LogEntryKey.\r
140 @retval EFI_NOT_FOUND The LogEntryKey is the last entry (equals to the total entry number).\r
141 @retval EFI_INVALIDE_PARAMETER The LogEntryKey is not a valid entry (greater than the total entry number).\r
142 @retval EFI_INVALIDE_PARAMETER GaugeDataEntry is NULL.\r
143\r
144**/\r
145typedef\r
146EFI_STATUS\r
147(EFIAPI * PERFORMANCE_GET_GAUGE) (\r
148 IN UINTN LogEntryKey,\r
149 OUT GAUGE_DATA_ENTRY **GaugeDataEntry\r
150 );\r
151\r
152struct _PERFORMANCE_PROTOCOL {\r
153 PERFORMANCE_START_GAUGE StartGauge;\r
154 PERFORMANCE_END_GAUGE EndGauge;\r
155 PERFORMANCE_GET_GAUGE GetGauge;\r
156};\r
157\r
158extern EFI_GUID gPerformanceProtocolGuid;\r
159\r
160#endif\r