]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Add PERFORMANCE_MEASUREMENT_PROTOCOL
authorBi, Dandan <dandan.bi@intel.com>
Fri, 22 Jun 2018 08:56:15 +0000 (16:56 +0800)
committerLiming Gao <liming.gao@intel.com>
Tue, 26 Jun 2018 07:36:35 +0000 (15:36 +0800)
Add PerformanceMeasurement protocol to log performance info.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdeModulePkg/Include/Guid/PerformanceMeasurement.h [new file with mode: 0644]
MdeModulePkg/MdeModulePkg.dec

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
index 492b67d2513eab70e2e32beb11c1bb649b0b5833..f3d26475df85898184bd36a4df34dc1a30a776e5 100644 (file)
   gSmmPerformanceProtocolGuid    = { 0xf866226a, 0xeaa5, 0x4f5a, { 0xa9, 0xa,  0x6c, 0xfb, 0xa5, 0x7c, 0x58, 0x8e } }\r
   gPerformanceExProtocolGuid     = { 0x1ea81bec, 0xf01a, 0x4d98, { 0xa2, 0x1,  0x4a, 0x61, 0xce, 0x2f, 0xc0, 0x22 } }\r
   gSmmPerformanceExProtocolGuid  = { 0x931fc048, 0xc71d, 0x4455, { 0x89, 0x30, 0x47, 0x6,  0x30, 0xe3, 0xe,  0xe5 } }\r
+  #  Include/Guid/PerformanceMeasurement.h\r
+  gEdkiiPerformanceMeasurementProtocolGuid      = { 0xc85d06be, 0x5f75, 0x48ce, { 0xa8, 0x0f, 0x12, 0x36, 0xba, 0x3b, 0x87, 0xb1 } }\r
+  gEdkiiSmmPerformanceMeasurementProtocolGuid   = { 0xd56b6d73, 0x1a7b, 0x4015, { 0x9b, 0xb4, 0x7b, 0x07, 0x17, 0x29, 0xed, 0x24 } }\r
 \r
   ## Guid is defined for CRC32 encapsulation scheme.\r
   #  Include/Guid/Crc32GuidedSectionExtraction.h\r