瀏覽代碼

[development] Updates post profiler EBus consolidation (#241)

Related to o3de/o3de#4969

Signed-off-by: AMZN-ScottR [email protected]
Scott Romero 3 年之前
父節點
當前提交
a7cf1bc837

+ 7 - 4
Gem/Code/Source/Automation/ScriptManager.cpp

@@ -1295,10 +1295,10 @@ namespace AtomSampleViewer
         ResumeScript();
     }
 
-    void ScriptManager::OnCaptureCpuProfilingStatisticsFinished([[maybe_unused]] bool result, [[maybe_unused]] const AZStd::string& info)
+    void ScriptManager::OnCaptureFinished([[maybe_unused]] bool result, [[maybe_unused]] const AZStd::string& info)
     {
         m_isCapturePending = false;
-        Profiler::ProfilerNotificationBus::Handler::BusDisconnect();
+        AZ::Debug::ProfilerNotificationBus::Handler::BusDisconnect();
         ResumeScript();
     }
 
@@ -1384,10 +1384,13 @@ namespace AtomSampleViewer
         auto operation = [outputFilePath]()
         {
             s_instance->m_isCapturePending = true;
-            s_instance->Profiler::ProfilerNotificationBus::Handler::BusConnect();
+            s_instance->AZ::Debug::ProfilerNotificationBus::Handler::BusConnect();
             s_instance->PauseScript();
 
-            Profiler::ProfilerRequestBus::Broadcast(&Profiler::ProfilerRequestBus::Events::CaptureCpuProfilingStatistics, outputFilePath);
+            if (auto profilerSystem = AZ::Debug::ProfilerSystemInterface::Get(); profilerSystem)
+            {
+                profilerSystem->CaptureFrame(outputFilePath);
+            }
         };
 
         s_instance->m_scriptOperations.push(AZStd::move(operation));

+ 3 - 3
Gem/Code/Source/Automation/ScriptManager.h

@@ -17,7 +17,7 @@
 #include <Automation/ScriptReporter.h>
 #include <Automation/ImageComparisonConfig.h>
 #include <Utils/ImGuiAssetBrowser.h>
-#include <Profiler/ProfilerBus.h>
+#include <AzCore/Debug/ProfilerBus.h>
 
 namespace AZ
 {
@@ -50,7 +50,7 @@ namespace AtomSampleViewer
         , public AZ::Debug::CameraControllerNotificationBus::Handler
         , public AZ::Render::FrameCaptureNotificationBus::Handler
         , public AZ::Render::ProfilingCaptureNotificationBus::Handler
-        , public Profiler::ProfilerNotificationBus::Handler
+        , public AZ::Debug::ProfilerNotificationBus::Handler
     {
     public:
         ScriptManager();
@@ -210,7 +210,7 @@ namespace AtomSampleViewer
         void OnCaptureBenchmarkMetadataFinished(bool result, const AZStd::string& info) override;
 
         // ProfilerNotificationBus overrides...
-        void OnCaptureCpuProfilingStatisticsFinished(bool result, const AZStd::string& info) override;
+        void OnCaptureFinished(bool result, const AZStd::string& info) override;
 
         void AbortScripts(const AZStd::string& reason);
 

+ 3 - 3
Gem/Code/Source/SampleComponentManager.cpp

@@ -104,6 +104,7 @@
 
 #include <AzCore/Component/Entity.h>
 #include <AzCore/Debug/Profiler.h>
+#include <AzCore/Debug/ProfilerBus.h>
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/std/smart_ptr/make_shared.h>
 #include <AzCore/std/algorithm.h>
@@ -120,7 +121,6 @@
 
 #include <Utils/Utils.h>
 
-#include <Profiler/ProfilerBus.h>
 #include <Profiler/ProfilerImGuiBus.h>
 
 #include "ExampleComponentBus.h"
@@ -934,9 +934,9 @@ namespace AtomSampleViewer
                 if (ImGui::MenuItem(CpuProfilerToolName))
                 {
                     m_showCpuProfiler = !m_showCpuProfiler;
-                    if (auto profiler = Profiler::ProfilerInterface::Get(); profiler)
+                    if (auto profilerSystem = AZ::Debug::ProfilerSystemInterface::Get(); profilerSystem)
                     {
-                        profiler->SetProfilerEnabled(m_showCpuProfiler);
+                        profilerSystem->SetActive(m_showCpuProfiler);
                     }
 
                     Utils::ReportScriptableAction("ShowTool('%s', %s)", CpuProfilerToolName, m_showCpuProfiler ? "true" : "false");