From 31c2ddb8ac7132f1b9d94509ebf82f5865da759f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 28 Jul 2018 00:34:04 +0200 Subject: [PATCH] Rename client's SourceLocation to SourceLocationData. --- Tracy.hpp | 26 +++++++++++++------------- TracyOpenGL.hpp | 12 ++++++------ TracyVulkan.hpp | 12 ++++++------ client/TracyLock.hpp | 8 ++++---- client/TracyProfiler.cpp | 10 +++++----- client/TracyProfiler.hpp | 2 +- client/TracyScoped.hpp | 4 ++-- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Tracy.hpp b/Tracy.hpp index 9ebe9f37..3da65527 100644 --- a/Tracy.hpp +++ b/Tracy.hpp @@ -56,10 +56,10 @@ #include "client/TracyProfiler.hpp" #include "client/TracyScoped.hpp" -#define ZoneNamed( varname ) static const tracy::SourceLocation TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__) ); -#define ZoneNamedN( varname, name ) static const tracy::SourceLocation TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__) ); -#define ZoneNamedC( varname, color ) static const tracy::SourceLocation TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__) ); -#define ZoneNamedNC( varname, name, color ) static const tracy::SourceLocation TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__) ); +#define ZoneNamed( varname ) static const tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__) ); +#define ZoneNamedN( varname, name ) static const tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__) ); +#define ZoneNamedC( varname, color ) static const tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__) ); +#define ZoneNamedNC( varname, name, color ) static const tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__) ); #define ZoneScoped ZoneNamed( ___tracy_scoped_zone ) #define ZoneScopedN( name ) ZoneNamedN( ___tracy_scoped_zone, name ) @@ -71,13 +71,13 @@ #define FrameMark tracy::Profiler::SendFrameMark(); -#define TracyLockable( type, varname ) tracy::Lockable varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { nullptr, #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() }; -#define TracyLockableN( type, varname, desc ) tracy::Lockable varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { nullptr, desc, __FILE__, __LINE__, 0 }; return &srcloc; }() }; -#define TracySharedLockable( type, varname ) tracy::SharedLockable varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { nullptr, #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() }; -#define TracySharedLockableN( type, varname, desc ) tracy::SharedLockable varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { nullptr, desc, __FILE__, __LINE__, 0 }; return &srcloc; }() }; +#define TracyLockable( type, varname ) tracy::Lockable varname { [] () -> const tracy::SourceLocationData* { static const tracy::SourceLocationData srcloc { nullptr, #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() }; +#define TracyLockableN( type, varname, desc ) tracy::Lockable varname { [] () -> const tracy::SourceLocationData* { static const tracy::SourceLocationData srcloc { nullptr, desc, __FILE__, __LINE__, 0 }; return &srcloc; }() }; +#define TracySharedLockable( type, varname ) tracy::SharedLockable varname { [] () -> const tracy::SourceLocationData* { static const tracy::SourceLocationData srcloc { nullptr, #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() }; +#define TracySharedLockableN( type, varname, desc ) tracy::SharedLockable varname { [] () -> const tracy::SourceLocationData* { static const tracy::SourceLocationData srcloc { nullptr, desc, __FILE__, __LINE__, 0 }; return &srcloc; }() }; #define LockableBase( type ) tracy::Lockable #define SharedLockableBase( type ) tracy::SharedLockable -#define LockMark( varname ) static const tracy::SourceLocation __tracy_lock_location_##varname { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_##varname ); +#define LockMark( varname ) static const tracy::SourceLocationData __tracy_lock_location_##varname { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_##varname ); #define TracyPlot( name, val ) tracy::Profiler::PlotData( name, val ); @@ -88,10 +88,10 @@ #define TracyFree( ptr ) tracy::Profiler::MemFree( ptr ); #ifdef TRACY_HAS_CALLSTACK -# define ZoneNamedS( varname, depth ) static const tracy::SourceLocation TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth ); -# define ZoneNamedNS( varname, name, depth ) static const tracy::SourceLocation TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth ); -# define ZoneNamedCS( varname, color, depth ) static const tracy::SourceLocation TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth ); -# define ZoneNamedNCS( varname, name, color, depth ) static const tracy::SourceLocation TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth ); +# define ZoneNamedS( varname, depth ) static const tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth ); +# define ZoneNamedNS( varname, name, depth ) static const tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth ); +# define ZoneNamedCS( varname, color, depth ) static const tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth ); +# define ZoneNamedNCS( varname, name, color, depth ) static const tracy::SourceLocationData TracyConcat(__tracy_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone varname( &TracyConcat(__tracy_source_location,__LINE__), depth ); # define ZoneScopedS( depth ) ZoneNamedS( ___tracy_scoped_zone, depth ) # define ZoneScopedNS( name, depth ) ZoneNamedNS( ___tracy_scoped_zone, name, depth ) diff --git a/TracyOpenGL.hpp b/TracyOpenGL.hpp index eefcb38b..6b5010a0 100644 --- a/TracyOpenGL.hpp +++ b/TracyOpenGL.hpp @@ -30,15 +30,15 @@ #include "common/TracyAlloc.hpp" #define TracyGpuContext tracy::s_gpuCtx.ptr = (tracy::GpuCtx*)tracy::tracy_malloc( sizeof( tracy::GpuCtx ) ); new(tracy::s_gpuCtx.ptr) tracy::GpuCtx; -#define TracyGpuNamedZone( varname, name ) static const tracy::SourceLocation TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__) ); -#define TracyGpuNamedZoneC( varname, name, color ) static const tracy::SourceLocation TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__) ); +#define TracyGpuNamedZone( varname, name ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__) ); +#define TracyGpuNamedZoneC( varname, name, color ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__) ); #define TracyGpuZone( name ) TracyGpuNamedZone( ___tracy_gpu_zone, name ) #define TracyGpuZoneC( name, color ) TracyGpuNamedZoneC( ___tracy_gpu_zone, name, color ) #define TracyGpuCollect tracy::s_gpuCtx.ptr->Collect(); #ifdef TRACY_HAS_CALLSTACK -# define TracyGpuNamedZoneS( varname, name, depth ) static const tracy::SourceLocation TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), depth ); -# define TracyGpuNamedZoneCS( varname, name, color, depth ) static const tracy::SourceLocation TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), depth ); +# define TracyGpuNamedZoneS( varname, name, depth ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), depth ); +# define TracyGpuNamedZoneCS( varname, name, color, depth ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::GpuCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), depth ); # define TracyGpuZoneS( name, depth ) TracyGpuNamedZoneS( ___tracy_gpu_zone, name, depth ) # define TracyGpuZoneCS( name, color, depth ) TracyGpuNamedZoneCS( ___tracy_gpu_zone, name, color, depth ) #else @@ -181,7 +181,7 @@ extern thread_local GpuCtxWrapper s_gpuCtx; class GpuCtxScope { public: - tracy_force_inline GpuCtxScope( const SourceLocation* srcloc ) + tracy_force_inline GpuCtxScope( const SourceLocationData* srcloc ) #ifdef TRACY_ON_DEMAND : m_active( s_profiler.IsConnected() ) #endif @@ -205,7 +205,7 @@ public: tail.store( magic + 1, std::memory_order_release ); } - tracy_force_inline GpuCtxScope( const SourceLocation* srcloc, int depth ) + tracy_force_inline GpuCtxScope( const SourceLocationData* srcloc, int depth ) #ifdef TRACY_ON_DEMAND : m_active( s_profiler.IsConnected() ) #endif diff --git a/TracyVulkan.hpp b/TracyVulkan.hpp index f21a14e9..1a8a3be7 100644 --- a/TracyVulkan.hpp +++ b/TracyVulkan.hpp @@ -27,15 +27,15 @@ #define TracyVkContext( physdev, device, queue, cmdbuf ) tracy::s_vkCtx.ptr = (tracy::VkCtx*)tracy::tracy_malloc( sizeof( tracy::VkCtx ) ); new(tracy::s_vkCtx.ptr) tracy::VkCtx( physdev, device, queue, cmdbuf ); #define TracyVkDestroy() tracy::s_vkCtx.ptr->~VkCtx(); tracy::tracy_free( tracy::s_vkCtx.ptr ); tracy::s_vkCtx.ptr = nullptr; -#define TracyVkNamedZone( varname, cmdbuf, name ) static const tracy::SourceLocation TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::VkCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), cmdbuf ); -#define TracyVkNamedZoneC( varname, cmdbuf, name, color ) static const tracy::SourceLocation TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::VkCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), cmdbuf ); +#define TracyVkNamedZone( varname, cmdbuf, name ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::VkCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), cmdbuf ); +#define TracyVkNamedZoneC( varname, cmdbuf, name, color ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::VkCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), cmdbuf ); #define TracyVkZone( cmdbuf, name ) TracyVkNamedZone( ___tracy_gpu_zone, cmdbuf, name ) #define TracyVkZoneC( cmdbuf, name, color ) TracyVkNamedZoneC( ___tracy_gpu_zone, cmdbuf, name, color ) #define TracyVkCollect( cmdbuf ) tracy::s_vkCtx.ptr->Collect( cmdbuf ); #ifdef TRACY_HAS_CALLSTACK -# define TracyVkNamedZoneS( varname, cmdbuf, name, depth ) static const tracy::SourceLocation TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::VkCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), cmdbuf, depth ); -# define TracyVkNamedZoneCS( varname, cmdbuf, name, color, depth ) static const tracy::SourceLocation TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::VkCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), cmdbuf, depth ); +# define TracyVkNamedZoneS( varname, cmdbuf, name, depth ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::VkCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), cmdbuf, depth ); +# define TracyVkNamedZoneCS( varname, cmdbuf, name, color, depth ) static const tracy::SourceLocationData TracyConcat(__tracy_gpu_source_location,__LINE__) { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::VkCtxScope varname( &TracyConcat(__tracy_gpu_source_location,__LINE__), cmdbuf, depth ); # define TracyVkZoneS( cmdbuf, name, depth ) TracyVkNamedZoneS( ___tracy_gpu_zone, cmdbuf, name, depth ) # define TracyVkZoneCS( cmdbuf, name, color, depth ) TracyVkNamedZoneCS( ___tracy_gpu_zone, cmdbuf, name, color, depth ) #else @@ -214,7 +214,7 @@ extern VkCtxWrapper s_vkCtx; class VkCtxScope { public: - tracy_force_inline VkCtxScope( const SourceLocation* srcloc, VkCommandBuffer cmdbuf ) + tracy_force_inline VkCtxScope( const SourceLocationData* srcloc, VkCommandBuffer cmdbuf ) : m_cmdbuf( cmdbuf ) #ifdef TRACY_ON_DEMAND , m_active( s_profiler.IsConnected() ) @@ -240,7 +240,7 @@ public: tail.store( magic + 1, std::memory_order_release ); } - tracy_force_inline VkCtxScope( const SourceLocation* srcloc, VkCommandBuffer cmdbuf, int depth ) + tracy_force_inline VkCtxScope( const SourceLocationData* srcloc, VkCommandBuffer cmdbuf, int depth ) : m_cmdbuf( cmdbuf ) #ifdef TRACY_ON_DEMAND , m_active( s_profiler.IsConnected() ) diff --git a/client/TracyLock.hpp b/client/TracyLock.hpp index 4af7117e..b4450c09 100644 --- a/client/TracyLock.hpp +++ b/client/TracyLock.hpp @@ -17,7 +17,7 @@ template class Lockable { public: - tracy_force_inline Lockable( const SourceLocation* srcloc ) + tracy_force_inline Lockable( const SourceLocationData* srcloc ) : m_id( s_lockCounter.fetch_add( 1, std::memory_order_relaxed ) ) #ifdef TRACY_ON_DEMAND , m_lockCount( 0 ) @@ -152,7 +152,7 @@ public: return ret; } - tracy_force_inline void Mark( const SourceLocation* srcloc ) + tracy_force_inline void Mark( const SourceLocationData* srcloc ) { #ifdef TRACY_ON_DEMAND const auto active = m_active.load( std::memory_order_relaxed ); @@ -191,7 +191,7 @@ template class SharedLockable { public: - tracy_force_inline SharedLockable( const SourceLocation* srcloc ) + tracy_force_inline SharedLockable( const SourceLocationData* srcloc ) : m_id( s_lockCounter.fetch_add( 1, std::memory_order_relaxed ) ) #ifdef TRACY_ON_DEMAND , m_lockCount( 0 ) @@ -433,7 +433,7 @@ public: return ret; } - tracy_force_inline void Mark( const SourceLocation* srcloc ) + tracy_force_inline void Mark( const SourceLocationData* srcloc ) { #ifdef TRACY_ON_DEMAND const auto active = m_active.load( std::memory_order_relaxed ); diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 4b0357e6..464e3aa6 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -629,7 +629,7 @@ void Profiler::SendString( uint64_t str, const char* ptr, QueueType type ) void Profiler::SendSourceLocation( uint64_t ptr ) { - auto srcloc = (const SourceLocation*)ptr; + auto srcloc = (const SourceLocationData*)ptr; QueueItem item; MemWrite( &item.hdr.type, QueueType::SourceLocation ); MemWrite( &item.srcloc.name, (uint64_t)srcloc->name ); @@ -797,7 +797,7 @@ void Profiler::CalibrateTimer() class FakeZone { public: - FakeZone( const SourceLocation* srcloc ) : m_id( (uint64_t)srcloc ) {} + FakeZone( const SourceLocationData* srcloc ) : m_id( (uint64_t)srcloc ) {} ~FakeZone() {} private: @@ -814,7 +814,7 @@ void Profiler::CalibrateDelay() moodycamel::ConcurrentQueue::ExplicitProducer* ptoken = s_queue.get_explicit_producer( ptoken_detail ); for( int i=0; iget_tail_index(); @@ -850,13 +850,13 @@ void Profiler::CalibrateDelay() const auto f0 = GetTime(); for( int i=0; iget_tail_index(); diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 3d50ea12..d51bc124 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -37,7 +37,7 @@ namespace tracy class Socket; -struct SourceLocation +struct SourceLocationData { const char* name; const char* function; diff --git a/client/TracyScoped.hpp b/client/TracyScoped.hpp index b0dc13ae..2c6255f8 100644 --- a/client/TracyScoped.hpp +++ b/client/TracyScoped.hpp @@ -15,7 +15,7 @@ namespace tracy class ScopedZone { public: - tracy_force_inline ScopedZone( const SourceLocation* srcloc ) + tracy_force_inline ScopedZone( const SourceLocationData* srcloc ) #ifdef TRACY_ON_DEMAND : m_active( s_profiler.IsConnected() ) #endif @@ -42,7 +42,7 @@ public: tail.store( magic + 1, std::memory_order_release ); } - tracy_force_inline ScopedZone( const SourceLocation* srcloc, int depth ) + tracy_force_inline ScopedZone( const SourceLocationData* srcloc, int depth ) #ifdef TRACY_ON_DEMAND : m_active( s_profiler.IsConnected() ) #endif