diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 9e828d8a..e3516aef 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -16,7 +16,7 @@ struct TextData #pragma pack( 1 ) -struct Event +struct ZoneEvent { int64_t start; int64_t end; @@ -25,11 +25,11 @@ struct Event int8_t cpu_end; TextData* text; - Event* parent; - Vector child; + ZoneEvent* parent; + Vector child; }; -enum { EventSize = sizeof( Event ) }; +enum { ZoneEventSize = sizeof( ZoneEvent ) }; struct LockEvent diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 18f4d6a1..6c45105e 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -564,7 +564,7 @@ void View::Process( const QueueItem& ev ) void View::ProcessZoneBegin( const QueueZoneBegin& ev ) { - auto zone = m_slab.AllocInit(); + auto zone = m_slab.AllocInit(); CheckSourceLocation( ev.srcloc ); @@ -784,7 +784,7 @@ void View::CheckThreadString( uint64_t id ) ServerQuery( ServerQueryThreadString, id ); } -void View::CheckCustomString( uint64_t ptr, Event* dst ) +void View::CheckCustomString( uint64_t ptr, ZoneEvent* dst ) { assert( m_pendingCustomStrings.find( ptr ) == m_pendingCustomStrings.end() ); m_pendingCustomStrings.emplace( ptr, dst ); @@ -918,20 +918,20 @@ View::ThreadData* View::NoticeThread( uint64_t thread ) } } -void View::NewZone( Event* zone, uint64_t thread ) +void View::NewZone( ZoneEvent* zone, uint64_t thread ) { m_zonesCnt++; - Vector* timeline = &NoticeThread( thread )->timeline; + Vector* timeline = &NoticeThread( thread )->timeline; InsertZone( zone, nullptr, *timeline ); } -void View::UpdateZone( Event* zone ) +void View::UpdateZone( ZoneEvent* zone ) { assert( zone->end != -1 ); assert( std::upper_bound( zone->child.begin(), zone->child.end(), zone->end, [] ( const auto& l, const auto& r ) { return l < r->start; } ) == zone->child.end() ); } -void View::InsertZone( Event* zone, Event* parent, Vector& vec ) +void View::InsertZone( ZoneEvent* zone, ZoneEvent* parent, Vector& vec ) { if( !vec.empty() ) { @@ -1158,7 +1158,7 @@ int64_t View::GetLastTime() const return last; } -int64_t View::GetZoneEnd( const Event& ev ) const +int64_t View::GetZoneEnd( const ZoneEvent& ev ) const { auto ptr = &ev; for(;;) @@ -1169,7 +1169,7 @@ int64_t View::GetZoneEnd( const Event& ev ) const } } -Vector& View::GetParentVector( const Event& ev ) +Vector& View::GetParentVector( const ZoneEvent& ev ) { if( ev.parent ) { @@ -1183,7 +1183,7 @@ Vector& View::GetParentVector( const Event& ev ) if( it != t->timeline.end() && *it == &ev ) return t->timeline; } assert( false ); - static Vector empty; + static Vector empty; return empty; } } @@ -1958,7 +1958,7 @@ void View::DrawZones() } } -int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth ) +int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth ) { auto it = std::lower_bound( vec.begin(), vec.end(), m_zvStart - m_delay, [] ( const auto& l, const auto& r ) { return l->end < r; } ); if( it == vec.end() ) return depth; @@ -2847,7 +2847,7 @@ void View::DrawMessages() ImGui::End(); } -uint32_t View::GetZoneColor( const Event& ev ) +uint32_t View::GetZoneColor( const ZoneEvent& ev ) { return GetZoneColor( GetSourceLocation( ev.srcloc ) ); } @@ -2858,7 +2858,7 @@ uint32_t View::GetZoneColor( const QueueSourceLocation& srcloc ) return color != 0 ? ( color | 0xFF000000 ) : 0xFFCC5555; } -uint32_t View::GetZoneHighlight( const Event& ev, bool migration ) +uint32_t View::GetZoneHighlight( const ZoneEvent& ev, bool migration ) { if( m_zoneInfoWindow == &ev ) { @@ -2882,7 +2882,7 @@ uint32_t View::GetZoneHighlight( const Event& ev, bool migration ) } } -float View::GetZoneThickness( const Event& ev ) +float View::GetZoneThickness( const ZoneEvent& ev ) { if( m_zoneInfoWindow == &ev || m_zoneHighlight == &ev ) { @@ -2894,7 +2894,7 @@ float View::GetZoneThickness( const Event& ev ) } } -void View::ZoomToZone( const Event& ev ) +void View::ZoomToZone( const ZoneEvent& ev ) { const auto end = GetZoneEnd( ev ); if( end - ev.start <= 0 ) return; @@ -2902,7 +2902,7 @@ void View::ZoomToZone( const Event& ev ) m_zvEndNext = end; } -void View::ZoneTooltip( const Event& ev ) +void View::ZoneTooltip( const ZoneEvent& ev ) { int dmul = 1; if( ev.text ) @@ -2954,7 +2954,7 @@ void View::ZoneTooltip( const Event& ev ) ImGui::EndTooltip(); } -TextData* View::GetTextData( Event& zone ) +TextData* View::GetTextData( ZoneEvent& zone ) { if( !zone.text ) { @@ -3088,7 +3088,7 @@ void View::Write( FileWrite& f ) } } -void View::WriteTimeline( FileWrite& f, const Vector& vec ) +void View::WriteTimeline( FileWrite& f, const Vector& vec ) { uint64_t sz = vec.size(); f.Write( &sz, sizeof( sz ) ); @@ -3118,7 +3118,7 @@ void View::WriteTimeline( FileWrite& f, const Vector& vec ) } } -void View::ReadTimeline( FileRead& f, Vector& vec, Event* parent, const std::unordered_map& stringMap ) +void View::ReadTimeline( FileRead& f, Vector& vec, ZoneEvent* parent, const std::unordered_map& stringMap ) { uint64_t sz; f.Read( &sz, sizeof( sz ) ); @@ -3126,7 +3126,7 @@ void View::ReadTimeline( FileRead& f, Vector& vec, Event* parent, const for( uint64_t i=0; i(); + auto zone = m_slab.AllocInit(); m_zonesCnt++; vec.push_back( zone ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index fe2bf29d..c6ff4a51 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -74,7 +74,7 @@ private: uint64_t id; bool showFull; bool visible; - Vector timeline; + Vector timeline; Vector messages; }; @@ -137,7 +137,7 @@ private: void CheckString( uint64_t ptr ); void CheckThreadString( uint64_t id ); - void CheckCustomString( uint64_t ptr, Event* dst ); + void CheckCustomString( uint64_t ptr, ZoneEvent* dst ); void CheckSourceLocation( uint64_t ptr ); void AddString( uint64_t ptr, std::string&& str ); @@ -150,10 +150,10 @@ private: ThreadData* NoticeThread( uint64_t thread ); - void NewZone( Event* zone, uint64_t thread ); - void UpdateZone( Event* zone ); + void NewZone( ZoneEvent* zone, uint64_t thread ); + void UpdateZone( ZoneEvent* zone ); - void InsertZone( Event* zone, Event* parent, Vector& vec ); + void InsertZone( ZoneEvent* zone, ZoneEvent* parent, Vector& vec ); void InsertLockEvent( LockMap& lockmap, LockEvent* lev, uint64_t thread ); void UpdateLockCount( LockMap& lockmap, size_t pos ); @@ -167,8 +167,8 @@ private: uint64_t GetFrameBegin( size_t idx ) const; uint64_t GetFrameEnd( size_t idx ) const; int64_t GetLastTime() const; - int64_t GetZoneEnd( const Event& ev ) const; - Vector& GetParentVector( const Event& ev ); + int64_t GetZoneEnd( const ZoneEvent& ev ) const; + Vector& GetParentVector( const ZoneEvent& ev ); const char* TimeToString( int64_t ns ) const; const char* RealToString( double val, bool separator ) const; const char* GetString( uint64_t ptr ) const; @@ -182,7 +182,7 @@ private: void DrawFrames(); bool DrawZoneFrames(); void DrawZones(); - int DrawZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth ); + int DrawZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth ); int DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int offset, LockHighlight& highlight ); void DrawZoneInfoWindow(); int DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover ); @@ -192,19 +192,19 @@ private: void HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns ); - uint32_t GetZoneColor( const Event& ev ); + uint32_t GetZoneColor( const ZoneEvent& ev ); uint32_t GetZoneColor( const QueueSourceLocation& srcloc ); - uint32_t GetZoneHighlight( const Event& ev, bool migration ); - float GetZoneThickness( const Event& ev ); + uint32_t GetZoneHighlight( const ZoneEvent& ev, bool migration ); + float GetZoneThickness( const ZoneEvent& ev ); - void ZoomToZone( const Event& ev ); - void ZoneTooltip( const Event& ev ); + void ZoomToZone( const ZoneEvent& ev ); + void ZoneTooltip( const ZoneEvent& ev ); - TextData* GetTextData( Event& zone ); + TextData* GetTextData( ZoneEvent& zone ); void Write( FileWrite& f ); - void WriteTimeline( FileWrite& f, const Vector& vec ); - void ReadTimeline( FileRead& f, Vector& vec, Event* parent, const std::unordered_map& stringMap ); + void WriteTimeline( FileWrite& f, const Vector& vec ); + void ReadTimeline( FileRead& f, Vector& vec, ZoneEvent* parent, const std::unordered_map& stringMap ); std::string m_addr; @@ -232,11 +232,11 @@ private: std::vector m_mbps; // not used for vis - no need to lock - std::unordered_map> m_zoneStack; + std::unordered_map> m_zoneStack; std::unordered_set m_pendingStrings; std::unordered_set m_pendingThreads; std::unordered_set m_pendingSourceLocation; - std::unordered_map m_pendingCustomStrings; + std::unordered_map m_pendingCustomStrings; std::unordered_map m_threadMap; std::unordered_map m_plotMap; std::unordered_map m_plotRev; @@ -269,8 +269,8 @@ private: uint64_t m_zvHeight; uint64_t m_zvScroll; - const Event* m_zoneInfoWindow; - const Event* m_zoneHighlight; + const ZoneEvent* m_zoneInfoWindow; + const ZoneEvent* m_zoneHighlight; LockHighlight m_lockHighlight; const MessageData* m_msgHighlight;