Changeset 80721 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxePerformanceLib
- Timestamp:
- Sep 11, 2019 8:46:37 AM (5 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-129237 /vendor/edk2/current 103735-103757,103769-103776,129194-133213
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.c
r77662 r80721 7 7 performance information. 8 8 9 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 10 This program and the accompanying materials 11 are licensed and made available under the terms and conditions of the BSD License 12 which accompanies this distribution. The full text of the license may be found at 13 http://opensource.org/licenses/bsd-license.php 14 15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 9 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 10 SPDX-License-Identifier: BSD-2-Clause-Patent 17 11 18 12 **/ … … 21 15 #include <PiDxe.h> 22 16 23 #include <Guid/Performance .h>17 #include <Guid/PerformanceMeasurement.h> 24 18 25 19 #include <Library/PerformanceLib.h> … … 31 25 // The cached Performance Protocol and PerformanceEx Protocol interface. 32 26 // 33 PERFORMANCE_PROTOCOL *mPerformance = NULL; 34 PERFORMANCE_EX_PROTOCOL *mPerformanceEx = NULL; 27 EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL *mPerformanceMeasurement = NULL; 35 28 36 29 /** … … 44 37 **/ 45 38 EFI_STATUS 46 GetPerformance Protocol (39 GetPerformanceMeasurementProtocol ( 47 40 VOID 48 41 ) 49 42 { 50 43 EFI_STATUS Status; 51 PERFORMANCE_PROTOCOL *Performance; 52 PERFORMANCE_EX_PROTOCOL *PerformanceEx; 53 54 if (mPerformanceEx != NULL || mPerformance != NULL) { 44 EDKII_PERFORMANCE_MEASUREMENT_PROTOCOL *PerformanceMeasurement; 45 46 if (mPerformanceMeasurement != NULL) { 55 47 return EFI_SUCCESS; 56 48 } 57 49 58 Status = gBS->LocateProtocol (&g PerformanceExProtocolGuid, NULL, (VOID **) &PerformanceEx);50 Status = gBS->LocateProtocol (&gEdkiiPerformanceMeasurementProtocolGuid, NULL, (VOID **) &PerformanceMeasurement); 59 51 if (!EFI_ERROR (Status)) { 60 ASSERT (Performance Ex!= NULL);52 ASSERT (PerformanceMeasurement != NULL); 61 53 // 62 // Cache Performance ExProtocol.54 // Cache PerformanceMeasurement Protocol. 63 55 // 64 mPerformanceEx = PerformanceEx; 65 return EFI_SUCCESS; 66 } 67 68 Status = gBS->LocateProtocol (&gPerformanceProtocolGuid, NULL, (VOID **) &Performance); 69 if (!EFI_ERROR (Status)) { 70 ASSERT (Performance != NULL); 71 // 72 // Cache performance protocol. 73 // 74 mPerformance = Performance; 56 mPerformanceMeasurement = PerformanceMeasurement; 75 57 return EFI_SUCCESS; 76 58 } … … 111 93 ) 112 94 { 113 EFI_STATUS Status; 114 115 Status = GetPerformanceProtocol (); 95 EFI_STATUS Status; 96 CONST CHAR8* String; 97 98 Status = GetPerformanceMeasurementProtocol (); 116 99 if (EFI_ERROR (Status)) { 117 return RETURN_OUT_OF_RESOURCES; 118 } 119 120 if (mPerformanceEx != NULL) { 121 Status = mPerformanceEx->StartGaugeEx (Handle, Token, Module, TimeStamp, Identifier); 122 } else if (mPerformance != NULL) { 123 Status = mPerformance->StartGauge (Handle, Token, Module, TimeStamp); 100 return RETURN_NOT_FOUND; 101 } 102 103 if (Token != NULL) { 104 String = Token; 105 } else if (Module != NULL) { 106 String = Module; 107 } else { 108 String = NULL; 109 } 110 111 if (mPerformanceMeasurement != NULL) { 112 Status = mPerformanceMeasurement->CreatePerformanceMeasurement (Handle, NULL, String, TimeStamp, 0, Identifier, PerfStartEntry); 124 113 } else { 125 114 ASSERT (FALSE); … … 163 152 ) 164 153 { 165 EFI_STATUS Status; 166 167 Status = GetPerformanceProtocol (); 154 EFI_STATUS Status; 155 CONST CHAR8* String; 156 157 Status = GetPerformanceMeasurementProtocol (); 168 158 if (EFI_ERROR (Status)) { 169 159 return RETURN_NOT_FOUND; 170 160 } 171 161 172 if (mPerformanceEx != NULL) { 173 Status = mPerformanceEx->EndGaugeEx (Handle, Token, Module, TimeStamp, Identifier); 174 } else if (mPerformance != NULL) { 175 Status = mPerformance->EndGauge (Handle, Token, Module, TimeStamp); 162 if (Token != NULL) { 163 String = Token; 164 } else if (Module != NULL) { 165 String = Module; 166 } else { 167 String = NULL; 168 } 169 170 if (mPerformanceMeasurement != NULL) { 171 Status = mPerformanceMeasurement->CreatePerformanceMeasurement (Handle, NULL, String, TimeStamp, 0, Identifier, PerfEndEntry); 176 172 } else { 177 173 ASSERT (FALSE); … … 234 230 ) 235 231 { 236 EFI_STATUS Status; 237 GAUGE_DATA_ENTRY_EX *GaugeData; 238 239 GaugeData = NULL; 240 241 ASSERT (Handle != NULL); 242 ASSERT (Token != NULL); 243 ASSERT (Module != NULL); 244 ASSERT (StartTimeStamp != NULL); 245 ASSERT (EndTimeStamp != NULL); 246 ASSERT (Identifier != NULL); 247 248 Status = GetPerformanceProtocol (); 249 if (EFI_ERROR (Status)) { 250 return 0; 251 } 252 253 if (mPerformanceEx != NULL) { 254 Status = mPerformanceEx->GetGaugeEx (LogEntryKey++, &GaugeData); 255 } else if (mPerformance != NULL) { 256 Status = mPerformance->GetGauge (LogEntryKey++, (GAUGE_DATA_ENTRY **) &GaugeData); 257 } else { 258 ASSERT (FALSE); 259 return 0; 260 } 261 262 // 263 // Make sure that LogEntryKey is a valid log entry key, 264 // 265 ASSERT (Status != EFI_INVALID_PARAMETER); 266 267 if (EFI_ERROR (Status)) { 268 // 269 // The LogEntryKey is the last entry (equals to the total entry number). 270 // 271 return 0; 272 } 273 274 ASSERT (GaugeData != NULL); 275 276 *Handle = (VOID *) (UINTN) GaugeData->Handle; 277 *Token = GaugeData->Token; 278 *Module = GaugeData->Module; 279 *StartTimeStamp = GaugeData->StartTimeStamp; 280 *EndTimeStamp = GaugeData->EndTimeStamp; 281 if (mPerformanceEx != NULL) { 282 *Identifier = GaugeData->Identifier; 283 } else { 284 *Identifier = 0; 285 } 286 287 return LogEntryKey; 232 return 0; 233 288 234 } 289 235 … … 404 350 ) 405 351 { 406 UINT32 Identifier; 407 return GetPerformanceMeasurementEx (LogEntryKey, Handle, Token, Module, StartTimeStamp, EndTimeStamp, &Identifier); 352 return 0; 408 353 } 409 354 … … 428 373 return (BOOLEAN) ((PcdGet8(PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0); 429 374 } 375 376 /** 377 Create performance record with event description and a timestamp. 378 379 @param CallerIdentifier - Image handle or pointer to caller ID GUID 380 @param Guid - Pointer to a GUID 381 @param String - Pointer to a string describing the measurement 382 @param Address - Pointer to a location in memory relevant to the measurement 383 @param Identifier - Performance identifier describing the type of measurement 384 385 @retval RETURN_SUCCESS - Successfully created performance record 386 @retval RETURN_OUT_OF_RESOURCES - Ran out of space to store the records 387 @retval RETURN_INVALID_PARAMETER - Invalid parameter passed to function - NULL 388 pointer or invalid PerfId 389 390 **/ 391 RETURN_STATUS 392 EFIAPI 393 LogPerformanceMeasurement ( 394 IN CONST VOID *CallerIdentifier, 395 IN CONST VOID *Guid, OPTIONAL 396 IN CONST CHAR8 *String, OPTIONAL 397 IN UINT64 Address, OPTIONAL 398 IN UINT32 Identifier 399 ) 400 { 401 EFI_STATUS Status; 402 403 Status = GetPerformanceMeasurementProtocol (); 404 if (EFI_ERROR (Status)) { 405 return RETURN_OUT_OF_RESOURCES; 406 } 407 408 if (mPerformanceMeasurement != NULL) { 409 Status = mPerformanceMeasurement->CreatePerformanceMeasurement (CallerIdentifier, Guid, String, 0, Address, Identifier, PerfEntry); 410 } else { 411 ASSERT (FALSE); 412 } 413 414 return (RETURN_STATUS) Status; 415 } 416 417 /** 418 Check whether the specified performance measurement can be logged. 419 420 This function returns TRUE when the PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED bit of PcdPerformanceLibraryPropertyMask is set 421 and the Type disable bit in PcdPerformanceLibraryPropertyMask is not set. 422 423 @param Type - Type of the performance measurement entry. 424 425 @retval TRUE The performance measurement can be logged. 426 @retval FALSE The performance measurement can NOT be logged. 427 428 **/ 429 BOOLEAN 430 EFIAPI 431 LogPerformanceMeasurementEnabled ( 432 IN CONST UINTN Type 433 ) 434 { 435 // 436 // When Performance measurement is enabled and the type is not filtered, the performance can be logged. 437 // 438 if (PerformanceMeasurementEnabled () && (PcdGet8(PcdPerformanceLibraryPropertyMask) & Type) == 0) { 439 return TRUE; 440 } 441 return FALSE; 442 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
r58466 r80721 7 7 # it does not log any performance information. 8 8 # 9 # Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> 10 # This program and the accompanying materials 11 # are licensed and made available under the terms and conditions of the BSD License 12 # which accompanies this distribution. The full text of the license may be found at 13 # http://opensource.org/licenses/bsd-license.php 14 # 15 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 9 # Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 10 # SPDX-License-Identifier: BSD-2-Clause-Patent 17 11 # 18 12 ## … … 25 19 MODULE_TYPE = DXE_DRIVER 26 20 VERSION_STRING = 1.0 27 LIBRARY_CLASS = PerformanceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_S AL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER21 LIBRARY_CLASS = PerformanceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER 28 22 29 23 # 30 24 # The following information is for reference only and not required by the build tools. 31 25 # 32 # VALID_ARCHITECTURES = IA32 X64 IPFEBC26 # VALID_ARCHITECTURES = IA32 X64 EBC 33 27 # 34 28 … … 49 43 50 44 [Guids] 51 gPerformanceProtocolGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Locate protocol 52 gPerformanceExProtocolGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Locate protocol 45 gEdkiiPerformanceMeasurementProtocolGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Locate protocol 53 46 54 47 -
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.uni
r77662 r80721 7 7 // it does not log any performance information. 8 8 // 9 // Copyright (c) 2006 - 201 4, Intel Corporation. All rights reserved.<BR>9 // Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> 10 10 // 11 // This program and the accompanying materials 12 // are licensed and made available under the terms and conditions of the BSD License 13 // which accompanies this distribution. The full text of the license may be found at 14 // http://opensource.org/licenses/bsd-license.php 15 // 16 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 // SPDX-License-Identifier: BSD-2-Clause-Patent 18 12 // 19 13 // **/
Note:
See TracChangeset
for help on using the changeset viewer.