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