mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Use tables for callstack sample parents.
This commit is contained in:
parent
f1d48b1298
commit
6e715cf346
@ -15349,192 +15349,175 @@ void View::DrawSampleParents()
|
|||||||
|
|
||||||
auto& cs = m_worker.GetParentCallstack( data[m_sampleParents.sel]->first );
|
auto& cs = m_worker.GetParentCallstack( data[m_sampleParents.sel]->first );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::BeginChild( "##callstack" );
|
if( ImGui::BeginTable( "##callstack", 4, ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable | ImGuiTableFlags_Hideable | ImGuiTableFlags_Borders | ImGuiTableFlags_ScrollY ) )
|
||||||
const auto w = ImGui::GetWindowWidth();
|
|
||||||
static bool widthSet = false;
|
|
||||||
ImGui::Columns( 4 );
|
|
||||||
if( !widthSet )
|
|
||||||
{
|
{
|
||||||
widthSet = true;
|
ImGui::TableSetupScrollFreeze( 0, 1 );
|
||||||
ImGui::SetColumnWidth( 0, w * 0.05f );
|
ImGui::TableSetupColumn( "Frame", ImGuiTableColumnFlags_NoHide | ImGuiTableColumnFlags_WidthAutoResize );
|
||||||
ImGui::SetColumnWidth( 1, w * 0.425f );
|
ImGui::TableSetupColumn( "Function" );
|
||||||
ImGui::SetColumnWidth( 2, w * 0.425f );
|
ImGui::TableSetupColumn( "Location" );
|
||||||
ImGui::SetColumnWidth( 3, w * 0.1f );
|
ImGui::TableSetupColumn( "Image" );
|
||||||
}
|
ImGui::TableHeadersRow();
|
||||||
ImGui::TextUnformatted( "Frame" );
|
|
||||||
ImGui::NextColumn();
|
|
||||||
ImGui::TextUnformatted( "Function" );
|
|
||||||
ImGui::SameLine();
|
|
||||||
DrawHelpMarker( "Click on entry to copy it to clipboard." );
|
|
||||||
ImGui::NextColumn();
|
|
||||||
ImGui::TextUnformatted( "Location" );
|
|
||||||
ImGui::SameLine();
|
|
||||||
DrawHelpMarker( "Click on entry to copy it to clipboard.\nRight click on entry to try to open source file." );
|
|
||||||
ImGui::NextColumn();
|
|
||||||
ImGui::TextUnformatted( "Image" );
|
|
||||||
ImGui::NextColumn();
|
|
||||||
|
|
||||||
int fidx = 0;
|
int fidx = 0;
|
||||||
int bidx = 0;
|
int bidx = 0;
|
||||||
for( auto& entry : cs )
|
for( auto& entry : cs )
|
||||||
{
|
|
||||||
auto frameData = entry.custom ? m_worker.GetParentCallstackFrame( entry ) : m_worker.GetCallstackFrame( entry );
|
|
||||||
assert( frameData );
|
|
||||||
const auto fsz = frameData->size;
|
|
||||||
for( uint8_t f=0; f<fsz; f++ )
|
|
||||||
{
|
{
|
||||||
const auto& frame = frameData->data[f];
|
auto frameData = entry.custom ? m_worker.GetParentCallstackFrame( entry ) : m_worker.GetCallstackFrame( entry );
|
||||||
auto txt = m_worker.GetString( frame.name );
|
assert( frameData );
|
||||||
bidx++;
|
const auto fsz = frameData->size;
|
||||||
ImGui::Separator();
|
for( uint8_t f=0; f<fsz; f++ )
|
||||||
if( f == fsz-1 )
|
|
||||||
{
|
{
|
||||||
ImGui::Text( "%i", fidx++ );
|
const auto& frame = frameData->data[f];
|
||||||
}
|
auto txt = m_worker.GetString( frame.name );
|
||||||
else
|
bidx++;
|
||||||
{
|
ImGui::TableNextRow();
|
||||||
TextDisabledUnformatted( "inline" );
|
ImGui::TableNextColumn();
|
||||||
}
|
if( f == fsz-1 )
|
||||||
ImGui::NextColumn();
|
|
||||||
{
|
|
||||||
ImGui::PushTextWrapPos( 0.0f );
|
|
||||||
if( txt[0] == '[' )
|
|
||||||
{
|
{
|
||||||
TextDisabledUnformatted( txt );
|
ImGui::Text( "%i", fidx++ );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted( txt );
|
TextDisabledUnformatted( "inline" );
|
||||||
}
|
}
|
||||||
ImGui::PopTextWrapPos();
|
ImGui::TableNextColumn();
|
||||||
}
|
|
||||||
if( ImGui::IsItemClicked() )
|
|
||||||
{
|
|
||||||
ImGui::SetClipboardText( txt );
|
|
||||||
}
|
|
||||||
ImGui::NextColumn();
|
|
||||||
ImGui::PushTextWrapPos( 0.0f );
|
|
||||||
float indentVal = 0.f;
|
|
||||||
if( m_sampleParentBuzzAnim.Match( bidx ) )
|
|
||||||
{
|
|
||||||
const auto time = m_sampleParentBuzzAnim.Time();
|
|
||||||
indentVal = sin( time * 60.f ) * 10.f * time;
|
|
||||||
ImGui::Indent( indentVal );
|
|
||||||
}
|
|
||||||
txt = m_worker.GetString( frame.file );
|
|
||||||
switch( m_showCallstackFrameAddress )
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
if( frame.line == 0 )
|
|
||||||
{
|
{
|
||||||
TextDisabledUnformatted( txt );
|
ImGui::PushTextWrapPos( 0.0f );
|
||||||
}
|
if( txt[0] == '[' )
|
||||||
else
|
{
|
||||||
{
|
TextDisabledUnformatted( txt );
|
||||||
ImGui::TextDisabled( "%s:%i", txt, frame.line );
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted( txt );
|
||||||
|
}
|
||||||
|
ImGui::PopTextWrapPos();
|
||||||
}
|
}
|
||||||
if( ImGui::IsItemClicked() )
|
if( ImGui::IsItemClicked() )
|
||||||
{
|
{
|
||||||
ImGui::SetClipboardText( txt );
|
ImGui::SetClipboardText( txt );
|
||||||
}
|
}
|
||||||
break;
|
ImGui::TableNextColumn();
|
||||||
case 1:
|
ImGui::PushTextWrapPos( 0.0f );
|
||||||
if( entry.custom == 0 )
|
float indentVal = 0.f;
|
||||||
|
if( m_sampleParentBuzzAnim.Match( bidx ) )
|
||||||
{
|
{
|
||||||
const auto addr = m_worker.GetCanonicalPointer( entry );
|
const auto time = m_sampleParentBuzzAnim.Time();
|
||||||
ImGui::TextDisabled( "0x%" PRIx64, addr );
|
indentVal = sin( time * 60.f ) * 10.f * time;
|
||||||
if( ImGui::IsItemClicked() )
|
ImGui::Indent( indentVal );
|
||||||
|
}
|
||||||
|
txt = m_worker.GetString( frame.file );
|
||||||
|
switch( m_showCallstackFrameAddress )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
if( frame.line == 0 )
|
||||||
{
|
{
|
||||||
char tmp[32];
|
TextDisabledUnformatted( txt );
|
||||||
sprintf( tmp, "0x%" PRIx64, addr );
|
|
||||||
ImGui::SetClipboardText( tmp );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TextDisabledUnformatted( "unavailable" );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
ImGui::TextDisabled( "0x%" PRIx64, frame.symAddr );
|
|
||||||
if( ImGui::IsItemClicked() )
|
|
||||||
{
|
|
||||||
char tmp[32];
|
|
||||||
sprintf( tmp, "0x%" PRIx64, frame.symAddr );
|
|
||||||
ImGui::SetClipboardText( tmp );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
const auto sym = m_worker.GetSymbolData( frame.symAddr );
|
|
||||||
if( sym )
|
|
||||||
{
|
|
||||||
const auto symtxt = m_worker.GetString( sym->file );
|
|
||||||
if( sym->line == 0 )
|
|
||||||
{
|
|
||||||
TextDisabledUnformatted( symtxt );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui::TextDisabled( "%s:%i", symtxt, sym->line );
|
ImGui::TextDisabled( "%s:%i", txt, frame.line );
|
||||||
}
|
}
|
||||||
if( ImGui::IsItemClicked() )
|
if( ImGui::IsItemClicked() )
|
||||||
{
|
{
|
||||||
ImGui::SetClipboardText( symtxt );
|
ImGui::SetClipboardText( txt );
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else
|
case 1:
|
||||||
{
|
if( entry.custom == 0 )
|
||||||
TextDisabledUnformatted( "[unknown]" );
|
{
|
||||||
}
|
const auto addr = m_worker.GetCanonicalPointer( entry );
|
||||||
break;
|
ImGui::TextDisabled( "0x%" PRIx64, addr );
|
||||||
}
|
if( ImGui::IsItemClicked() )
|
||||||
default:
|
{
|
||||||
assert( false );
|
char tmp[32];
|
||||||
break;
|
sprintf( tmp, "0x%" PRIx64, addr );
|
||||||
}
|
ImGui::SetClipboardText( tmp );
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
}
|
||||||
{
|
}
|
||||||
if( m_showCallstackFrameAddress == 3 )
|
else
|
||||||
|
{
|
||||||
|
TextDisabledUnformatted( "unavailable" );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
ImGui::TextDisabled( "0x%" PRIx64, frame.symAddr );
|
||||||
|
if( ImGui::IsItemClicked() )
|
||||||
|
{
|
||||||
|
char tmp[32];
|
||||||
|
sprintf( tmp, "0x%" PRIx64, frame.symAddr );
|
||||||
|
ImGui::SetClipboardText( tmp );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
{
|
{
|
||||||
const auto sym = m_worker.GetSymbolData( frame.symAddr );
|
const auto sym = m_worker.GetSymbolData( frame.symAddr );
|
||||||
if( sym )
|
if( sym )
|
||||||
{
|
{
|
||||||
const auto symtxt = m_worker.GetString( sym->file );
|
const auto symtxt = m_worker.GetString( sym->file );
|
||||||
if( !ViewDispatch( symtxt, sym->line, frame.symAddr ) )
|
if( sym->line == 0 )
|
||||||
|
{
|
||||||
|
TextDisabledUnformatted( symtxt );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::TextDisabled( "%s:%i", symtxt, sym->line );
|
||||||
|
}
|
||||||
|
if( ImGui::IsItemClicked() )
|
||||||
|
{
|
||||||
|
ImGui::SetClipboardText( symtxt );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TextDisabledUnformatted( "[unknown]" );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
assert( false );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
|
{
|
||||||
|
if( m_showCallstackFrameAddress == 3 )
|
||||||
|
{
|
||||||
|
const auto sym = m_worker.GetSymbolData( frame.symAddr );
|
||||||
|
if( sym )
|
||||||
|
{
|
||||||
|
const auto symtxt = m_worker.GetString( sym->file );
|
||||||
|
if( !ViewDispatch( symtxt, sym->line, frame.symAddr ) )
|
||||||
|
{
|
||||||
|
m_sampleParentBuzzAnim.Enable( bidx, 0.5f );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_sampleParentBuzzAnim.Enable( bidx, 0.5f );
|
m_sampleParentBuzzAnim.Enable( bidx, 0.5f );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_sampleParentBuzzAnim.Enable( bidx, 0.5f );
|
if( !ViewDispatch( txt, frame.line, frame.symAddr ) )
|
||||||
|
{
|
||||||
|
m_sampleParentBuzzAnim.Enable( bidx, 0.5f );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
if( indentVal != 0.f )
|
||||||
{
|
{
|
||||||
if( !ViewDispatch( txt, frame.line, frame.symAddr ) )
|
ImGui::Unindent( indentVal );
|
||||||
{
|
}
|
||||||
m_sampleParentBuzzAnim.Enable( bidx, 0.5f );
|
ImGui::PopTextWrapPos();
|
||||||
}
|
ImGui::TableNextColumn();
|
||||||
|
if( frameData->imageName.Active() )
|
||||||
|
{
|
||||||
|
TextDisabledUnformatted( m_worker.GetString( frameData->imageName ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( indentVal != 0.f )
|
|
||||||
{
|
|
||||||
ImGui::Unindent( indentVal );
|
|
||||||
}
|
|
||||||
ImGui::PopTextWrapPos();
|
|
||||||
ImGui::NextColumn();
|
|
||||||
if( frameData->imageName.Active() )
|
|
||||||
{
|
|
||||||
TextDisabledUnformatted( m_worker.GetString( frameData->imageName ) );
|
|
||||||
}
|
|
||||||
ImGui::NextColumn();
|
|
||||||
}
|
}
|
||||||
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndColumns();
|
|
||||||
ImGui::EndChild();
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
if( !show )
|
if( !show )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user