+/**\r
+ Attempts to retrieve a performance measurement log entry from the performance measurement log.\r
+ It can also retrieve the log created by StartPerformanceMeasurement and EndPerformanceMeasurement,\r
+ and then assign the Identifier with 0.\r
+\r
+ Attempts to retrieve the performance log entry specified by LogEntryKey. If LogEntryKey is\r
+ zero on entry, then an attempt is made to retrieve the first entry from the performance log,\r
+ and the key for the second entry in the log is returned. If the performance log is empty,\r
+ then no entry is retrieved and zero is returned. If LogEntryKey is not zero, then the performance\r
+ log entry associated with LogEntryKey is retrieved, and the key for the next entry in the log is\r
+ returned. If LogEntryKey is the key for the last entry in the log, then the last log entry is\r
+ retrieved and an implementation specific non-zero key value that specifies the end of the performance\r
+ log is returned. If LogEntryKey is equal this implementation specific non-zero key value, then no entry\r
+ is retrieved and zero is returned. In the cases where a performance log entry can be returned,\r
+ the log entry is returned in Handle, Token, Module, StartTimeStamp, EndTimeStamp and Identifier.\r
+ If LogEntryKey is not a valid log entry key for the performance measurement log, then ASSERT().\r
+ If Handle is NULL, then ASSERT().\r
+ If Token is NULL, then ASSERT().\r
+ If Module is NULL, then ASSERT().\r
+ If StartTimeStamp is NULL, then ASSERT().\r
+ If EndTimeStamp is NULL, then ASSERT().\r
+ If Identifier is NULL, then ASSERT().\r
+\r
+ @param LogEntryKey On entry, the key of the performance measurement log entry to retrieve.\r
+ 0, then the first performance measurement log entry is retrieved.\r
+ On exit, the key of the next performance log entry.\r
+ @param Handle Pointer to environment specific context used to identify the component\r
+ being measured.\r
+ @param Token Pointer to a Null-terminated ASCII string that identifies the component\r
+ being measured.\r
+ @param Module Pointer to a Null-terminated ASCII string that identifies the module\r
+ being measured.\r
+ @param StartTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement\r
+ was started.\r
+ @param EndTimeStamp Pointer to the 64-bit time stamp that was recorded when the measurement\r
+ was ended.\r
+ @param Identifier Pointer to the 32-bit identifier that was recorded.\r
+\r
+ @return The key for the next performance log entry (in general case).\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+GetByPerformanceProtocol (\r
+ IN UINTN LogEntryKey, \r
+ OUT CONST VOID **Handle,\r
+ OUT CONST CHAR8 **Token,\r
+ OUT CONST CHAR8 **Module,\r
+ OUT UINT64 *StartTimeStamp,\r
+ OUT UINT64 *EndTimeStamp,\r
+ OUT UINT32 *Identifier\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ GAUGE_DATA_ENTRY_EX *GaugeData;\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
+\r
+ return LogEntryKey;\r
+}\r
+\r
+\r