summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/DxePerformanceLib
diff options
context:
space:
mode:
authorBi, Dandan <dandan.bi@intel.com>2018-06-22 16:56:16 +0800
committerLiming Gao <liming.gao@intel.com>2018-06-26 15:36:39 +0800
commit137fb13deb0bb75241b10dc1d676d45230aa73b7 (patch)
tree6531a7bd9b3d940b65a5023e6f2e497c97add272 /MdeModulePkg/Library/DxePerformanceLib
parent56f7741e277349dd9227e08d5aa78e3d049514dd (diff)
downloadedk2-137fb13deb0bb75241b10dc1d676d45230aa73b7.tar.gz
edk2-137fb13deb0bb75241b10dc1d676d45230aa73b7.tar.bz2
edk2-137fb13deb0bb75241b10dc1d676d45230aa73b7.zip
MdeModulePkg: Update Performance instances to use new protocol
Update Performance instances in MdeModulePkg to use new PerformanceMeasurement protocol. 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>
Diffstat (limited to 'MdeModulePkg/Library/DxePerformanceLib')
-rw-r--r--MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c125
-rw-r--r--MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf5
2 files changed, 40 insertions, 90 deletions
diff --git a/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c b/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c
index cb62d522f3..9ed50d22b8 100644
--- a/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c
+++ b/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c
@@ -20,7 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <PiDxe.h>
-#include <Guid/Performance.h>
+#include <Guid/PerformanceMeasurement.h>
#include <Library/PerformanceLib.h>
#include <Library/DebugLib.h>
@@ -30,8 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
// The cached Performance Protocol and PerformanceEx Protocol interface.
//
-PERFORMANCE_PROTOCOL *mPerformance = NULL;
-PERFORMANCE_EX_PROTOCOL *mPerformanceEx = NULL;
+EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL *mPerformanceMeasurement = NULL;
/**
The function caches the pointers to PerformanceEx protocol and Performance Protocol.
@@ -43,35 +42,24 @@ PERFORMANCE_EX_PROTOCOL *mPerformanceEx = NULL;
**/
EFI_STATUS
-GetPerformanceProtocol (
+GetPerformanceMeasurementProtocol (
VOID
)
{
EFI_STATUS Status;
- PERFORMANCE_PROTOCOL *Performance;
- PERFORMANCE_EX_PROTOCOL *PerformanceEx;
+ EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL *PerformanceMeasurement;
- if (mPerformanceEx != NULL || mPerformance != NULL) {
+ if (mPerformanceMeasurement != NULL) {
return EFI_SUCCESS;
}
- Status = gBS->LocateProtocol (&gPerformanceExProtocolGuid, NULL, (VOID **) &PerformanceEx);
+ Status = gBS->LocateProtocol (&gEdkiiPerformanceMeasurementProtocolGuid, NULL, (VOID **) &PerformanceMeasurement);
if (!EFI_ERROR (Status)) {
- ASSERT (PerformanceEx != NULL);
+ ASSERT (PerformanceMeasurement != NULL);
//
- // Cache PerformanceEx Protocol.
+ // Cache PerformanceMeasurement Protocol.
//
- mPerformanceEx = PerformanceEx;
- return EFI_SUCCESS;
- }
-
- Status = gBS->LocateProtocol (&gPerformanceProtocolGuid, NULL, (VOID **) &Performance);
- if (!EFI_ERROR (Status)) {
- ASSERT (Performance != NULL);
- //
- // Cache performance protocol.
- //
- mPerformance = Performance;
+ mPerformanceMeasurement = PerformanceMeasurement;
return EFI_SUCCESS;
}
@@ -110,17 +98,24 @@ StartPerformanceMeasurementEx (
IN UINT32 Identifier
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+ CONST CHAR8* String;
- Status = GetPerformanceProtocol ();
+ Status = GetPerformanceMeasurementProtocol ();
if (EFI_ERROR (Status)) {
- return RETURN_OUT_OF_RESOURCES;
+ return RETURN_NOT_FOUND;
+ }
+
+ if (Token != NULL) {
+ String = Token;
+ } else if (Module != NULL) {
+ String = Module;
+ } else {
+ String = NULL;
}
- if (mPerformanceEx != NULL) {
- Status = mPerformanceEx->StartGaugeEx (Handle, Token, Module, TimeStamp, Identifier);
- } else if (mPerformance != NULL) {
- Status = mPerformance->StartGauge (Handle, Token, Module, TimeStamp);
+ if (mPerformanceMeasurement != NULL) {
+ Status = mPerformanceMeasurement->CreatePerformanceMeasurement (Handle, NULL, String, TimeStamp, 0, Identifier, PerfStartEntry);
} else {
ASSERT (FALSE);
}
@@ -162,17 +157,24 @@ EndPerformanceMeasurementEx (
IN UINT32 Identifier
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
+ CONST CHAR8* String;
- Status = GetPerformanceProtocol ();
+ Status = GetPerformanceMeasurementProtocol ();
if (EFI_ERROR (Status)) {
return RETURN_NOT_FOUND;
}
- if (mPerformanceEx != NULL) {
- Status = mPerformanceEx->EndGaugeEx (Handle, Token, Module, TimeStamp, Identifier);
- } else if (mPerformance != NULL) {
- Status = mPerformance->EndGauge (Handle, Token, Module, TimeStamp);
+ if (Token != NULL) {
+ String = Token;
+ } else if (Module != NULL) {
+ String = Module;
+ } else {
+ String = NULL;
+ }
+
+ if (mPerformanceMeasurement != NULL) {
+ Status = mPerformanceMeasurement->CreatePerformanceMeasurement (Handle, NULL, String, TimeStamp, 0, Identifier, PerfEndEntry);
} else {
ASSERT (FALSE);
}
@@ -233,58 +235,8 @@ GetPerformanceMeasurementEx (
OUT UINT32 *Identifier
)
{
- EFI_STATUS Status;
- GAUGE_DATA_ENTRY_EX *GaugeData;
-
- GaugeData = NULL;
-
- ASSERT (Handle != NULL);
- ASSERT (Token != NULL);
- ASSERT (Module != NULL);
- ASSERT (StartTimeStamp != NULL);
- ASSERT (EndTimeStamp != NULL);
- ASSERT (Identifier != NULL);
-
- Status = GetPerformanceProtocol ();
- if (EFI_ERROR (Status)) {
- return 0;
- }
-
- if (mPerformanceEx != NULL) {
- Status = mPerformanceEx->GetGaugeEx (LogEntryKey++, &GaugeData);
- } else if (mPerformance != NULL) {
- Status = mPerformance->GetGauge (LogEntryKey++, (GAUGE_DATA_ENTRY **) &GaugeData);
- } else {
- ASSERT (FALSE);
- return 0;
- }
-
- //
- // Make sure that LogEntryKey is a valid log entry key,
- //
- ASSERT (Status != EFI_INVALID_PARAMETER);
-
- if (EFI_ERROR (Status)) {
- //
- // The LogEntryKey is the last entry (equals to the total entry number).
- //
- return 0;
- }
-
- ASSERT (GaugeData != NULL);
-
- *Handle = (VOID *) (UINTN) GaugeData->Handle;
- *Token = GaugeData->Token;
- *Module = GaugeData->Module;
- *StartTimeStamp = GaugeData->StartTimeStamp;
- *EndTimeStamp = GaugeData->EndTimeStamp;
- if (mPerformanceEx != NULL) {
- *Identifier = GaugeData->Identifier;
- } else {
- *Identifier = 0;
- }
+ return 0;
- return LogEntryKey;
}
/**
@@ -403,8 +355,7 @@ GetPerformanceMeasurement (
OUT UINT64 *EndTimeStamp
)
{
- UINT32 Identifier;
- return GetPerformanceMeasurementEx (LogEntryKey, Handle, Token, Module, StartTimeStamp, EndTimeStamp, &Identifier);
+ return 0;
}
/**
diff --git a/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf b/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
index edc63c6f0b..c7d06a3a1b 100644
--- a/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
+++ b/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
@@ -6,7 +6,7 @@
# to log performance data. If both PerformanceEx and Performance Protocol are not available,
# it does not log any performance information.
#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2018, 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
@@ -48,8 +48,7 @@
[Guids]
- gPerformanceProtocolGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Locate protocol
- gPerformanceExProtocolGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Locate protocol
+ gEdkiiPerformanceMeasurementProtocolGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Locate protocol
[Pcd]