mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Cache zone self times.
This commit is contained in:
+22
-4
@@ -4437,7 +4437,7 @@ void View::DrawZoneInfoWindow()
|
||||
|
||||
const auto end = m_worker.GetZoneEnd( ev );
|
||||
const auto ztime = end - ev.start;
|
||||
const auto selftime = ztime - GetZoneChildTime( ev );
|
||||
const auto selftime = GetZoneSelfTime( ev );
|
||||
TextFocused( "Time from start of program:", TimeToString( ev.start - m_worker.GetTimeBegin() ) );
|
||||
TextFocused( "Execution time:", TimeToString( ztime ) );
|
||||
if( ImGui::IsItemHovered() )
|
||||
@@ -5009,7 +5009,7 @@ void View::DrawGpuInfoWindow()
|
||||
|
||||
const auto end = m_worker.GetZoneEnd( ev );
|
||||
const auto ztime = end - ev.gpuStart;
|
||||
const auto selftime = ztime - GetZoneChildTime( ev );
|
||||
const auto selftime = GetZoneSelfTime( ev );
|
||||
TextFocused( "Time from start of program:", TimeToString( ev.gpuStart - m_worker.GetTimeBegin() ) );
|
||||
TextFocused( "GPU execution time:", TimeToString( ztime ) );
|
||||
TextFocused( "GPU self time:", TimeToString( selftime ) );
|
||||
@@ -9850,7 +9850,7 @@ void View::ZoneTooltip( const ZoneEvent& ev )
|
||||
auto& srcloc = m_worker.GetSourceLocation( ev.srcloc );
|
||||
const auto end = m_worker.GetZoneEnd( ev );
|
||||
const auto ztime = end - ev.start;
|
||||
const auto selftime = ztime - GetZoneChildTime( ev );
|
||||
const auto selftime = GetZoneSelfTime( ev );
|
||||
|
||||
ImGui::BeginTooltip();
|
||||
if( ev.name.active )
|
||||
@@ -9899,7 +9899,7 @@ void View::ZoneTooltip( const GpuEvent& ev )
|
||||
const auto& srcloc = m_worker.GetSourceLocation( ev.srcloc );
|
||||
const auto end = m_worker.GetZoneEnd( ev );
|
||||
const auto ztime = end - ev.gpuStart;
|
||||
const auto selftime = ztime - GetZoneChildTime( ev );
|
||||
const auto selftime = GetZoneSelfTime( ev );
|
||||
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextUnformatted( m_worker.GetString( srcloc.name ) );
|
||||
@@ -10262,4 +10262,22 @@ int64_t View::GetZoneChildTimeFast( const ZoneEvent& zone )
|
||||
return time;
|
||||
}
|
||||
|
||||
int64_t View::GetZoneSelfTime( const ZoneEvent& zone )
|
||||
{
|
||||
if( m_cache.zoneSelfTime.first == &zone ) return m_cache.zoneSelfTime.second;
|
||||
const auto ztime = m_worker.GetZoneEnd( zone ) - zone.start;
|
||||
const auto selftime = ztime - GetZoneChildTime( zone );
|
||||
if( zone.end >= 0 ) m_cache.zoneSelfTime = std::make_pair( &zone, selftime );
|
||||
return selftime;
|
||||
}
|
||||
|
||||
int64_t View::GetZoneSelfTime( const GpuEvent& zone )
|
||||
{
|
||||
if( m_cache.gpuSelfTime.first == &zone ) return m_cache.gpuSelfTime.second;
|
||||
const auto ztime = m_worker.GetZoneEnd( zone ) - zone.gpuStart;
|
||||
const auto selftime = ztime - GetZoneChildTime( zone );
|
||||
if( zone.gpuEnd >= 0 ) m_cache.gpuSelfTime = std::make_pair( &zone, selftime );
|
||||
return selftime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user