Take children into account when determining zone end.

This commit is contained in:
Bartosz Taudul 2017-09-23 15:39:39 +02:00
parent 3f765002c1
commit 3d6e85db4a
2 changed files with 9 additions and 1 deletions

View File

@ -435,6 +435,13 @@ uint64_t View::GetLastTime() const
return last;
}
uint64_t View::GetZoneEnd( const Event& ev ) const
{
if( ev.end != -1 ) return ev.end;
if( ev.child.empty() ) return ev.start;
return GetZoneEnd( *ev.child.back() );
}
const char* View::TimeToString( uint64_t ns ) const
{
enum { Pool = 4 };
@ -901,7 +908,7 @@ void View::DrawZones()
auto& ev = **it;
const auto& srcFile = m_srcFile[ev.srcloc];
const char* func = GetString( srcFile.function );
const auto end = ev.end != -1 ? ev.end : ev.start;
const auto end = GetZoneEnd( ev );
const auto zsz = ( ev.end - ev.start ) * pxns;
const auto tsz = ImGui::CalcTextSize( func );
draw->AddRectFilled( wpos + ImVec2( ( ev.start - m_zvStart ) * pxns, offset ), wpos + ImVec2( ( end - m_zvStart ) * pxns, offset + tsz.y ), 0xDDDD6666, 2.f );

View File

@ -61,6 +61,7 @@ private:
uint64_t GetFrameBegin( size_t idx ) const;
uint64_t GetFrameEnd( size_t idx ) const;
uint64_t GetLastTime() const;
uint64_t GetZoneEnd( const Event& ev ) const;
const char* TimeToString( uint64_t ns ) const;
const char* GetString( uint64_t ptr ) const;
const char* GetThreadString( uint64_t id ) const;