/* The constructor function initializes the Performance Measurement Enable flag and registers SmmBase2 protocol notify callback. It will ASSERT() if one of these operations fails and it will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI SmmCorePerformanceLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function initializes the Performance Measurement Enable flag and registers SmmBase2 protocol notify callback. It will ASSERT() if one of these operations fails and it will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI SmmCorePerformanceLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{
  EFI_STATUS  Status;
  EFI_EVENT   Event;
  VOID        *Registration;
  mPerformanceMeasurementEnabled =  (BOOLEAN)((PcdGet8 (PcdPerformanceLibraryPropertyMask) & PERFORMANCE_LIBRARY_PROPERTY_MEASUREMENT_ENABLED) != 0);
  if (!PerformanceMeasurementEnabled ()) {
    return EFI_SUCCESS;
  }
  Status = gBS->CreateEvent (
                  EVT_NOTIFY_SIGNAL,
                  TPL_CALLBACK,
                  InitializeSmmCorePerformanceLib,
                  NULL,
                  &Event
                  );
  ASSERT_EFI_ERROR (Status);
  Status = gBS->RegisterProtocolNotify (
                  &gEfiSmmBase2ProtocolGuid,
                  Event,
                  &Registration
                  );
  ASSERT_EFI_ERROR (Status);
  return EFI_SUCCESS;
}