mirror of
https://github.com/wolfpld/tracy
synced 2025-05-05 14:43:53 +00:00
Save shorten name setting for each trace.
This commit is contained in:
parent
4a7f6e0cc1
commit
6a6caae2ea
@ -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", "forceColors", "%d", &v ) ) data.forceColors = v;
|
||||||
if( ini_sget( ini, "options", "ghostZones", "%d", &v ) ) data.ghostZones = 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", "frameTarget", "%d", &v ) ) data.frameTarget = v;
|
||||||
|
if( ini_sget( ini, "options", "shortenName", "%d", &v ) ) data.shortenName = (ShortenName)v;
|
||||||
ini_free( ini );
|
ini_free( ini );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,6 +192,7 @@ void UserData::SaveState( const ViewData& data )
|
|||||||
fprintf( f, "forceColors = %d\n", data.forceColors );
|
fprintf( f, "forceColors = %d\n", data.forceColors );
|
||||||
fprintf( f, "ghostZones = %d\n", data.ghostZones );
|
fprintf( f, "ghostZones = %d\n", data.ghostZones );
|
||||||
fprintf( f, "frameTarget = %d\n", data.frameTarget );
|
fprintf( f, "frameTarget = %d\n", data.frameTarget );
|
||||||
|
fprintf( f, "shortenName = %d\n", (int)data.shortenName );
|
||||||
fclose( f );
|
fclose( f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ public:
|
|||||||
ViewData& GetViewData() { return m_vd; }
|
ViewData& GetViewData() { return m_vd; }
|
||||||
const ViewData& GetViewData() const { 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++; }
|
int GetNextGpuIdx() { return m_gpuIdx++; }
|
||||||
|
|
||||||
const MessageData* GetMessageHighlight() const { return m_msgHighlight; }
|
const MessageData* GetMessageHighlight() const { return m_msgHighlight; }
|
||||||
@ -513,7 +513,6 @@ private:
|
|||||||
bool m_groupWaitStackTopDown = true;
|
bool m_groupWaitStackTopDown = true;
|
||||||
|
|
||||||
ShortcutAction m_shortcut = ShortcutAction::None;
|
ShortcutAction m_shortcut = ShortcutAction::None;
|
||||||
ShortenName m_shortenName = ShortenName::NoSpaceAndNormalize;
|
|
||||||
Animation m_zoomAnim;
|
Animation m_zoomAnim;
|
||||||
BuzzAnim<int> m_callstackBuzzAnim;
|
BuzzAnim<int> m_callstackBuzzAnim;
|
||||||
BuzzAnim<int> m_sampleParentBuzzAnim;
|
BuzzAnim<int> m_sampleParentBuzzAnim;
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
|
#include "TracyUtility.hpp"
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -53,6 +55,7 @@ struct ViewData
|
|||||||
uint8_t dynamicColors = 1;
|
uint8_t dynamicColors = 1;
|
||||||
uint8_t forceColors = false;
|
uint8_t forceColors = false;
|
||||||
uint8_t ghostZones = true;
|
uint8_t ghostZones = true;
|
||||||
|
ShortenName shortenName = ShortenName::NoSpaceAndNormalize;
|
||||||
|
|
||||||
uint32_t frameTarget = 60;
|
uint32_t frameTarget = 60;
|
||||||
};
|
};
|
||||||
|
@ -252,7 +252,7 @@ void View::DrawCallstackTable( uint32_t callstack, bool globalEntriesButton )
|
|||||||
{
|
{
|
||||||
TextColoredUnformatted( 0xFF8888FF, txt );
|
TextColoredUnformatted( 0xFF8888FF, txt );
|
||||||
}
|
}
|
||||||
else if( m_shortenName == ShortenName::Never )
|
else if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( txt );
|
ImGui::TextUnformatted( txt );
|
||||||
}
|
}
|
||||||
@ -455,7 +455,7 @@ void View::DrawCallstackCalls( uint32_t callstack, uint16_t limit ) const
|
|||||||
{
|
{
|
||||||
TextDisabledUnformatted( txt );
|
TextDisabledUnformatted( txt );
|
||||||
}
|
}
|
||||||
else if( m_shortenName == ShortenName::Never )
|
else if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( txt );
|
ImGui::TextUnformatted( txt );
|
||||||
}
|
}
|
||||||
@ -526,7 +526,7 @@ void View::CallstackTooltipContents( uint32_t idx )
|
|||||||
{
|
{
|
||||||
TextColoredUnformatted( 0xFF8888FF, txt );
|
TextColoredUnformatted( 0xFF8888FF, txt );
|
||||||
}
|
}
|
||||||
else if( m_shortenName == ShortenName::Never )
|
else if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( txt );
|
ImGui::TextUnformatted( txt );
|
||||||
}
|
}
|
||||||
|
@ -1702,7 +1702,7 @@ void View::DrawFindZone()
|
|||||||
TextDisabledUnformatted( ICON_FA_CARET_RIGHT );
|
TextDisabledUnformatted( ICON_FA_CARET_RIGHT );
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if( m_shortenName == ShortenName::Never )
|
if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( txt );
|
ImGui::TextUnformatted( txt );
|
||||||
}
|
}
|
||||||
|
@ -444,7 +444,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, MemCallstackFr
|
|||||||
{
|
{
|
||||||
TextColoredUnformatted( 0xFF8888FF, frameName );
|
TextColoredUnformatted( 0xFF8888FF, frameName );
|
||||||
}
|
}
|
||||||
else if( m_shortenName == ShortenName::Never )
|
else if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( frameName );
|
ImGui::TextUnformatted( frameName );
|
||||||
}
|
}
|
||||||
@ -463,7 +463,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, MemCallstackFr
|
|||||||
else if( isKernel ) ImGui::PushStyleColor( ImGuiCol_Text, 0xFF8888FF );
|
else if( isKernel ) ImGui::PushStyleColor( ImGuiCol_Text, 0xFF8888FF );
|
||||||
if( tree.size() == 1 )
|
if( tree.size() == 1 )
|
||||||
{
|
{
|
||||||
if( m_shortenName == ShortenName::Never )
|
if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
expand = ImGui::TreeNodeEx( frameName, ImGuiTreeNodeFlags_DefaultOpen );
|
expand = ImGui::TreeNodeEx( frameName, ImGuiTreeNodeFlags_DefaultOpen );
|
||||||
}
|
}
|
||||||
@ -476,7 +476,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, MemCallstackFr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( m_shortenName == ShortenName::Never )
|
if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
expand = ImGui::TreeNode( frameName );
|
expand = ImGui::TreeNode( frameName );
|
||||||
}
|
}
|
||||||
@ -618,7 +618,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, CallstackFrame
|
|||||||
{
|
{
|
||||||
TextColoredUnformatted( 0xFF8888FF, frameName );
|
TextColoredUnformatted( 0xFF8888FF, frameName );
|
||||||
}
|
}
|
||||||
else if( m_shortenName == ShortenName::Never )
|
else if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( frameName );
|
ImGui::TextUnformatted( frameName );
|
||||||
}
|
}
|
||||||
@ -637,7 +637,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, CallstackFrame
|
|||||||
else if( isKernel ) ImGui::PushStyleColor( ImGuiCol_Text, 0xFF8888FF );
|
else if( isKernel ) ImGui::PushStyleColor( ImGuiCol_Text, 0xFF8888FF );
|
||||||
if( tree.size() == 1 )
|
if( tree.size() == 1 )
|
||||||
{
|
{
|
||||||
if( m_shortenName == ShortenName::Never )
|
if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
expand = ImGui::TreeNodeEx( frameName, ImGuiTreeNodeFlags_DefaultOpen );
|
expand = ImGui::TreeNodeEx( frameName, ImGuiTreeNodeFlags_DefaultOpen );
|
||||||
}
|
}
|
||||||
@ -650,7 +650,7 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, CallstackFrame
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( m_shortenName == ShortenName::Never )
|
if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
expand = ImGui::TreeNode( frameName );
|
expand = ImGui::TreeNode( frameName );
|
||||||
}
|
}
|
||||||
@ -762,7 +762,7 @@ void View::DrawParentsFrameTreeLevel( const unordered_flat_map<uint64_t, Callsta
|
|||||||
{
|
{
|
||||||
TextColoredUnformatted( 0xFF8888FF, frameName );
|
TextColoredUnformatted( 0xFF8888FF, frameName );
|
||||||
}
|
}
|
||||||
else if( m_shortenName == ShortenName::Never )
|
else if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( frameName );
|
ImGui::TextUnformatted( frameName );
|
||||||
}
|
}
|
||||||
@ -781,7 +781,7 @@ void View::DrawParentsFrameTreeLevel( const unordered_flat_map<uint64_t, Callsta
|
|||||||
else if( isKernel ) ImGui::PushStyleColor( ImGuiCol_Text, 0xFF8888FF );
|
else if( isKernel ) ImGui::PushStyleColor( ImGuiCol_Text, 0xFF8888FF );
|
||||||
if( tree.size() == 1 )
|
if( tree.size() == 1 )
|
||||||
{
|
{
|
||||||
if( m_shortenName == ShortenName::Never )
|
if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
expand = ImGui::TreeNodeEx( frameName, ImGuiTreeNodeFlags_DefaultOpen );
|
expand = ImGui::TreeNodeEx( frameName, ImGuiTreeNodeFlags_DefaultOpen );
|
||||||
}
|
}
|
||||||
@ -794,7 +794,7 @@ void View::DrawParentsFrameTreeLevel( const unordered_flat_map<uint64_t, Callsta
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( m_shortenName == ShortenName::Never )
|
if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
expand = ImGui::TreeNode( frameName );
|
expand = ImGui::TreeNode( frameName );
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ void View::DrawOptions()
|
|||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
ImGui::Unindent();
|
ImGui::Unindent();
|
||||||
m_vd.dynamicColors = ival;
|
m_vd.dynamicColors = ival;
|
||||||
ival = (int)m_shortenName;
|
ival = (int)m_vd.shortenName;
|
||||||
ImGui::TextUnformatted( ICON_FA_RULER_HORIZONTAL " Zone name shortening" );
|
ImGui::TextUnformatted( ICON_FA_RULER_HORIZONTAL " Zone name shortening" );
|
||||||
ImGui::Indent();
|
ImGui::Indent();
|
||||||
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
|
ImGui::PushStyleVar( ImGuiStyleVar_FramePadding, ImVec2( 0, 0 ) );
|
||||||
@ -235,7 +235,7 @@ void View::DrawOptions()
|
|||||||
ImGui::RadioButton( "As needed + normalize", &ival, (uint8_t)ShortenName::NoSpaceAndNormalize );
|
ImGui::RadioButton( "As needed + normalize", &ival, (uint8_t)ShortenName::NoSpaceAndNormalize );
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
ImGui::Unindent();
|
ImGui::Unindent();
|
||||||
m_shortenName = (ShortenName)ival;
|
m_vd.shortenName = (ShortenName)ival;
|
||||||
ImGui::Unindent();
|
ImGui::Unindent();
|
||||||
|
|
||||||
if( !m_worker.GetLockMap().empty() )
|
if( !m_worker.GetLockMap().empty() )
|
||||||
|
@ -276,7 +276,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
|
|||||||
{
|
{
|
||||||
TextColoredUnformatted( 0xFF8888FF, name );
|
TextColoredUnformatted( 0xFF8888FF, name );
|
||||||
}
|
}
|
||||||
else if( m_shortenName == ShortenName::Never )
|
else if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( name );
|
ImGui::TextUnformatted( name );
|
||||||
}
|
}
|
||||||
@ -297,7 +297,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
|
|||||||
clicked = ImGui::Selectable( name, m_sampleParents.withInlines && m_sampleParents.symAddr == v.symAddr, ImGuiSelectableFlags_SpanAllColumns );
|
clicked = ImGui::Selectable( name, m_sampleParents.withInlines && m_sampleParents.symAddr == v.symAddr, ImGuiSelectableFlags_SpanAllColumns );
|
||||||
ImGui::PopStyleColor();
|
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 );
|
clicked = ImGui::Selectable( name, m_sampleParents.withInlines && m_sampleParents.symAddr == v.symAddr, ImGuiSelectableFlags_SpanAllColumns );
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
|
|||||||
if( parentName )
|
if( parentName )
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if( m_shortenName == ShortenName::Never )
|
if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextDisabled( "(%s)", parentName );
|
ImGui::TextDisabled( "(%s)", parentName );
|
||||||
}
|
}
|
||||||
@ -551,7 +551,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
|
|||||||
const auto sn = iv.symAddr == v.symAddr ? "[ - self - ]" : name;
|
const auto sn = iv.symAddr == v.symAddr ? "[ - self - ]" : name;
|
||||||
if( m_mergeInlines || iv.excl == 0 )
|
if( m_mergeInlines || iv.excl == 0 )
|
||||||
{
|
{
|
||||||
if( m_shortenName == ShortenName::Never )
|
if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( sn );
|
ImGui::TextUnformatted( sn );
|
||||||
}
|
}
|
||||||
@ -566,7 +566,7 @@ void View::DrawSamplesStatistics( Vector<SymList>& data, int64_t timeRange, Accu
|
|||||||
{
|
{
|
||||||
ImGui::PushID( idx++ );
|
ImGui::PushID( idx++ );
|
||||||
bool clicked;
|
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 );
|
clicked = ImGui::Selectable( sn, !m_sampleParents.withInlines && m_sampleParents.symAddr == iv.symAddr, ImGuiSelectableFlags_SpanAllColumns );
|
||||||
}
|
}
|
||||||
@ -727,7 +727,7 @@ void View::DrawSampleParents()
|
|||||||
assert( !stats.empty() );
|
assert( !stats.empty() );
|
||||||
|
|
||||||
const auto symName = m_worker.GetString( symbol->name );
|
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 );
|
ImGui::PushFont( m_bigFont );
|
||||||
TextFocused( "Function:", normalized ? normalized : symName );
|
TextFocused( "Function:", normalized ? normalized : symName );
|
||||||
if( normalized )
|
if( normalized )
|
||||||
@ -886,7 +886,7 @@ void View::DrawSampleParents()
|
|||||||
{
|
{
|
||||||
TextColoredUnformatted( 0xFF8888FF, txt );
|
TextColoredUnformatted( 0xFF8888FF, txt );
|
||||||
}
|
}
|
||||||
else if( m_shortenName == ShortenName::Never )
|
else if( m_vd.shortenName == ShortenName::Never )
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( txt );
|
ImGui::TextUnformatted( txt );
|
||||||
}
|
}
|
||||||
|
@ -288,9 +288,9 @@ void View::DrawZoneList( const TimelineContext& ctx, const std::vector<TimelineD
|
|||||||
const char* zoneName = m_worker.GetZoneName( ev );
|
const char* zoneName = m_worker.GetZoneName( ev );
|
||||||
|
|
||||||
auto tsz = ImGui::CalcTextSize( zoneName );
|
auto tsz = ImGui::CalcTextSize( zoneName );
|
||||||
if( m_shortenName == ShortenName::Always || ( ( m_shortenName == ShortenName::NoSpace || m_shortenName == ShortenName::NoSpaceAndNormalize ) && tsz.x > 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;
|
const auto pr0 = ( ev.Start() - m_vd.zvStart ) * pxns;
|
||||||
@ -514,9 +514,9 @@ void View::DrawZoneList( const TimelineContext& ctx, const std::vector<TimelineD
|
|||||||
DrawLine( draw, dpos + ImVec2( px0, offset + tsz.y ), dpos + ImVec2( px1-1, offset + tsz.y ), dpos + ImVec2( px1-1, offset ), darkColor, 1.f );
|
DrawLine( draw, dpos + ImVec2( px0, offset + tsz.y ), dpos + ImVec2( px1-1, offset + tsz.y ), dpos + ImVec2( px1-1, offset ), darkColor, 1.f );
|
||||||
|
|
||||||
auto origSymName = symName;
|
auto origSymName = symName;
|
||||||
if( m_shortenName != ShortenName::Never && ( m_shortenName != ShortenName::NoSpace || tsz.x > 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 )
|
if( tsz.x < zsz )
|
||||||
@ -555,7 +555,7 @@ void View::DrawZoneList( const TimelineContext& ctx, const std::vector<TimelineD
|
|||||||
TextDisabledUnformatted( ICON_FA_HAT_WIZARD " kernel" );
|
TextDisabledUnformatted( ICON_FA_HAT_WIZARD " kernel" );
|
||||||
}
|
}
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
const auto normalized = m_shortenName == ShortenName::Never ? origSymName : ShortenZoneName( ShortenName::OnlyNormalize, origSymName );
|
const auto normalized = m_vd.shortenName == ShortenName::Never ? origSymName : ShortenZoneName( ShortenName::OnlyNormalize, origSymName );
|
||||||
ImGui::TextUnformatted( normalized );
|
ImGui::TextUnformatted( normalized );
|
||||||
if( isInline )
|
if( isInline )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user