Add and assign CpuFreq/TimerStartValue/TimerEndValue into
PEI_PERFORMANCE_LOG_HEADER

Cc: Liming Gao <liming....@intel.com>
Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Cinnamon Shia <cinnamon.s...@hpe.com>
Cc: Jaben Carsey <jaben.car...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.z...@intel.com>
---
 MdeModulePkg/Include/Guid/Performance.h                    | 9 +++++++--
 MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c | 9 +++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Include/Guid/Performance.h 
b/MdeModulePkg/Include/Guid/Performance.h
index c40046c87811..ac2ef4b6ef0a 100644
--- a/MdeModulePkg/Include/Guid/Performance.h
+++ b/MdeModulePkg/Include/Guid/Performance.h
@@ -4,7 +4,7 @@
   * performance protocol interfaces.
   * performance variables.  
 
-Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2016, 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 that accompanies this 
distribution.  
 The full text of the license may be found at
@@ -32,12 +32,17 @@ typedef struct {
   UINT64                EndTimeStamp;                         ///< End time 
point.
 } PEI_PERFORMANCE_LOG_ENTRY;
 
+#define PEI_PERFORMANCE_LOG_REVISION 0x1
+
 //
 // The header must be aligned at 8 bytes.
 // 
 typedef struct {
   UINT32                NumberOfEntries;  ///< The number of all performance 
log entries.
-  UINT32                Reserved;
+  UINT32                Revision;
+  UINT64                CpuFreq;
+  UINT64                TimerStartValue;
+  UINT64                TimerEndValue;
 } PEI_PERFORMANCE_LOG_HEADER;
 
 
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c 
b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 62527b2c34d1..9cd2eee98988 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -53,6 +53,9 @@ InternalGetPerformanceHobLog (
   EFI_HOB_GUID_TYPE           *GuidHob;
   UINTN                       PeiPerformanceSize;
   UINT16                      PeiPerformanceLogEntries;
+  UINT64                      Freq;
+  UINT64                      StartValue;
+  UINT64                      EndValue;
 
   ASSERT (PeiPerformanceLog != NULL);
   ASSERT (PeiPerformanceIdArray != NULL);
@@ -80,6 +83,12 @@ InternalGetPerformanceHobLog (
     *PeiPerformanceLog     = BuildGuidHob (&gPerformanceProtocolGuid, 
PeiPerformanceSize);
     *PeiPerformanceLog     = ZeroMem (*PeiPerformanceLog, PeiPerformanceSize);
 
+    (*PeiPerformanceLog)->Revision = PEI_PERFORMANCE_LOG_REVISION;
+    Freq = GetPerformanceCounterProperties (&StartValue, &EndValue);
+    (*PeiPerformanceLog)->CpuFreq = Freq;
+    (*PeiPerformanceLog)->TimerStartValue = StartValue;
+    (*PeiPerformanceLog)->TimerEndValue = EndValue;
+
     PeiPerformanceSize     = sizeof (UINT32) * PeiPerformanceLogEntries;
     *PeiPerformanceIdArray = BuildGuidHob (&gPerformanceExProtocolGuid, 
PeiPerformanceSize);
     *PeiPerformanceIdArray = ZeroMem (*PeiPerformanceIdArray, 
PeiPerformanceSize);
-- 
2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to