ProfilerSystemComponent.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 "SuperluminalProfilerEventForwarder.h"
  10. #include <AzCore/Component/Component.h>
  11. #include <AzCore/Debug/ProfilerBus.h>
  12. namespace SuperluminalProfiler
  13. {
  14. class ProfilerSystemComponent
  15. : public AZ::Component
  16. , protected AZ::Debug::ProfilerRequests
  17. {
  18. public:
  19. AZ_COMPONENT(ProfilerSystemComponent, "{C920A0CC-A053-4A0E-8550-DC44FF03A2D1}");
  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::atomic_bool m_cpuCaptureInProgress{ false };
  40. SuperluminalProfilerEventForwarder m_eventForwarder;
  41. };
  42. } // namespace SuperluminalProfiler