ProfilerSystemComponent.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #pragma once
  9. #include "OptickProfilerEventForwarder.h"
  10. #include <AzCore/Component/Component.h>
  11. #include <AzCore/Debug/ProfilerBus.h>
  12. namespace OptickProfiler
  13. {
  14. class ProfilerSystemComponent
  15. : public AZ::Component
  16. , protected AZ::Debug::ProfilerRequests
  17. {
  18. public:
  19. AZ_COMPONENT(ProfilerSystemComponent, "{E140D972-C1C0-44A7-A563-9F973944A8A1}");
  20. static void Reflect(AZ::ReflectContext* context);
  21. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
  22. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  23. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  24. static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
  25. ProfilerSystemComponent();
  26. ~ProfilerSystemComponent();
  27. protected:
  28. // AZ::Component interface implementation
  29. void Activate() override;
  30. void Deactivate() override;
  31. // ProfilerRequests interface implementation
  32. bool IsActive() const override;
  33. void SetActive(bool active) override;
  34. bool CaptureFrame(const AZStd::string& outputFilePath) override;
  35. bool StartCapture(AZStd::string outputFilePath) override;
  36. bool EndCapture() override;
  37. bool IsCaptureInProgress() const override;
  38. private:
  39. AZStd::string m_captureFile;
  40. AZStd::atomic_bool m_cpuCaptureInProgress{ false };
  41. OptickProfilerEventForwarder m_eventForwarder;
  42. };
  43. } // namespace OptickProfiler