Reviewed-by: Ruyu Ni <ruiyu...@intel.com>

-----Original Message-----
From: Liming Gao [mailto:liming....@intel.com] 
Sent: Tuesday, May 5, 2015 2:14 PM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] [Patch] MdeModulePkg: Update FirmwarePerformanceDataTableDxe 
for LegacyBoot

Change the code to listen EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT instead of the 
Legacy Boot event to provide more precise performance data.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming....@intel.com>
---
 .../FirmwarePerformanceDxe.c                       | 76 +++++++---------------
 1 file changed, 22 insertions(+), 54 deletions(-)

diff --git 
a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
 
b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
index dbe7ef7..423e8f2 100644
--- 
a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
+++ 
b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c
@@ -3,11 +3,11 @@
 
   This module register report status code listener to collect performance data
   for Firmware Basic Boot Performance Record and other boot performance 
records, 
   and install FPDT to ACPI table.
 
-  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
   http://opensource.org/licenses/bsd-license.php
 
@@ -554,50 +554,10 @@ FpdtReadyToBootEventNotify (
     InstallFirmwarePerformanceDataTable ();
   }
 }
 
 /**
-  Notify function for event group EFI_EVENT_LEGACY_BOOT_GUID. This is used to
-  record performance data for OsLoaderLoadImageStart in FPDT for legacy boot.
-
-  @param[in]  Event   The Event that is being processed.
-  @param[in]  Context The Event Context.
-
-**/
-VOID
-EFIAPI
-FpdtLegacyBootEventNotify (
-  IN EFI_EVENT        Event,
-  IN VOID             *Context
-  )
-{
-  if (mAcpiBootPerformanceTable == NULL) {
-    //
-    // Firmware Performance Data Table not installed, do nothing.
-    //
-    return ;
-  }
-
-  //
-  // Update Firmware Basic Boot Performance Record for legacy boot.
-  //
-  mAcpiBootPerformanceTable->BasicBoot.OsLoaderLoadImageStart  = 0;
-  mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart = 
GetTimeInNanoSecond (GetPerformanceCounter ());
-  mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesEntry   = 0;
-  mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesExit    = 0;
-
-  //
-  // Dump FPDT Boot Performance record.
-  //
-  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ResetEnd                = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.ResetEnd));
-  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderLoadImageStart  = 
0\n"));
-  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));
-  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry   = 
0\n"));
-  DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesExit    = 
0\n"));
-}
-
-/**
   Report status code listener of FPDT. This is used to collect performance data
   for OsLoaderLoadImageStart and OsLoaderStartImageStart in FPDT.
 
   @param[in]  CodeType            Indicates the type of status code being 
reported.
   @param[in]  Value               Describes the current status of a hardware 
or software entity.
@@ -680,10 +640,31 @@ FpdtStatusCodeListenerDxe (
 
     //
     // Update ExitBootServicesExit for UEFI boot.
     //
     mAcpiBootPerformanceTable->BasicBoot.ExitBootServicesExit = 
GetTimeInNanoSecond (GetPerformanceCounter ());
+  } else if (Value == (EFI_SOFTWARE_DXE_BS_DRIVER | 
EFI_SW_DXE_BS_PC_LEGACY_BOOT_EVENT)) {
+    if (mAcpiBootPerformanceTable == NULL) {
+      //
+      // Firmware Performance Data Table not installed, do nothing.
+      //
+      return Status;
+    }
+
+    //
+    // Update Firmware Basic Boot Performance Record for legacy boot.
+    //
+    mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart = 
GetTimeInNanoSecond (GetPerformanceCounter ());
+
+    //
+    // Dump FPDT Boot Performance record.
+    //
+    DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ResetEnd                = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.ResetEnd));
+    DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderLoadImageStart  = 
0\n"));
+    DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - OsLoaderStartImageStart = 
%ld\n", mAcpiBootPerformanceTable->BasicBoot.OsLoaderStartImageStart));
+    DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesEntry   = 
0\n"));
+    DEBUG ((EFI_D_INFO, "FPDT: Boot Performance - ExitBootServicesExit    = 
0\n"));
   } else if (Data != NULL && CompareGuid (&Data->Type, 
&gEfiFirmwarePerformanceGuid)) {
     //
     // Append one or more Boot records
     //
     if (mAcpiBootPerformanceTable == NULL) {
@@ -847,23 +828,10 @@ FirmwarePerformanceDxeEntryPoint (
                   &mReadyToBootEvent
                   );
   ASSERT_EFI_ERROR (Status);
 
   //
-  // Create legacy boot event to log OsLoaderStartImageStart for legacy boot.
-  //
-  Status = gBS->CreateEventEx (
-                  EVT_NOTIFY_SIGNAL,
-                  TPL_NOTIFY,
-                  FpdtLegacyBootEventNotify,
-                  NULL,
-                  &gEfiEventLegacyBootGuid,
-                  &mLegacyBootEvent
-                  );
-  ASSERT_EFI_ERROR (Status);
-
-  //
   // Retrieve GUID HOB data that contains the ResetEnd.
   //
   GuidHob = GetFirstGuidHob (&gEfiFirmwarePerformanceGuid);
   if (GuidHob != NULL) {
     Performance = (FIRMWARE_SEC_PERFORMANCE *) GET_GUID_HOB_DATA (GuidHob);
-- 
1.9.5.msysgit.0



------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to