From c686b86464532fdfc507d796d24ee36a32b65b86 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 1 Apr 2018 20:34:21 +0200 Subject: [PATCH] Add rudimentary memory information window. --- server/TracyView.cpp | 14 ++++++++++++++ server/TracyView.hpp | 2 ++ 2 files changed, 16 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 730daaf0..a53acc67 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -168,6 +168,7 @@ View::View( const char* addr ) , m_showOptions( false ) , m_showMessages( false ) , m_showStatistics( false ) + , m_showMemory( false ) , m_drawGpuZones( true ) , m_drawZones( true ) , m_drawLocks( true ) @@ -200,6 +201,7 @@ View::View( FileRead& f ) , m_showOptions( false ) , m_showMessages( false ) , m_showStatistics( false ) + , m_showMemory( false ) , m_drawGpuZones( true ) , m_drawZones( true ) , m_drawLocks( true ) @@ -307,6 +309,8 @@ void View::DrawImpl() ImGui::SameLine(); if( ImGui::Button( "Statistics", ImVec2( bw, 0 ) ) ) m_showStatistics = true; ImGui::SameLine(); + if( ImGui::Button( "Memory", ImVec2( bw, 0 ) ) ) m_showMemory = true; + ImGui::SameLine(); ImGui::Text( "Frames: %-7" PRIu64 " Time span: %-10s View span: %-10s Zones: %-13s Queue delay: %s Timer resolution: %s", m_worker.GetFrameCount(), TimeToString( m_worker.GetLastTime() - m_worker.GetFrameBegin( 0 ) ), TimeToString( m_zvEnd - m_zvStart ), RealToString( m_worker.GetZoneCount(), true ), TimeToString( m_worker.GetDelay() ), TimeToString( m_worker.GetResolution() ) ); DrawFrames(); DrawZones(); @@ -321,6 +325,7 @@ void View::DrawImpl() if( m_showMessages ) DrawMessages(); if( m_findZone.show ) DrawFindZone(); if( m_showStatistics ) DrawStatistics(); + if( m_showMemory ) DrawMemory(); if( m_zoomAnim.active ) { @@ -3647,6 +3652,15 @@ void View::DrawStatistics() ImGui::End(); } +void View::DrawMemory() +{ + auto& mem = m_worker.GetMemData(); + + ImGui::Begin( "Memory", &m_showMemory ); + ImGui::Text( "Active allocations: %s", RealToString( mem.active.size(), true ) ); + ImGui::End(); +} + uint32_t View::GetZoneColor( const ZoneEvent& ev ) { const auto& srcloc = m_worker.GetSourceLocation( ev.srcloc ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 0c3a74c2..3ad775f0 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -74,6 +74,7 @@ private: void DrawMessages(); void DrawFindZone(); void DrawStatistics(); + void DrawMemory(); void DrawInfoWindow(); void DrawZoneInfoWindow(); @@ -159,6 +160,7 @@ private: bool m_showOptions; bool m_showMessages; bool m_showStatistics; + bool m_showMemory; bool m_drawGpuZones; bool m_drawZones; bool m_drawLocks;