Calculate flame graph begin times.

This commit is contained in:
Bartosz Taudul 2024-10-27 11:58:23 +01:00
parent 92241fc0a4
commit 9d2f874b02
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 11 additions and 0 deletions

View File

@ -536,6 +536,15 @@ static void MergeFlameGraph( std::vector<FlameGraphItem>& dst, std::vector<Flame
} }
} }
static void FixupTime( std::vector<FlameGraphItem>& data, uint64_t t = 0 )
{
for( auto& v : data )
{
v.begin = t;
if( !v.children.empty() ) FixupTime( v.children, t );
t += v.time;
}
}
void View::DrawFlameGraph() void View::DrawFlameGraph()
@ -700,6 +709,7 @@ void View::DrawFlameGraph()
} }
if( m_flameSort ) SortFlameGraph( m_flameGraphData ); if( m_flameSort ) SortFlameGraph( m_flameGraphData );
FixupTime( m_flameGraphData );
} }
int64_t zsz = 0; int64_t zsz = 0;

View File

@ -850,6 +850,7 @@ struct FlameGraphItem
{ {
int64_t srcloc; int64_t srcloc;
int64_t time; int64_t time;
int64_t begin;
std::vector<FlameGraphItem> children; std::vector<FlameGraphItem> children;
}; };