Ver código fonte

Added AZ::IO::Streamer's profiler.

Signed-off-by: AMZN-koppersr <[email protected]>
AMZN-koppersr 3 anos atrás
pai
commit
e76fa67d6b

+ 34 - 4
Gem/Code/Source/SampleComponentManager.cpp

@@ -111,6 +111,7 @@
 #include <AzCore/Component/Entity.h>
 #include <AzCore/Component/Entity.h>
 #include <AzCore/Debug/Profiler.h>
 #include <AzCore/Debug/Profiler.h>
 #include <AzCore/Debug/ProfilerBus.h>
 #include <AzCore/Debug/ProfilerBus.h>
+#include <AzCore/IO/IStreamerProfiler.h>
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Serialization/SerializeContext.h>
 #include <AzCore/Settings/SettingsRegistryMergeUtils.h>
 #include <AzCore/Settings/SettingsRegistryMergeUtils.h>
 #include <AzCore/std/smart_ptr/make_shared.h>
 #include <AzCore/std/smart_ptr/make_shared.h>
@@ -142,10 +143,11 @@ namespace AtomSampleViewer
 {
 {
     namespace
     namespace
     {
     {
-        const char* PassTreeToolName = "PassTree";
-        const char* CpuProfilerToolName = "CPU Profiler";
-        const char* GpuProfilerToolName = "GPU Profiler";
-        const char* TransientAttachmentProfilerToolName = "Transient Attachment Profiler";
+        constexpr const char* PassTreeToolName = "PassTree";
+        constexpr const char* CpuProfilerToolName = "CPU Profiler";
+        constexpr const char* GpuProfilerToolName = "GPU Profiler";
+        constexpr const char* FileIoProfilerToolName = "File IO Profiler";
+        constexpr const char* TransientAttachmentProfilerToolName = "Transient Attachment Profiler";
     }
     }
 
 
     bool IsValidNumMSAASamples(int numSamples)
     bool IsValidNumMSAASamples(int numSamples)
@@ -830,6 +832,11 @@ namespace AtomSampleViewer
             ShowGpuProfilerWindow();
             ShowGpuProfilerWindow();
         }
         }
 
 
+        if (m_showFileIoProfiler)
+        {
+            ShowFileIoProfilerWindow();
+        }
+
         if (m_showTransientAttachmentProfiler)
         if (m_showTransientAttachmentProfiler)
         {
         {
             ShowTransientAttachmentProfilerWindow();
             ShowTransientAttachmentProfilerWindow();
@@ -1007,6 +1014,16 @@ namespace AtomSampleViewer
                     Utils::ReportScriptableAction("ShowTool('%s', %s)", CpuProfilerToolName, m_showCpuProfiler ? "true" : "false");
                     Utils::ReportScriptableAction("ShowTool('%s', %s)", CpuProfilerToolName, m_showCpuProfiler ? "true" : "false");
                 }
                 }
 
 
+                if (AZ::IO::StreamerProfiler::Get() != nullptr)
+                {
+                    if (ImGui::MenuItem(FileIoProfilerToolName))
+                    {
+                        m_showFileIoProfiler = !m_showFileIoProfiler;
+                        Utils::ReportScriptableAction(
+                            "ShowTool('%s', %s)", FileIoProfilerToolName, m_showFileIoProfiler ? "true" : "false");
+                    }
+                }
+
                 if (ImGui::MenuItem(GpuProfilerToolName))
                 if (ImGui::MenuItem(GpuProfilerToolName))
                 {
                 {
                     m_showGpuProfiler = !m_showGpuProfiler;
                     m_showGpuProfiler = !m_showGpuProfiler;
@@ -1101,6 +1118,14 @@ namespace AtomSampleViewer
         }
         }
     }
     }
 
 
+    void SampleComponentManager::ShowFileIoProfilerWindow()
+    {
+        if (auto profilerImGui = AZ::IO::StreamerProfiler::Get(); profilerImGui)
+        {
+            profilerImGui->DrawStatistics(m_showFileIoProfiler);
+        }
+    }
+
     void SampleComponentManager::ShowGpuProfilerWindow()
     void SampleComponentManager::ShowGpuProfilerWindow()
     {
     {
         m_imguiGpuProfiler.Draw(m_showGpuProfiler, AZ::RPI::PassSystemInterface::Get()->GetRootPass());
         m_imguiGpuProfiler.Draw(m_showGpuProfiler, AZ::RPI::PassSystemInterface::Get()->GetRootPass());
@@ -1414,6 +1439,11 @@ namespace AtomSampleViewer
             m_showCpuProfiler = enable;
             m_showCpuProfiler = enable;
             return true;
             return true;
         }
         }
+        else if (toolName == FileIoProfilerToolName)
+        {
+            m_showFileIoProfiler = enable;
+            return true;
+        }
         else if (toolName == GpuProfilerToolName)
         else if (toolName == GpuProfilerToolName)
         {
         {
             m_showGpuProfiler = enable;
             m_showGpuProfiler = enable;

+ 2 - 0
Gem/Code/Source/SampleComponentManager.h

@@ -137,6 +137,7 @@ namespace AtomSampleViewer
         void ShowFrameGraphVisualizerWindow();
         void ShowFrameGraphVisualizerWindow();
         void ShowCpuProfilerWindow();
         void ShowCpuProfilerWindow();
         void ShowGpuProfilerWindow();
         void ShowGpuProfilerWindow();
+        void ShowFileIoProfilerWindow();
         void ShowShaderMetricsWindow();
         void ShowShaderMetricsWindow();
         void ShowTransientAttachmentProfilerWindow();
         void ShowTransientAttachmentProfilerWindow();
 
 
@@ -210,6 +211,7 @@ namespace AtomSampleViewer
         bool m_showCullingDebugWindow = false;
         bool m_showCullingDebugWindow = false;
         bool m_showCpuProfiler = false;
         bool m_showCpuProfiler = false;
         bool m_showGpuProfiler = false;
         bool m_showGpuProfiler = false;
+        bool m_showFileIoProfiler = false;
         bool m_showTransientAttachmentProfiler = false;
         bool m_showTransientAttachmentProfiler = false;
         bool m_showShaderMetrics = false;
         bool m_showShaderMetrics = false;
 
 

+ 1 - 0
Gem/Code/enabled_gems.cmake

@@ -22,4 +22,5 @@ set(ENABLED_GEMS
     Sponza
     Sponza
     MaterialEditor
     MaterialEditor
     UiBasics
     UiBasics
+    StreamerProfiler
 )
 )