From 28d029f8204b78550bb8cac8466a42c4b0809dd1 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 23 Jan 2022 15:47:33 +0100 Subject: [PATCH] Collection of GPU statistics. --- server/TracyWorker.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 22c3aa95..07fc5f6d 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -6095,6 +6095,24 @@ void Worker::ProcessGpuTime( const QueueGpuTime& ev ) else { zone->SetGpuEnd( gpuTime ); +#ifndef TRACY_NO_STATISTICS + const auto gpuStart = zone->GpuStart(); + const auto timeSpan = gpuTime - gpuStart; + if( timeSpan > 0 ) + { + GpuZoneThreadData ztd; + ztd.SetZone( zone ); + ztd.SetThread( zone->Thread() ); + auto slz = GetGpuSourceLocationZones( zone->SrcLoc() ); + slz->zones.push_back( ztd ); + if( slz->min > timeSpan ) slz->min = timeSpan; + if( slz->max < timeSpan ) slz->max = timeSpan; + slz->total += timeSpan; + slz->sumSq += double( timeSpan ) * timeSpan; + } +#else + CountZoneStatistics( zone ); +#endif } if( m_data.lastTime < gpuTime ) m_data.lastTime = gpuTime; }