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