mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-21 22:24:35 +00:00
Use proper name for inline frames in flame graph.
This commit is contained in:
parent
ecf3b30baf
commit
84718101fe
@ -219,18 +219,19 @@ void View::BuildFlameGraph( const Worker& worker, std::vector<FlameGraphItem>& d
|
|||||||
const auto csz = callstack.size();
|
const auto csz = callstack.size();
|
||||||
for( size_t i=csz; i>0; i--)
|
for( size_t i=csz; i>0; i--)
|
||||||
{
|
{
|
||||||
auto frame = worker.GetCallstackFrame( callstack[i-1] );
|
auto frameData = worker.GetCallstackFrame( callstack[i-1] );
|
||||||
if( frame )
|
if( frameData )
|
||||||
{
|
{
|
||||||
for( uint8_t j=frame->size; j>0; j-- )
|
for( uint8_t j=frameData->size; j>0; j-- )
|
||||||
{
|
{
|
||||||
const auto symaddr = frame->data[j-1].symAddr;
|
const auto frame = frameData->data[j-1];
|
||||||
|
const auto symaddr = frame.symAddr;
|
||||||
if( symaddr != 0 )
|
if( symaddr != 0 )
|
||||||
{
|
{
|
||||||
auto it = std::find_if( vec->begin(), vec->end(), [symaddr]( const auto& v ) { return v.srcloc == symaddr; } );
|
auto it = std::find_if( vec->begin(), vec->end(), [symaddr]( const auto& v ) { return v.srcloc == symaddr; } );
|
||||||
if( it == vec->end() )
|
if( it == vec->end() )
|
||||||
{
|
{
|
||||||
vec->emplace_back( FlameGraphItem { (int64_t)symaddr, 1 } );
|
vec->emplace_back( FlameGraphItem { (int64_t)symaddr, 1, frame.name } );
|
||||||
vec = &vec->back().children;
|
vec = &vec->back().children;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -333,11 +334,11 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
name = m_worker.GetString( item.name );
|
||||||
const auto symAddr = (uint64_t)item.srcloc;
|
const auto symAddr = (uint64_t)item.srcloc;
|
||||||
auto sym = m_worker.GetSymbolData( symAddr );
|
auto sym = m_worker.GetSymbolData( symAddr );
|
||||||
if( sym )
|
if( sym )
|
||||||
{
|
{
|
||||||
name = m_worker.GetString( sym->name );
|
|
||||||
auto namehash = charutil::hash( name );
|
auto namehash = charutil::hash( name );
|
||||||
if( namehash == 0 ) namehash++;
|
if( namehash == 0 ) namehash++;
|
||||||
color = GetHsvColor( namehash, depth );
|
color = GetHsvColor( namehash, depth );
|
||||||
@ -348,7 +349,6 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
name = "???";
|
|
||||||
color = 0xFF888888;
|
color = 0xFF888888;
|
||||||
}
|
}
|
||||||
if( symAddr >> 63 != 0 )
|
if( symAddr >> 63 != 0 )
|
||||||
@ -405,7 +405,6 @@ void View::DrawFlameGraphItem( const FlameGraphItem& item, FlameGraphContext& ct
|
|||||||
auto sym = m_worker.GetSymbolData( symAddr );
|
auto sym = m_worker.GetSymbolData( symAddr );
|
||||||
if( sym )
|
if( sym )
|
||||||
{
|
{
|
||||||
auto name = m_worker.GetString( sym->name );
|
|
||||||
auto normalized = m_vd.shortenName == ShortenName::Never ? name : ShortenZoneName( ShortenName::OnlyNormalize, name );
|
auto normalized = m_vd.shortenName == ShortenName::Never ? name : ShortenZoneName( ShortenName::OnlyNormalize, name );
|
||||||
TextFocused( "Name:", normalized );
|
TextFocused( "Name:", normalized );
|
||||||
if( sym->isInline )
|
if( sym->isInline )
|
||||||
|
@ -850,6 +850,7 @@ struct FlameGraphItem
|
|||||||
{
|
{
|
||||||
int64_t srcloc;
|
int64_t srcloc;
|
||||||
int64_t time;
|
int64_t time;
|
||||||
|
StringIdx name;
|
||||||
int64_t begin;
|
int64_t begin;
|
||||||
std::vector<FlameGraphItem> children;
|
std::vector<FlameGraphItem> children;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user