[atom_cpu_profiler_gem_promotion] additional APIs for external control of the CPU profiler and visualization
Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
@@ -61,13 +61,10 @@ namespace Profiler
|
||||
{
|
||||
}
|
||||
|
||||
void ProfilerImGuiSystemComponent::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void ProfilerImGuiSystemComponent::Activate()
|
||||
{
|
||||
#if defined(IMGUI_ENABLED)
|
||||
ProfilerImGuiRequestBus::Handler::BusConnect();
|
||||
ImGui::ImGuiUpdateListenerBus::Handler::BusConnect();
|
||||
#endif // defined(IMGUI_ENABLED)
|
||||
}
|
||||
@@ -75,16 +72,22 @@ namespace Profiler
|
||||
void ProfilerImGuiSystemComponent::Deactivate()
|
||||
{
|
||||
#if defined(IMGUI_ENABLED)
|
||||
ProfilerImGuiRequestBus::Handler::BusDisconnect();
|
||||
ImGui::ImGuiUpdateListenerBus::Handler::BusDisconnect();
|
||||
#endif // defined(IMGUI_ENABLED)
|
||||
}
|
||||
|
||||
#if defined(IMGUI_ENABLED)
|
||||
void ProfilerImGuiSystemComponent::ShowCpuProfilerWindow(bool& keepDrawing)
|
||||
{
|
||||
m_imguiCpuProfiler.Draw(keepDrawing);
|
||||
}
|
||||
|
||||
void ProfilerImGuiSystemComponent::OnImGuiUpdate()
|
||||
{
|
||||
if (m_showCpuProfiler)
|
||||
{
|
||||
m_imguiCpuProfiler.Draw(m_showCpuProfiler);
|
||||
ShowCpuProfilerWindow(m_showCpuProfiler);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Profiler/ProfilerBus.h>
|
||||
#include <Profiler/ProfilerImGuiBus.h>
|
||||
|
||||
#include <ImGuiCpuProfiler.h>
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Profiler
|
||||
class ProfilerImGuiSystemComponent
|
||||
: public AZ::Component
|
||||
#if defined(IMGUI_ENABLED)
|
||||
, public ProfilerImGuiRequestBus::Handler
|
||||
, public ImGui::ImGuiUpdateListenerBus::Handler
|
||||
#endif // defined(IMGUI_ENABLED)
|
||||
{
|
||||
@@ -42,11 +43,13 @@ namespace Profiler
|
||||
|
||||
protected:
|
||||
// AZ::Component interface implementation
|
||||
void Init() override;
|
||||
void Activate() override;
|
||||
void Deactivate() override;
|
||||
|
||||
#if defined(IMGUI_ENABLED)
|
||||
// ProfilerImGuiRequestBus interface implementation
|
||||
void ShowCpuProfilerWindow(bool& keepDrawing) override;
|
||||
|
||||
// ImGuiUpdateListenerBus overrides
|
||||
void OnImGuiUpdate() override;
|
||||
void OnImGuiMainMenuUpdate() override;
|
||||
|
||||
@@ -200,6 +200,11 @@ namespace Profiler
|
||||
}
|
||||
}
|
||||
|
||||
void ProfilerSystemComponent::SetProfilerEnabled(bool enabled)
|
||||
{
|
||||
m_cpuProfiler.SetProfilerEnabled(enabled);
|
||||
}
|
||||
|
||||
bool ProfilerSystemComponent::CaptureCpuProfilingStatistics(const AZStd::string& outputFilePath)
|
||||
{
|
||||
bool expected = false;
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Profiler
|
||||
void Deactivate() override;
|
||||
|
||||
// ProfilerRequestBus interface implementation
|
||||
void SetProfilerEnabled(bool enabled) override;
|
||||
bool CaptureCpuProfilingStatistics(const AZStd::string& outputFilePath) override;
|
||||
bool BeginContinuousCpuProfilingCapture() override;
|
||||
bool EndContinuousCpuProfilingCapture(const AZStd::string& outputFilePath) override;
|
||||
|
||||
Reference in New Issue
Block a user