]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Guid/PerformanceMeasurement.h
MdeModulePkg: Add PERFORMANCE_MEASUREMENT_PROTOCOL
[mirror_edk2.git] / MdeModulePkg / Include / Guid / PerformanceMeasurement.h
CommitLineData
56f7741e
BD
1/** @file\r
2\r
3Copyright (c) 2017, Microsoft Corporation\r
4Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
5\r
6All rights reserved.\r
7Redistribution and use in source and binary forms, with or without\r
8modification, are permitted provided that the following conditions are met:\r
91. Redistributions of source code must retain the above copyright notice,\r
10this list of conditions and the following disclaimer.\r
112. Redistributions in binary form must reproduce the above copyright notice,\r
12this list of conditions and the following disclaimer in the documentation\r
13 and/or other materials provided with the distribution.\r
14\r
15THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
16ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
17WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
18IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
19INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
20BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
21DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
22LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
23OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
24ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
25\r
26Performance measurement protocol, allows logging performance data.\r
27\r
28**/\r
29\r
30#ifndef _PERFORMANCE_MEASUREMENT_H_\r
31#define _PERFORMANCE_MEASUREMENT_H_\r
32\r
33//\r
34// GUID for Performance measurement Protocol\r
35//\r
36#define PERFORMANCE_MEASUREMENT_PROTOCOL_GUID \\r
37 { 0xc85d06be, 0x5f75, 0x48ce, {0xa8, 0x0f, 0x12, 0x36, 0xba, 0x3b, 0x87, 0xb1 } }\r
38\r
39#define SMM_PERFORMANCE_MEASUREMENT_PROTOCOL_GUID \\r
40 { 0xd56b6d73, 0x1a7b, 0x4015, {0x9b, 0xb4, 0x7b, 0x07, 0x17, 0x29, 0xed, 0x24 } }\r
41\r
42typedef struct _EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL;\r
43\r
44typedef enum {\r
45 PerfStartEntry, // used in StartPerformanceMeasurement()/StartPerformanceMeasurementEx()\r
46 // (map to PERF_START/PERF_START_EX)\r
47 PerfEndEntry, // used in EndPerformanceMeasurement()/EndPerformanceMeasurementEx()\r
48 // (map to PERF_END/PERF_END_EX)\r
49 PerfEntry // used in LogPerformanceMeasurement()\r
50 // (map to other Perf macros except above 4 macros)\r
51} PERF_MEASUREMENT_ATTRIBUTE;\r
52\r
53/**\r
54 Create performance record with event description and a timestamp.\r
55\r
56 @param CallerIdentifier - Image handle or pointer to caller ID GUID.\r
57 @param Guid - Pointer to a GUID.\r
58 @param String - Pointer to a string describing the measurement.\r
59 @param TimeStamp - 64-bit time stamp.\r
60 @param Address - Pointer to a location in memory relevant to the measurement.\r
61 @param Identifier - Performance identifier describing the type of measurement.\r
62 @param Attribute - The attribute of the measurement. According to attribute can create a start\r
63 record for PERF_START/PERF_START_EX, or a end record for PERF_END/PERF_END_EX,\r
64 or a general record for other Perf macros.\r
65\r
66 @retval EFI_SUCCESS - Successfully created performance record.\r
67 @retval EFI_OUT_OF_RESOURCES - Ran out of space to store the records.\r
68 @retval EFI_INVALID_PARAMETER - Invalid parameter passed to function - NULL\r
69 pointer or invalid PerfId.\r
70\r
71**/\r
72typedef\r
73EFI_STATUS\r
74(EFIAPI *CREATE_PERFORMANCE_MEASUREMENT)(\r
75 IN CONST VOID *CallerIdentifier, OPTIONAL\r
76 IN CONST VOID *Guid, OPTIONAL\r
77 IN CONST CHAR8 *String, OPTIONAL\r
78 IN UINT64 TimeStamp, OPTIONAL\r
79 IN UINT64 Address, OPTIONAL\r
80 IN UINT32 Identifier,\r
81 IN PERF_MEASUREMENT_ATTRIBUTE Attribute\r
82 );\r
83\r
84struct _EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL {\r
85 CREATE_PERFORMANCE_MEASUREMENT CreatePerformanceMeasurement;\r
86};\r
87\r
88extern EFI_GUID gEdkiiPerformanceMeasurementProtocolGuid;\r
89extern EFI_GUID gEdkiiSmmPerformanceMeasurementProtocolGuid;\r
90\r
91#endif // _PERFORMANCE_MEASUREMENT_H_\r