Add support for Tracy profiler on Linux
This commit is contained in:
@@ -32,6 +32,7 @@ public class Profiler : EngineModule
|
|||||||
switch (options.Platform.Target)
|
switch (options.Platform.Target)
|
||||||
{
|
{
|
||||||
case TargetPlatform.Android: // dlopen failed: cannot locate symbol `tracy::ScopedZone::~ScopedZone()` referenced by "libFlaxGame.so"
|
case TargetPlatform.Android: // dlopen failed: cannot locate symbol `tracy::ScopedZone::~ScopedZone()` referenced by "libFlaxGame.so"
|
||||||
|
case TargetPlatform.Linux:
|
||||||
case TargetPlatform.Windows:
|
case TargetPlatform.Windows:
|
||||||
options.PublicDependencies.Add("tracy");
|
options.PublicDependencies.Add("tracy");
|
||||||
break;
|
break;
|
||||||
|
|||||||
28
Source/ThirdParty/tracy/client/TracyScoped.hpp
vendored
28
Source/ThirdParty/tracy/client/TracyScoped.hpp
vendored
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
inline void ScopedZone::Begin(uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const Char* name, size_t nameSz)
|
void ScopedZone::Begin(uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const Char* name, size_t nameSz)
|
||||||
{
|
{
|
||||||
TracyLfqPrepare( QueueType::ZoneBeginAllocSrcLoc );
|
TracyLfqPrepare( QueueType::ZoneBeginAllocSrcLoc );
|
||||||
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz );
|
const auto srcloc = Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz );
|
||||||
@@ -21,14 +21,14 @@ inline void ScopedZone::Begin(uint32_t line, const char* source, size_t sourceSz
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ScopedZone::End()
|
void ScopedZone::End()
|
||||||
{
|
{
|
||||||
TracyLfqPrepare( QueueType::ZoneEnd );
|
TracyLfqPrepare( QueueType::ZoneEnd );
|
||||||
MemWrite( &item->zoneEnd.time, Profiler::GetTime() );
|
MemWrite( &item->zoneEnd.time, Profiler::GetTime() );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ScopedZone::ScopedZone( const SourceLocationData* srcloc, bool is_active )
|
ScopedZone::ScopedZone( const SourceLocationData* srcloc, bool is_active )
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
: m_active( is_active && GetProfiler().IsConnected() )
|
||||||
#else
|
#else
|
||||||
@@ -45,7 +45,7 @@ inline ScopedZone::ScopedZone( const SourceLocationData* srcloc, bool is_active
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ScopedZone::ScopedZone( const SourceLocationData* srcloc, int depth, bool is_active )
|
ScopedZone::ScopedZone( const SourceLocationData* srcloc, int depth, bool is_active )
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
: m_active( is_active && GetProfiler().IsConnected() )
|
||||||
#else
|
#else
|
||||||
@@ -64,7 +64,7 @@ inline ScopedZone::ScopedZone( const SourceLocationData* srcloc, int depth, bool
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, bool is_active )
|
ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, bool is_active )
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
: m_active( is_active && GetProfiler().IsConnected() )
|
||||||
#else
|
#else
|
||||||
@@ -82,7 +82,7 @@ inline ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceS
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, int depth, bool is_active )
|
ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceSz, const char* function, size_t functionSz, const char* name, size_t nameSz, int depth, bool is_active )
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
: m_active( is_active && GetProfiler().IsConnected() )
|
: m_active( is_active && GetProfiler().IsConnected() )
|
||||||
#else
|
#else
|
||||||
@@ -102,7 +102,7 @@ inline ScopedZone::ScopedZone( uint32_t line, const char* source, size_t sourceS
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ScopedZone::~ScopedZone()
|
ScopedZone::~ScopedZone()
|
||||||
{
|
{
|
||||||
if( !m_active ) return;
|
if( !m_active ) return;
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
@@ -113,7 +113,7 @@ inline ScopedZone::~ScopedZone()
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ScopedZone::Text( const char* txt, size_t size )
|
void ScopedZone::Text( const char* txt, size_t size )
|
||||||
{
|
{
|
||||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||||
if( !m_active ) return;
|
if( !m_active ) return;
|
||||||
@@ -128,7 +128,7 @@ inline void ScopedZone::Text( const char* txt, size_t size )
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ScopedZone::Text(const Char* txt, size_t size)
|
void ScopedZone::Text(const Char* txt, size_t size)
|
||||||
{
|
{
|
||||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||||
if( !m_active ) return;
|
if( !m_active ) return;
|
||||||
@@ -144,7 +144,7 @@ inline void ScopedZone::Text(const Char* txt, size_t size)
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ScopedZone::Name( const char* txt, size_t size )
|
void ScopedZone::Name( const char* txt, size_t size )
|
||||||
{
|
{
|
||||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||||
if( !m_active ) return;
|
if( !m_active ) return;
|
||||||
@@ -159,7 +159,7 @@ inline void ScopedZone::Name( const char* txt, size_t size )
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ScopedZone::Name( const Char* txt, size_t size )
|
void ScopedZone::Name( const Char* txt, size_t size )
|
||||||
{
|
{
|
||||||
assert( size < std::numeric_limits<uint16_t>::max() );
|
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||||
if( !m_active ) return;
|
if( !m_active ) return;
|
||||||
@@ -175,7 +175,7 @@ inline void ScopedZone::Name( const Char* txt, size_t size )
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ScopedZone::Color( uint32_t color )
|
void ScopedZone::Color( uint32_t color )
|
||||||
{
|
{
|
||||||
if( !m_active ) return;
|
if( !m_active ) return;
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
@@ -188,7 +188,7 @@ inline void ScopedZone::Color( uint32_t color )
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void ScopedZone::Value( uint64_t value )
|
void ScopedZone::Value( uint64_t value )
|
||||||
{
|
{
|
||||||
if( !m_active ) return;
|
if( !m_active ) return;
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
@@ -199,7 +199,7 @@ inline void ScopedZone::Value( uint64_t value )
|
|||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool ScopedZone::IsActive() const { return m_active; }
|
bool ScopedZone::IsActive() const { return m_active; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user