]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Guid/PerformanceMeasurement.h
MdeModulePkg: Add PERFORMANCE_MEASUREMENT_PROTOCOL
[mirror_edk2.git] / MdeModulePkg / Include / Guid / PerformanceMeasurement.h
diff --git a/MdeModulePkg/Include/Guid/PerformanceMeasurement.h b/MdeModulePkg/Include/Guid/PerformanceMeasurement.h
new file mode 100644 (file)
index 0000000..f2955c7
--- /dev/null
@@ -0,0 +1,91 @@
+/** @file\r
+\r
+Copyright (c) 2017, Microsoft Corporation\r
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+\r
+All rights reserved.\r
+Redistribution and use in source and binary forms, with or without\r
+modification, are permitted provided that the following conditions are met:\r
+1. Redistributions of source code must retain the above copyright notice,\r
+this list of conditions and the following disclaimer.\r
+2. Redistributions in binary form must reproduce the above copyright notice,\r
+this list of conditions and the following disclaimer in the documentation\r
+ and/or other materials provided with the distribution.\r
+\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+Performance measurement protocol, allows logging performance data.\r
+\r
+**/\r
+\r
+#ifndef _PERFORMANCE_MEASUREMENT_H_\r
+#define _PERFORMANCE_MEASUREMENT_H_\r
+\r
+//\r
+// GUID for Performance measurement Protocol\r
+//\r
+#define PERFORMANCE_MEASUREMENT_PROTOCOL_GUID \\r
+  { 0xc85d06be, 0x5f75, 0x48ce, {0xa8, 0x0f, 0x12, 0x36, 0xba, 0x3b, 0x87, 0xb1 } }\r
+\r
+#define SMM_PERFORMANCE_MEASUREMENT_PROTOCOL_GUID \\r
+  { 0xd56b6d73, 0x1a7b, 0x4015, {0x9b, 0xb4, 0x7b, 0x07, 0x17, 0x29, 0xed, 0x24 } }\r
+\r
+typedef struct _EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL;\r
+\r
+typedef enum {\r
+  PerfStartEntry,                        // used in StartPerformanceMeasurement()/StartPerformanceMeasurementEx()\r
+                                         // (map to PERF_START/PERF_START_EX)\r
+  PerfEndEntry,                          // used in EndPerformanceMeasurement()/EndPerformanceMeasurementEx()\r
+                                         // (map to PERF_END/PERF_END_EX)\r
+  PerfEntry                              // used in LogPerformanceMeasurement()\r
+                                         // (map to other Perf macros except above 4 macros)\r
+} PERF_MEASUREMENT_ATTRIBUTE;\r
+\r
+/**\r
+  Create performance record with event description and a timestamp.\r
+\r
+  @param CallerIdentifier  - Image handle or pointer to caller ID GUID.\r
+  @param Guid              - Pointer to a GUID.\r
+  @param String            - Pointer to a string describing the measurement.\r
+  @param TimeStamp         - 64-bit time stamp.\r
+  @param Address           - Pointer to a location in memory relevant to the measurement.\r
+  @param Identifier        - Performance identifier describing the type of measurement.\r
+  @param Attribute         - The attribute of the measurement. According to attribute can create a start\r
+                             record for PERF_START/PERF_START_EX, or a end record for PERF_END/PERF_END_EX,\r
+                             or a general record for other Perf macros.\r
+\r
+  @retval EFI_SUCCESS           - Successfully created performance record.\r
+  @retval EFI_OUT_OF_RESOURCES  - Ran out of space to store the records.\r
+  @retval EFI_INVALID_PARAMETER - Invalid parameter passed to function - NULL\r
+                                  pointer or invalid PerfId.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *CREATE_PERFORMANCE_MEASUREMENT)(\r
+  IN CONST VOID                        *CallerIdentifier, OPTIONAL\r
+  IN CONST VOID                        *Guid,     OPTIONAL\r
+  IN CONST CHAR8                       *String,   OPTIONAL\r
+  IN       UINT64                      TimeStamp, OPTIONAL\r
+  IN       UINT64                      Address,   OPTIONAL\r
+  IN       UINT32                      Identifier,\r
+  IN       PERF_MEASUREMENT_ATTRIBUTE  Attribute\r
+  );\r
+\r
+struct _EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL {\r
+  CREATE_PERFORMANCE_MEASUREMENT CreatePerformanceMeasurement;\r
+};\r
+\r
+extern EFI_GUID gEdkiiPerformanceMeasurementProtocolGuid;\r
+extern EFI_GUID gEdkiiSmmPerformanceMeasurementProtocolGuid;\r
+\r
+#endif // _PERFORMANCE_MEASUREMENT_H_\r