diff --git a/profiler/src/profiler/TracyUserData.cpp b/profiler/src/profiler/TracyUserData.cpp index 7e15c60e..df0fb9cb 100644 --- a/profiler/src/profiler/TracyUserData.cpp +++ b/profiler/src/profiler/TracyUserData.cpp @@ -144,6 +144,7 @@ void UserData::LoadState( ViewData& data ) if( ini_sget( ini, "options", "forceColors", "%d", &v ) ) data.forceColors = v; if( ini_sget( ini, "options", "ghostZones", "%d", &v ) ) data.ghostZones = v; if( ini_sget( ini, "options", "frameTarget", "%d", &v ) ) data.frameTarget = v; + if( ini_sget( ini, "options", "shortenName", "%d", &v ) ) data.shortenName = (ShortenName)v; ini_free( ini ); } } @@ -191,6 +192,7 @@ void UserData::SaveState( const ViewData& data ) fprintf( f, "forceColors = %d\n", data.forceColors ); fprintf( f, "ghostZones = %d\n", data.ghostZones ); fprintf( f, "frameTarget = %d\n", data.frameTarget ); + fprintf( f, "shortenName = %d\n", (int)data.shortenName ); fclose( f ); } } diff --git a/profiler/src/profiler/TracyView.hpp b/profiler/src/profiler/TracyView.hpp index 2e97fea3..1f4af461 100644 --- a/profiler/src/profiler/TracyView.hpp +++ b/profiler/src/profiler/TracyView.hpp @@ -131,7 +131,7 @@ public: ViewData& GetViewData() { return m_vd; } const ViewData& GetViewData() const { return m_vd; } - ShortenName GetShortenName() const { return m_shortenName; } + ShortenName GetShortenName() const { return m_vd.shortenName; } int GetNextGpuIdx() { return m_gpuIdx++; } const MessageData* GetMessageHighlight() const { return m_msgHighlight; } @@ -513,7 +513,6 @@ private: bool m_groupWaitStackTopDown = true; ShortcutAction m_shortcut = ShortcutAction::None; - ShortenName m_shortenName = ShortenName::NoSpaceAndNormalize; Animation m_zoomAnim; BuzzAnim m_callstackBuzzAnim; BuzzAnim m_sampleParentBuzzAnim; diff --git a/profiler/src/profiler/TracyViewData.hpp b/profiler/src/profiler/TracyViewData.hpp index ba5d9331..7add9d1d 100644 --- a/profiler/src/profiler/TracyViewData.hpp +++ b/profiler/src/profiler/TracyViewData.hpp @@ -4,6 +4,8 @@ #include #include +#include "TracyUtility.hpp" + namespace tracy { @@ -53,6 +55,7 @@ struct ViewData uint8_t dynamicColors = 1; uint8_t forceColors = false; uint8_t ghostZones = true; + ShortenName shortenName = ShortenName::NoSpaceAndNormalize; uint32_t frameTarget = 60; }; diff --git a/profiler/src/profiler/TracyView_Callstack.cpp b/profiler/src/profiler/TracyView_Callstack.cpp index a2e41f7f..f4ab8f74 100644 --- a/profiler/src/profiler/TracyView_Callstack.cpp +++ b/profiler/src/profiler/TracyView_Callstack.cpp @@ -252,7 +252,7 @@ void View::DrawCallstackTable( uint32_t callstack, bool globalEntriesButton ) { TextColoredUnformatted( 0xFF8888FF, txt ); } - else if( m_shortenName == ShortenName::Never ) + else if( m_vd.shortenName == ShortenName::Never ) { ImGui::TextUnformatted( txt ); } @@ -455,7 +455,7 @@ void View::DrawCallstackCalls( uint32_t callstack, uint16_t limit ) const { TextDisabledUnformatted( txt ); } - else if( m_shortenName == ShortenName::Never ) + else if( m_vd.shortenName == ShortenName::Never ) { ImGui::TextUnformatted( txt ); } @@ -526,7 +526,7 @@ void View::CallstackTooltipContents( uint32_t idx ) { TextColoredUnformatted( 0xFF8888FF, txt ); } - else if( m_shortenName == ShortenName::Never ) + else if( m_vd.shortenName == ShortenName::Never ) { ImGui::TextUnformatted( txt ); } diff --git a/profiler/src/profiler/TracyView_FindZone.cpp b/profiler/src/profiler/TracyView_FindZone.cpp index 878214cc..3b65e342 100644 --- a/profiler/src/profiler/TracyView_FindZone.cpp +++ b/profiler/src/profiler/TracyView_FindZone.cpp @@ -1702,7 +1702,7 @@ void View::DrawFindZone() TextDisabledUnformatted( ICON_FA_CARET_RIGHT ); } ImGui::SameLine(); - if( m_shortenName == ShortenName::Never ) + if( m_vd.shortenName == ShortenName::Never ) { ImGui::TextUnformatted( txt ); } diff --git a/profiler/src/profiler/TracyView_FrameTree.cpp b/profiler/src/profiler/TracyView_FrameTree.cpp index b882b1df..710aaa62 100644 --- a/profiler/src/profiler/TracyView_FrameTree.cpp +++ b/profiler/src/profiler/TracyView_FrameTree.cpp @@ -444,7 +444,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map& data, int64_t timeRange, Accu { TextColoredUnformatted( 0xFF8888FF, name ); } - else if( m_shortenName == ShortenName::Never ) + else if( m_vd.shortenName == ShortenName::Never ) { ImGui::TextUnformatted( name ); } @@ -297,7 +297,7 @@ void View::DrawSamplesStatistics( Vector& data, int64_t timeRange, Accu clicked = ImGui::Selectable( name, m_sampleParents.withInlines && m_sampleParents.symAddr == v.symAddr, ImGuiSelectableFlags_SpanAllColumns ); ImGui::PopStyleColor(); } - else if( m_shortenName == ShortenName::Never ) + else if( m_vd.shortenName == ShortenName::Never ) { clicked = ImGui::Selectable( name, m_sampleParents.withInlines && m_sampleParents.symAddr == v.symAddr, ImGuiSelectableFlags_SpanAllColumns ); } @@ -315,7 +315,7 @@ void View::DrawSamplesStatistics( Vector& data, int64_t timeRange, Accu if( parentName ) { ImGui::SameLine(); - if( m_shortenName == ShortenName::Never ) + if( m_vd.shortenName == ShortenName::Never ) { ImGui::TextDisabled( "(%s)", parentName ); } @@ -551,7 +551,7 @@ void View::DrawSamplesStatistics( Vector& data, int64_t timeRange, Accu const auto sn = iv.symAddr == v.symAddr ? "[ - self - ]" : name; if( m_mergeInlines || iv.excl == 0 ) { - if( m_shortenName == ShortenName::Never ) + if( m_vd.shortenName == ShortenName::Never ) { ImGui::TextUnformatted( sn ); } @@ -566,7 +566,7 @@ void View::DrawSamplesStatistics( Vector& data, int64_t timeRange, Accu { ImGui::PushID( idx++ ); bool clicked; - if( m_shortenName == ShortenName::Never ) + if( m_vd.shortenName == ShortenName::Never ) { clicked = ImGui::Selectable( sn, !m_sampleParents.withInlines && m_sampleParents.symAddr == iv.symAddr, ImGuiSelectableFlags_SpanAllColumns ); } @@ -727,7 +727,7 @@ void View::DrawSampleParents() assert( !stats.empty() ); const auto symName = m_worker.GetString( symbol->name ); - const char* normalized = m_shortenName != ShortenName::Never ? ShortenZoneName( ShortenName::OnlyNormalize, symName ) : nullptr; + const char* normalized = m_vd.shortenName != ShortenName::Never ? ShortenZoneName( ShortenName::OnlyNormalize, symName ) : nullptr; ImGui::PushFont( m_bigFont ); TextFocused( "Function:", normalized ? normalized : symName ); if( normalized ) @@ -886,7 +886,7 @@ void View::DrawSampleParents() { TextColoredUnformatted( 0xFF8888FF, txt ); } - else if( m_shortenName == ShortenName::Never ) + else if( m_vd.shortenName == ShortenName::Never ) { ImGui::TextUnformatted( txt ); } diff --git a/profiler/src/profiler/TracyView_ZoneTimeline.cpp b/profiler/src/profiler/TracyView_ZoneTimeline.cpp index 5c975bbb..e3ebdd98 100644 --- a/profiler/src/profiler/TracyView_ZoneTimeline.cpp +++ b/profiler/src/profiler/TracyView_ZoneTimeline.cpp @@ -288,9 +288,9 @@ void View::DrawZoneList( const TimelineContext& ctx, const std::vector zsz ) ) + if( m_vd.shortenName == ShortenName::Always || ( ( m_vd.shortenName == ShortenName::NoSpace || m_vd.shortenName == ShortenName::NoSpaceAndNormalize ) && tsz.x > zsz ) ) { - zoneName = ShortenZoneName( m_shortenName, zoneName, tsz, zsz ); + zoneName = ShortenZoneName( m_vd.shortenName, zoneName, tsz, zsz ); } const auto pr0 = ( ev.Start() - m_vd.zvStart ) * pxns; @@ -514,9 +514,9 @@ void View::DrawZoneList( const TimelineContext& ctx, const std::vector zsz ) ) + if( m_vd.shortenName != ShortenName::Never && ( m_vd.shortenName != ShortenName::NoSpace || tsz.x > zsz ) ) { - symName = ShortenZoneName( m_shortenName, symName, tsz, zsz ); + symName = ShortenZoneName( m_vd.shortenName, symName, tsz, zsz ); } if( tsz.x < zsz ) @@ -555,7 +555,7 @@ void View::DrawZoneList( const TimelineContext& ctx, const std::vector