\r
#include <PiDxe.h>\r
\r
-#include <Guid/Performance.h>\r
+#include <Guid/PerformanceMeasurement.h>\r
\r
#include <Library/PerformanceLib.h>\r
#include <Library/DebugLib.h>\r
//\r
// The cached Performance Protocol and PerformanceEx Protocol interface.\r
//\r
-PERFORMANCE_PROTOCOL *mPerformance = NULL;\r
-PERFORMANCE_EX_PROTOCOL *mPerformanceEx = NULL;\r
+EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL *mPerformanceMeasurement = NULL;\r
\r
/**\r
The function caches the pointers to PerformanceEx protocol and Performance Protocol.\r
\r
**/\r
EFI_STATUS\r
-GetPerformanceProtocol (\r
+GetPerformanceMeasurementProtocol (\r
VOID\r
)\r
{\r
EFI_STATUS Status;\r
- PERFORMANCE_PROTOCOL *Performance;\r
- PERFORMANCE_EX_PROTOCOL *PerformanceEx;\r
+ EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL *PerformanceMeasurement;\r
\r
- if (mPerformanceEx != NULL || mPerformance != NULL) {\r
+ if (mPerformanceMeasurement != NULL) {\r
return EFI_SUCCESS;\r
}\r
\r
- Status = gBS->LocateProtocol (&gPerformanceExProtocolGuid, NULL, (VOID **) &PerformanceEx);\r
+ Status = gBS->LocateProtocol (&gEdkiiPerformanceMeasurementProtocolGuid, NULL, (VOID **) &PerformanceMeasurement);\r
if (!EFI_ERROR (Status)) {\r
- ASSERT (PerformanceEx != NULL);\r
+ ASSERT (PerformanceMeasurement != NULL);\r
//\r
- // Cache PerformanceEx Protocol.\r
+ // Cache PerformanceMeasurement Protocol.\r
//\r
- mPerformanceEx = PerformanceEx;\r
- return EFI_SUCCESS;\r
- }\r
-\r
- Status = gBS->LocateProtocol (&gPerformanceProtocolGuid, NULL, (VOID **) &Performance);\r
- if (!EFI_ERROR (Status)) {\r
- ASSERT (Performance != NULL);\r
- //\r
- // Cache performance protocol.\r
- //\r
- mPerformance = Performance;\r
+ mPerformanceMeasurement = PerformanceMeasurement;\r
return EFI_SUCCESS;\r
}\r
\r
IN UINT32 Identifier\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
+ CONST CHAR8* String;\r
\r
- Status = GetPerformanceProtocol ();\r
+ Status = GetPerformanceMeasurementProtocol ();\r
if (EFI_ERROR (Status)) {\r
- return RETURN_OUT_OF_RESOURCES;\r
+ return RETURN_NOT_FOUND;\r
+ }\r
+\r
+ if (Token != NULL) {\r
+ String = Token;\r
+ } else if (Module != NULL) {\r
+ String = Module;\r
+ } else {\r
+ String = NULL;\r
}\r
\r
- if (mPerformanceEx != NULL) {\r
- Status = mPerformanceEx->StartGaugeEx (Handle, Token, Module, TimeStamp, Identifier);\r
- } else if (mPerformance != NULL) {\r
- Status = mPerformance->StartGauge (Handle, Token, Module, TimeStamp);\r
+ if (mPerformanceMeasurement != NULL) {\r
+ Status = mPerformanceMeasurement->CreatePerformanceMeasurement (Handle, NULL, String, TimeStamp, 0, Identifier, PerfStartEntry);\r
} else {\r
ASSERT (FALSE);\r
}\r
IN UINT32 Identifier\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
+ CONST CHAR8* String;\r
\r
- Status = GetPerformanceProtocol ();\r
+ Status = GetPerformanceMeasurementProtocol ();\r
if (EFI_ERROR (Status)) {\r
return RETURN_NOT_FOUND;\r
}\r
\r
- if (mPerformanceEx != NULL) {\r
- Status = mPerformanceEx->EndGaugeEx (Handle, Token, Module, TimeStamp, Identifier);\r
- } else if (mPerformance != NULL) {\r
- Status = mPerformance->EndGauge (Handle, Token, Module, TimeStamp);\r
+ if (Token != NULL) {\r
+ String = Token;\r
+ } else if (Module != NULL) {\r
+ String = Module;\r
+ } else {\r
+ String = NULL;\r
+ }\r
+\r
+ if (mPerformanceMeasurement != NULL) {\r
+ Status = mPerformanceMeasurement->CreatePerformanceMeasurement (Handle, NULL, String, TimeStamp, 0, Identifier, PerfEndEntry);\r
} else {\r
ASSERT (FALSE);\r
}\r
OUT UINT32 *Identifier\r
)\r
{\r
- EFI_STATUS Status;\r
- GAUGE_DATA_ENTRY_EX *GaugeData;\r
-\r
- GaugeData = NULL;\r
-\r
- ASSERT (Handle != NULL);\r
- ASSERT (Token != NULL);\r
- ASSERT (Module != NULL);\r
- ASSERT (StartTimeStamp != NULL);\r
- ASSERT (EndTimeStamp != NULL);\r
- ASSERT (Identifier != NULL);\r
-\r
- Status = GetPerformanceProtocol ();\r
- if (EFI_ERROR (Status)) {\r
- return 0;\r
- }\r
-\r
- if (mPerformanceEx != NULL) {\r
- Status = mPerformanceEx->GetGaugeEx (LogEntryKey++, &GaugeData);\r
- } else if (mPerformance != NULL) {\r
- Status = mPerformance->GetGauge (LogEntryKey++, (GAUGE_DATA_ENTRY **) &GaugeData);\r
- } else {\r
- ASSERT (FALSE);\r
- return 0;\r
- }\r
-\r
- //\r
- // Make sure that LogEntryKey is a valid log entry key,\r
- //\r
- ASSERT (Status != EFI_INVALID_PARAMETER);\r
-\r
- if (EFI_ERROR (Status)) {\r
- //\r
- // The LogEntryKey is the last entry (equals to the total entry number).\r
- //\r
- return 0;\r
- }\r
-\r
- ASSERT (GaugeData != NULL);\r
-\r
- *Handle = (VOID *) (UINTN) GaugeData->Handle;\r
- *Token = GaugeData->Token;\r
- *Module = GaugeData->Module;\r
- *StartTimeStamp = GaugeData->StartTimeStamp;\r
- *EndTimeStamp = GaugeData->EndTimeStamp;\r
- if (mPerformanceEx != NULL) {\r
- *Identifier = GaugeData->Identifier;\r
- } else {\r
- *Identifier = 0;\r
- }\r
+ return 0;\r
\r
- return LogEntryKey;\r
}\r
\r
/**\r
OUT UINT64 *EndTimeStamp\r
)\r
{\r
- UINT32 Identifier;\r
- return GetPerformanceMeasurementEx (LogEntryKey, Handle, Token, Module, StartTimeStamp, EndTimeStamp, &Identifier);\r
+ return 0;\r
}\r
\r
/**\r