ProfilerSystemComponent.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "ProfilerSystemComponent.h"
  9. #include <AzCore/RTTI/BehaviorContext.h>
  10. #include <AzCore/Serialization/EditContext.h>
  11. #include <AzCore/Serialization/EditContextConstants.inl>
  12. #include <AzCore/Serialization/SerializeContext.h>
  13. namespace SuperluminalProfiler
  14. {
  15. static constexpr AZ::Crc32 profilerServiceCrc = AZ_CRC_CE("ProfilerService");
  16. void ProfilerSystemComponent::Reflect(AZ::ReflectContext* context)
  17. {
  18. if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
  19. {
  20. serialize->Class<ProfilerSystemComponent, AZ::Component>()->Version(0);
  21. }
  22. }
  23. void ProfilerSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
  24. {
  25. provided.push_back(profilerServiceCrc);
  26. }
  27. void ProfilerSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
  28. {
  29. incompatible.push_back(profilerServiceCrc);
  30. }
  31. void ProfilerSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
  32. {
  33. }
  34. void ProfilerSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
  35. {
  36. }
  37. ProfilerSystemComponent::ProfilerSystemComponent()
  38. {
  39. if (AZ::Debug::ProfilerSystemInterface::Get() == nullptr)
  40. {
  41. AZ::Debug::ProfilerSystemInterface::Register(this);
  42. }
  43. }
  44. ProfilerSystemComponent::~ProfilerSystemComponent()
  45. {
  46. if (AZ::Debug::ProfilerSystemInterface::Get() == this)
  47. {
  48. AZ::Debug::ProfilerSystemInterface::Unregister(this);
  49. }
  50. }
  51. void ProfilerSystemComponent::Activate()
  52. {
  53. m_eventForwarder.Init();
  54. }
  55. void ProfilerSystemComponent::Deactivate()
  56. {
  57. m_eventForwarder.Shutdown();
  58. }
  59. bool ProfilerSystemComponent::IsActive() const
  60. {
  61. return false;
  62. }
  63. void ProfilerSystemComponent::SetActive([[maybe_unused]] bool enabled)
  64. {
  65. }
  66. bool ProfilerSystemComponent::CaptureFrame([[maybe_unused]] const AZStd::string& outputFilePath)
  67. {
  68. return true;
  69. }
  70. bool ProfilerSystemComponent::StartCapture([[maybe_unused]] AZStd::string outputFilePath)
  71. {
  72. return true;
  73. }
  74. bool ProfilerSystemComponent::EndCapture()
  75. {
  76. return true;
  77. }
  78. bool ProfilerSystemComponent::IsCaptureInProgress() const
  79. {
  80. return false;
  81. }
  82. } // namespace SuperluminalProfiler