mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Display list of child calls.
This commit is contained in:
parent
6a7b4e6066
commit
702c87dad0
@ -83,6 +83,12 @@ static constexpr const char* s_CostName[] = {
|
|||||||
|
|
||||||
static constexpr SourceView::CostType s_costSeparateAfter = SourceView::CostType::SlowCache;
|
static constexpr SourceView::CostType s_costSeparateAfter = SourceView::CostType::SlowCache;
|
||||||
|
|
||||||
|
struct ChildStat
|
||||||
|
{
|
||||||
|
uint64_t addr;
|
||||||
|
uint32_t count;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static size_t CountHwSamples( const SortedVector<Int48, Int48Sort>& vec, const Range& range )
|
static size_t CountHwSamples( const SortedVector<Int48, Int48Sort>& vec, const Range& range )
|
||||||
{
|
{
|
||||||
@ -180,6 +186,7 @@ SourceView::SourceView( GetWindowCallback gwcb )
|
|||||||
, m_calcInlineStats( true )
|
, m_calcInlineStats( true )
|
||||||
, m_atnt( false )
|
, m_atnt( false )
|
||||||
, m_childCalls( false )
|
, m_childCalls( false )
|
||||||
|
, m_childCallList( false )
|
||||||
, m_hwSamples( true )
|
, m_hwSamples( true )
|
||||||
, m_hwSamplesRelative( true )
|
, m_hwSamplesRelative( true )
|
||||||
, m_cost( CostType::SampleCount )
|
, m_cost( CostType::SampleCount )
|
||||||
@ -1300,6 +1307,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
|
|||||||
ImGui::PushItemFlag( ImGuiItemFlags_Disabled, true );
|
ImGui::PushItemFlag( ImGuiItemFlags_Disabled, true );
|
||||||
ImGui::PushStyleVar( ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f );
|
ImGui::PushStyleVar( ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f );
|
||||||
m_childCalls = false;
|
m_childCalls = false;
|
||||||
|
m_childCallList = false;
|
||||||
}
|
}
|
||||||
else if( ImGui::IsKeyDown( 'Z' ) )
|
else if( ImGui::IsKeyDown( 'Z' ) )
|
||||||
{
|
{
|
||||||
@ -1327,6 +1335,8 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
SmallToggleButton( ICON_FA_EYE, m_childCallList );
|
||||||
|
ImGui::SameLine();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if( m_childCalls )
|
if( m_childCalls )
|
||||||
@ -1374,6 +1384,7 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
TextFocused( "Events:", RealToString( as.ipTotalAsm.local ) );
|
TextFocused( "Events:", RealToString( as.ipTotalAsm.local ) );
|
||||||
|
m_childCallList = false;
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
@ -1422,6 +1433,59 @@ void SourceView::RenderSymbolView( Worker& worker, View& view )
|
|||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
if( m_childCallList )
|
||||||
|
{
|
||||||
|
unordered_flat_map<uint64_t, uint32_t> map;
|
||||||
|
if( m_calcInlineStats )
|
||||||
|
{
|
||||||
|
GatherChildStats( m_symAddr, map, worker, limitView, view );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GatherChildStats( m_baseAddr, map, worker, limitView, view );
|
||||||
|
}
|
||||||
|
if( !map.empty() )
|
||||||
|
{
|
||||||
|
TextDisabledUnformatted( "Child call distribution" );
|
||||||
|
if( ImGui::BeginChild( "ccd", ImVec2( 0, ImGui::GetFontSize() * std::min<size_t>( 4, map.size() ) + ImGui::GetStyle().WindowPadding.y ) ) )
|
||||||
|
{
|
||||||
|
std::vector<ChildStat> vec;
|
||||||
|
vec.reserve( map.size() );
|
||||||
|
for( auto& v : map ) vec.emplace_back( ChildStat { v.first, v.second } );
|
||||||
|
pdqsort_branchless( vec.begin(), vec.end(), []( const auto& lhs, const auto& rhs ) { return lhs.count > rhs.count; } );
|
||||||
|
int idx = 1;
|
||||||
|
for( auto& v : vec )
|
||||||
|
{
|
||||||
|
ImGui::TextDisabled( "%i.", idx++ );
|
||||||
|
ImGui::SameLine();
|
||||||
|
auto sd = worker.GetSymbolData( v.addr );
|
||||||
|
const auto symName = worker.GetString( sd->name );
|
||||||
|
if( v.addr >> 63 == 0 )
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted( symName );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TextColoredUnformatted( 0xFF8888FF, symName );
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
char tmp[16];
|
||||||
|
auto end = PrintFloat( tmp, tmp+16, 100.f * v.count / as.ipTotalAsm.ext, 2 );
|
||||||
|
*end = '\0';
|
||||||
|
ImGui::TextDisabled( "%s (%s%%)", TimeToString( v.count * worker.GetSamplingPeriod() ), tmp );
|
||||||
|
if( ImGui::IsItemHovered() )
|
||||||
|
{
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::Text( "%s samples", RealToString( v.count ) );
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
ImGui::Separator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t jumpOut = 0;
|
uint64_t jumpOut = 0;
|
||||||
switch( m_displayMode )
|
switch( m_displayMode )
|
||||||
{
|
{
|
||||||
|
@ -223,6 +223,7 @@ private:
|
|||||||
uint64_t m_jumpPopupAddr;
|
uint64_t m_jumpPopupAddr;
|
||||||
bool m_hwSamples, m_hwSamplesRelative;
|
bool m_hwSamples, m_hwSamplesRelative;
|
||||||
bool m_childCalls;
|
bool m_childCalls;
|
||||||
|
bool m_childCallList;
|
||||||
CostType m_cost;
|
CostType m_cost;
|
||||||
|
|
||||||
SourceContents m_source;
|
SourceContents m_source;
|
||||||
|
Loading…
Reference in New Issue
Block a user