1 /** @file 2 3 Performance measurement protocol, allows logging performance data. 4 5 Copyright (c) 2017, Microsoft Corporation<BR> 6 Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> 7 SPDX-License-Identifier: BSD-2-Clause-Patent 8 9 **/ 10 11 #ifndef _PERFORMANCE_MEASUREMENT_H_ 12 #define _PERFORMANCE_MEASUREMENT_H_ 13 14 // 15 // GUID for Performance measurement Protocol 16 // 17 #define PERFORMANCE_MEASUREMENT_PROTOCOL_GUID \ 18 { 0xc85d06be, 0x5f75, 0x48ce, {0xa8, 0x0f, 0x12, 0x36, 0xba, 0x3b, 0x87, 0xb1 } } 19 20 #define SMM_PERFORMANCE_MEASUREMENT_PROTOCOL_GUID \ 21 { 0xd56b6d73, 0x1a7b, 0x4015, {0x9b, 0xb4, 0x7b, 0x07, 0x17, 0x29, 0xed, 0x24 } } 22 23 typedef struct _EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL; 24 25 typedef enum { 26 PerfStartEntry, // used in StartPerformanceMeasurement()/StartPerformanceMeasurementEx() 27 // (map to PERF_START/PERF_START_EX) 28 PerfEndEntry, // used in EndPerformanceMeasurement()/EndPerformanceMeasurementEx() 29 // (map to PERF_END/PERF_END_EX) 30 PerfEntry // used in LogPerformanceMeasurement() 31 // (map to other Perf macros except above 4 macros) 32 } PERF_MEASUREMENT_ATTRIBUTE; 33 34 /** 35 Create performance record with event description and a timestamp. 36 37 @param CallerIdentifier - Image handle or pointer to caller ID GUID. 38 @param Guid - Pointer to a GUID. 39 @param String - Pointer to a string describing the measurement. 40 @param TimeStamp - 64-bit time stamp. 41 @param Address - Pointer to a location in memory relevant to the measurement. 42 @param Identifier - Performance identifier describing the type of measurement. 43 @param Attribute - The attribute of the measurement. According to attribute can create a start 44 record for PERF_START/PERF_START_EX, or a end record for PERF_END/PERF_END_EX, 45 or a general record for other Perf macros. 46 47 @retval EFI_SUCCESS - Successfully created performance record. 48 @retval EFI_OUT_OF_RESOURCES - Ran out of space to store the records. 49 @retval EFI_INVALID_PARAMETER - Invalid parameter passed to function - NULL 50 pointer or invalid PerfId. 51 52 **/ 53 typedef 54 EFI_STATUS 55 (EFIAPI *CREATE_PERFORMANCE_MEASUREMENT)( 56 IN CONST VOID *CallerIdentifier, OPTIONAL 57 IN CONST VOID *Guid, OPTIONAL 58 IN CONST CHAR8 *String, OPTIONAL 59 IN UINT64 TimeStamp, OPTIONAL 60 IN UINT64 Address, OPTIONAL 61 IN UINT32 Identifier, 62 IN PERF_MEASUREMENT_ATTRIBUTE Attribute 63 ); 64 65 struct _EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL { 66 CREATE_PERFORMANCE_MEASUREMENT CreatePerformanceMeasurement; 67 }; 68 69 extern EFI_GUID gEdkiiPerformanceMeasurementProtocolGuid; 70 extern EFI_GUID gEdkiiSmmPerformanceMeasurementProtocolGuid; 71 72 #endif // _PERFORMANCE_MEASUREMENT_H_ 73