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