From 8533bdf5f4b6103d9226055888e214607043b0e1 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 23 Jan 2022 15:44:37 +0100 Subject: [PATCH] Add data structures for GPU statistics. --- server/TracyWorker.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 1d43e0ad..149341c0 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -128,6 +128,17 @@ public: }; enum { ZoneThreadDataSize = sizeof( ZoneThreadData ) }; + struct GpuZoneThreadData + { + tracy_force_inline GpuEvent* Zone() const { return (GpuEvent*)( _zone_thread >> 16 ); } + tracy_force_inline void SetZone( GpuEvent* zone ) { assert( ( uint64_t( zone ) & 0xFFFF000000000000 ) == 0 ); memcpy( ((char*)&_zone_thread)+2, &zone, 4 ); memcpy( ((char*)&_zone_thread)+6, ((char*)&zone)+4, 2 ); } + tracy_force_inline uint16_t Thread() const { return uint16_t( _zone_thread & 0xFFFF ); } + tracy_force_inline void SetThread( uint16_t thread ) { memcpy( &_zone_thread, &thread, 2 ); } + + uint64_t _zone_thread; + }; + enum { GpuZoneThreadDataSize = sizeof( GpuZoneThreadData ) }; + struct CpuThreadTopology { uint32_t package; @@ -190,6 +201,17 @@ private: int64_t nonReentrantTotal = 0; }; + struct GpuSourceLocationZones + { + struct GpuZtdSort { bool operator()( const GpuZoneThreadData& lhs, const GpuZoneThreadData& rhs ) { return lhs.Zone()->GpuStart() < rhs.Zone()->GpuStart(); } }; + + SortedVector zones; + int64_t min = std::numeric_limits::max(); + int64_t max = std::numeric_limits::min(); + int64_t total = 0; + double sumSq = 0; + }; + struct CallstackFrameIdHash { size_t operator()( const CallstackFrameId& id ) const { return id.data; }