Implement basic in-engine timing

This commit is contained in:
2024-10-30 05:23:56 -04:00
parent 78bee55482
commit 92fd7162ed
11 changed files with 272 additions and 19 deletions

View File

@@ -18,6 +18,7 @@
#include "engine/assets/model/Model.hpp"
#include "engine/debug/DEBUG_NAMES.hpp"
#include "engine/debug/profiling/counters.hpp"
#include "engine/debug/timing/FlameGraph.hpp"
#include "engine/descriptors/DescriptorPool.hpp"
#include "engine/rendering/Renderer.hpp"
#include "engine/tree/octtree/OctTreeNode.hpp"
@@ -170,13 +171,15 @@ namespace fgl::engine::gui
void startDrawImGui( [[maybe_unused]] FrameInfo& info )
{
beginImGui();
profiling::resetCounters();
}
void drawImGui( FrameInfo& info )
{
ZoneScoped;
// ImGui::ShowDemoWindow();
auto timer = debug::timing::push( "Draw ImGui" );
ImGui::ShowDemoWindow();
drawDock();

View File

@@ -3,6 +3,7 @@
#include "core.hpp"
#include "engine/debug/profiling/counters.hpp"
#include "engine/debug/timing/FlameGraph.hpp"
#include "engine/flags.hpp"
#include "engine/math/literals/size.hpp"
#include "engine/memory/buffers/Buffer.hpp"
@@ -65,18 +66,25 @@ namespace fgl::engine::gui
using namespace literals::size_literals;
ImGui::Text( "Device" );
ImGui::Text( "|- %s Allocated", to_string( gpu_allocated ).c_str() );
ImGui::Text( "|- %s Used ", to_string( gpu_used ).c_str() );
ImGui::Text( "|- %s Unused", to_string( gpu.free() ).c_str() );
ImGui::Text( "|- %s Available in most allocated buffer", to_string( gpu.m_largest_free_block ).c_str() );
if ( ImGui::TreeNode( "Device" ) )
{
ImGui::Text( "|- %s Allocated", to_string( gpu_allocated ).c_str() );
ImGui::Text( "|- %s Used ", to_string( gpu_used ).c_str() );
ImGui::Text( "|- %s Unused", to_string( gpu.free() ).c_str() );
ImGui::Text( "|- %s Available in most allocated buffer", to_string( gpu.m_largest_free_block ).c_str() );
ImGui::TreePop();
}
ImGui::Separator();
ImGui::Text( "Host" );
ImGui::Text( "|- %s Allocated", to_string( host_allocated ).c_str() );
ImGui::Text( "|- %s Used ", to_string( host_used ).c_str() );
ImGui::Text( "|- %s Unused", to_string( host.free() ).c_str() );
ImGui::Text( "|- %s Available in most allocated buffer", to_string( host.m_largest_free_block ).c_str() );
if ( ImGui::TreeNode( "Host" ) )
{
ImGui::Text( "|- %s Allocated", to_string( host_allocated ).c_str() );
ImGui::Text( "|- %s Used ", to_string( host_used ).c_str() );
ImGui::Text( "|- %s Unused", to_string( host.free() ).c_str() );
ImGui::Text( "|- %s Available in most allocated buffer", to_string( host.m_largest_free_block ).c_str() );
ImGui::TreePop();
}
ImGui::Separator();
if ( ImGui::CollapsingHeader( "Buffers" ) )
@@ -110,6 +118,11 @@ namespace fgl::engine::gui
drawMemoryStats();
}
if ( ImGui::CollapsingHeader( "Timings" ) )
{
debug::timing::render();
}
imGuiOctTreeSettings( info );
if ( ImGui::Button( "Reload shaders" ) )

View File

@@ -5,6 +5,7 @@
#include "engine/EngineContext.hpp"
#include "engine/camera/CameraManager.hpp"
#include "engine/debug/timing/FlameGraph.hpp"
#include "engine/gameobjects/components/CameraComponent.hpp"
#include "gui/core.hpp"
@@ -33,6 +34,7 @@ int main()
//! Will be true until the window says it wants to close.
while ( engine_ctx.good() )
{
debug::timing::reset();
engine_ctx.tickDeltaTime();
engine_ctx.handleTransfers();
@@ -51,6 +53,8 @@ int main()
engine_ctx.renderFrame();
engine_ctx.finishFrame();
// This will 'end' the root node, Which is created on 'reset'
debug::timing::internal::pop();
}
return EXIT_SUCCESS;