1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Allow adding custom colors to zones.

This commit is contained in:
Bartosz Taudul
2017-09-25 22:46:14 +02:00
parent 93fc85a639
commit 519cb8dff3
6 changed files with 17 additions and 9 deletions
+5 -1
View File
@@ -4,6 +4,8 @@
#ifdef TRACY_DISABLE
#define ZoneScoped
#define ZoneScopedC(x)
#define FrameMark
#else
@@ -11,7 +13,9 @@
#include "TracyProfiler.hpp"
#include "TracyScoped.hpp"
#define ZoneScoped tracy::ScopedZone ___tracy_scoped_zone( __FILE__, __FUNCTION__, __LINE__ );
#define ZoneScoped tracy::ScopedZone ___tracy_scoped_zone( __FILE__, __FUNCTION__, __LINE__, 0 );
#define ZoneScopedC( color ) tracy::ScopedZone ___tracy_scoped_zone( __FILE__, __FUNCTION__, __LINE__, color );
#define FrameMark tracy::Profiler::FrameMark();
#endif
+4 -4
View File
@@ -288,7 +288,7 @@ void Profiler::CalibrateTimer()
class FakeZone
{
public:
FakeZone( const char* file, const char* function, uint32_t line ) {}
FakeZone( const char* file, const char* function, uint32_t line, uint32_t color ) {}
~FakeZone() {}
private:
@@ -302,17 +302,17 @@ void Profiler::CalibrateDelay()
static_assert( Events * 2 < QueuePrealloc, "Delay calibration loop will allocate memory in queue" );
for( int i=0; i<Iterations; i++ )
{
ScopedZone ___tracy_scoped_zone( __FILE__, __FUNCTION__, __LINE__ );
ScopedZone ___tracy_scoped_zone( __FILE__, __FUNCTION__, __LINE__, 0 );
}
const auto f0 = GetTime();
for( int i=0; i<Iterations; i++ )
{
FakeZone ___tracy_scoped_zone( __FILE__, __FUNCTION__, __LINE__ );
FakeZone ___tracy_scoped_zone( __FILE__, __FUNCTION__, __LINE__, 0 );
}
const auto t0 = GetTime();
for( int i=0; i<Iterations; i++ )
{
ScopedZone ___tracy_scoped_zone( __FILE__, __FUNCTION__, __LINE__ );
ScopedZone ___tracy_scoped_zone( __FILE__, __FUNCTION__, __LINE__, 0 );
}
const auto t1 = GetTime();
const auto dt = t1 - t0;
+2 -2
View File
@@ -12,8 +12,8 @@ namespace tracy
class ScopedZone
{
public:
ScopedZone( const char* file, const char* function, uint32_t line )
: m_id( Profiler::ZoneBegin( QueueZoneBegin { Profiler::GetTime(), (uint64_t)file, (uint64_t)function, line, GetThreadHandle() } ) )
ScopedZone( const char* file, const char* function, uint32_t line, uint32_t color )
: m_id( Profiler::ZoneBegin( QueueZoneBegin { Profiler::GetTime(), (uint64_t)file, (uint64_t)function, line, GetThreadHandle(), color } ) )
{
}