mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Store zone color in source location struct.
This commit is contained in:
+2
-2
@@ -13,8 +13,8 @@
|
||||
#include "TracyProfiler.hpp"
|
||||
#include "TracyScoped.hpp"
|
||||
|
||||
#define ZoneScoped static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__ }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location, 0 );
|
||||
#define ZoneScopedC( color ) static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__ }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location, color );
|
||||
#define ZoneScoped static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__, 0 }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
|
||||
#define ZoneScopedC( color ) static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__, color }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
|
||||
|
||||
#define FrameMark tracy::Profiler::FrameMark();
|
||||
|
||||
|
||||
@@ -225,6 +225,7 @@ bool Profiler::SendSourceLocation( uint64_t ptr )
|
||||
item.srcloc.file = (uint64_t)srcloc->file;
|
||||
item.srcloc.function = (uint64_t)srcloc->function;
|
||||
item.srcloc.line = srcloc->line;
|
||||
item.srcloc.color = srcloc->color;
|
||||
|
||||
const auto sz = QueueDataSize[item.hdr.idx];
|
||||
|
||||
@@ -301,7 +302,7 @@ void Profiler::CalibrateTimer()
|
||||
class FakeZone
|
||||
{
|
||||
public:
|
||||
FakeZone( const SourceLocation* srcloc, uint32_t color ) {}
|
||||
FakeZone( const SourceLocation* srcloc ) {}
|
||||
~FakeZone() {}
|
||||
|
||||
private:
|
||||
@@ -315,20 +316,20 @@ void Profiler::CalibrateDelay()
|
||||
static_assert( Events * 2 < QueuePrealloc, "Delay calibration loop will allocate memory in queue" );
|
||||
for( int i=0; i<Iterations; i++ )
|
||||
{
|
||||
static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__ };
|
||||
ScopedZone ___tracy_scoped_zone( &__tracy_source_location, 0 );
|
||||
static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__, 0 };
|
||||
ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
|
||||
}
|
||||
const auto f0 = GetTime();
|
||||
for( int i=0; i<Iterations; i++ )
|
||||
{
|
||||
static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__ };
|
||||
FakeZone ___tracy_scoped_zone( &__tracy_source_location, 0 );
|
||||
static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__, 0 };
|
||||
FakeZone ___tracy_scoped_zone( &__tracy_source_location );
|
||||
}
|
||||
const auto t0 = GetTime();
|
||||
for( int i=0; i<Iterations; i++ )
|
||||
{
|
||||
static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__ };
|
||||
ScopedZone ___tracy_scoped_zone( &__tracy_source_location, 0 );
|
||||
static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, __LINE__, 0 };
|
||||
ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
|
||||
}
|
||||
const auto t1 = GetTime();
|
||||
const auto dt = t1 - t0;
|
||||
|
||||
@@ -23,6 +23,7 @@ struct SourceLocation
|
||||
const char* function;
|
||||
const char* file;
|
||||
uint32_t line;
|
||||
uint32_t color;
|
||||
};
|
||||
|
||||
class Profiler
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace tracy
|
||||
class ScopedZone
|
||||
{
|
||||
public:
|
||||
ScopedZone( const SourceLocation* srcloc, uint32_t color )
|
||||
: m_id( Profiler::ZoneBegin( QueueZoneBegin { Profiler::GetTime(), (uint64_t)srcloc, GetThreadHandle(), color } ) )
|
||||
ScopedZone( const SourceLocation* srcloc )
|
||||
: m_id( Profiler::ZoneBegin( QueueZoneBegin { Profiler::GetTime(), (uint64_t)srcloc, GetThreadHandle() } ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user