mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 16:54:35 +00:00
Use separate messages for transfer of different plot value types.
This commit is contained in:
parent
aeedf7de2d
commit
810f1573ac
@ -2400,12 +2400,14 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
|||||||
tracy_free_fast( (void*)ptr );
|
tracy_free_fast( (void*)ptr );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case QueueType::PlotData:
|
case QueueType::PlotDataInt:
|
||||||
|
case QueueType::PlotDataFloat:
|
||||||
|
case QueueType::PlotDataDouble:
|
||||||
{
|
{
|
||||||
int64_t t = MemRead<int64_t>( &item->plotData.time );
|
int64_t t = MemRead<int64_t>( &item->plotDataInt.time );
|
||||||
int64_t dt = t - refThread;
|
int64_t dt = t - refThread;
|
||||||
refThread = t;
|
refThread = t;
|
||||||
MemWrite( &item->plotData.time, dt );
|
MemWrite( &item->plotDataInt.time, dt );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QueueType::ContextSwitch:
|
case QueueType::ContextSwitch:
|
||||||
|
@ -311,11 +311,10 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
TracyLfqPrepare( QueueType::PlotData );
|
TracyLfqPrepare( QueueType::PlotDataInt );
|
||||||
MemWrite( &item->plotData.name, (uint64_t)name );
|
MemWrite( &item->plotDataInt.name, (uint64_t)name );
|
||||||
MemWrite( &item->plotData.time, GetTime() );
|
MemWrite( &item->plotDataInt.time, GetTime() );
|
||||||
MemWrite( &item->plotData.type, PlotDataType::Int );
|
MemWrite( &item->plotDataInt.val, val );
|
||||||
MemWrite( &item->plotData.data.i, val );
|
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -324,11 +323,10 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
TracyLfqPrepare( QueueType::PlotData );
|
TracyLfqPrepare( QueueType::PlotDataFloat );
|
||||||
MemWrite( &item->plotData.name, (uint64_t)name );
|
MemWrite( &item->plotDataFloat.name, (uint64_t)name );
|
||||||
MemWrite( &item->plotData.time, GetTime() );
|
MemWrite( &item->plotDataFloat.time, GetTime() );
|
||||||
MemWrite( &item->plotData.type, PlotDataType::Float );
|
MemWrite( &item->plotDataFloat.val, val );
|
||||||
MemWrite( &item->plotData.data.f, val );
|
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,11 +335,10 @@ public:
|
|||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
TracyLfqPrepare( QueueType::PlotData );
|
TracyLfqPrepare( QueueType::PlotDataDouble );
|
||||||
MemWrite( &item->plotData.name, (uint64_t)name );
|
MemWrite( &item->plotDataDouble.name, (uint64_t)name );
|
||||||
MemWrite( &item->plotData.time, GetTime() );
|
MemWrite( &item->plotDataDouble.time, GetTime() );
|
||||||
MemWrite( &item->plotData.type, PlotDataType::Double );
|
MemWrite( &item->plotDataDouble.val, val );
|
||||||
MemWrite( &item->plotData.data.d, val );
|
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ namespace tracy
|
|||||||
|
|
||||||
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
|
constexpr unsigned Lz4CompressBound( unsigned isize ) { return isize + ( isize / 255 ) + 16; }
|
||||||
|
|
||||||
enum : uint32_t { ProtocolVersion = 58 };
|
enum : uint32_t { ProtocolVersion = 59 };
|
||||||
enum : uint16_t { BroadcastVersion = 2 };
|
enum : uint16_t { BroadcastVersion = 2 };
|
||||||
|
|
||||||
using lz4sz_t = uint32_t;
|
using lz4sz_t = uint32_t;
|
||||||
|
@ -52,7 +52,9 @@ enum class QueueType : uint8_t
|
|||||||
GpuZoneBeginAllocSrcLocSerial,
|
GpuZoneBeginAllocSrcLocSerial,
|
||||||
GpuZoneBeginAllocSrcLocCallstackSerial,
|
GpuZoneBeginAllocSrcLocCallstackSerial,
|
||||||
GpuZoneEndSerial,
|
GpuZoneEndSerial,
|
||||||
PlotData,
|
PlotDataInt,
|
||||||
|
PlotDataFloat,
|
||||||
|
PlotDataDouble,
|
||||||
ContextSwitch,
|
ContextSwitch,
|
||||||
ThreadWakeup,
|
ThreadWakeup,
|
||||||
GpuTime,
|
GpuTime,
|
||||||
@ -305,24 +307,25 @@ struct QueueLockNameFat : public QueueLockName
|
|||||||
uint16_t size;
|
uint16_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PlotDataType : uint8_t
|
struct QueuePlotDataBase
|
||||||
{
|
|
||||||
Float,
|
|
||||||
Double,
|
|
||||||
Int
|
|
||||||
};
|
|
||||||
|
|
||||||
struct QueuePlotData
|
|
||||||
{
|
{
|
||||||
uint64_t name; // ptr
|
uint64_t name; // ptr
|
||||||
int64_t time;
|
int64_t time;
|
||||||
PlotDataType type;
|
};
|
||||||
union
|
|
||||||
{
|
struct QueuePlotDataInt : public QueuePlotDataBase
|
||||||
double d;
|
{
|
||||||
float f;
|
int64_t val;
|
||||||
int64_t i;
|
};
|
||||||
} data;
|
|
||||||
|
struct QueuePlotDataFloat : public QueuePlotDataBase
|
||||||
|
{
|
||||||
|
float val;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct QueuePlotDataDouble : public QueuePlotDataBase
|
||||||
|
{
|
||||||
|
double val;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QueueMessage
|
struct QueueMessage
|
||||||
@ -678,7 +681,9 @@ struct QueueItem
|
|||||||
QueueLockMark lockMark;
|
QueueLockMark lockMark;
|
||||||
QueueLockName lockName;
|
QueueLockName lockName;
|
||||||
QueueLockNameFat lockNameFat;
|
QueueLockNameFat lockNameFat;
|
||||||
QueuePlotData plotData;
|
QueuePlotDataInt plotDataInt;
|
||||||
|
QueuePlotDataFloat plotDataFloat;
|
||||||
|
QueuePlotDataDouble plotDataDouble;
|
||||||
QueueMessage message;
|
QueueMessage message;
|
||||||
QueueMessageColor messageColor;
|
QueueMessageColor messageColor;
|
||||||
QueueMessageLiteral messageLiteral;
|
QueueMessageLiteral messageLiteral;
|
||||||
@ -778,7 +783,9 @@ static constexpr size_t QueueDataSize[] = {
|
|||||||
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBeginLean ),// serial, allocated source location
|
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBeginLean ),// serial, allocated source location
|
||||||
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBeginLean ),// serial, allocated source location, callstack
|
sizeof( QueueHeader ) + sizeof( QueueGpuZoneBeginLean ),// serial, allocated source location, callstack
|
||||||
sizeof( QueueHeader ) + sizeof( QueueGpuZoneEnd ), // serial
|
sizeof( QueueHeader ) + sizeof( QueueGpuZoneEnd ), // serial
|
||||||
sizeof( QueueHeader ) + sizeof( QueuePlotData ),
|
sizeof( QueueHeader ) + sizeof( QueuePlotDataInt ),
|
||||||
|
sizeof( QueueHeader ) + sizeof( QueuePlotDataFloat ),
|
||||||
|
sizeof( QueueHeader ) + sizeof( QueuePlotDataDouble ),
|
||||||
sizeof( QueueHeader ) + sizeof( QueueContextSwitch ),
|
sizeof( QueueHeader ) + sizeof( QueueContextSwitch ),
|
||||||
sizeof( QueueHeader ) + sizeof( QueueThreadWakeup ),
|
sizeof( QueueHeader ) + sizeof( QueueThreadWakeup ),
|
||||||
sizeof( QueueHeader ) + sizeof( QueueGpuTime ),
|
sizeof( QueueHeader ) + sizeof( QueueGpuTime ),
|
||||||
|
@ -4718,8 +4718,14 @@ bool Worker::Process( const QueueItem& ev )
|
|||||||
case QueueType::LockName:
|
case QueueType::LockName:
|
||||||
ProcessLockName( ev.lockName );
|
ProcessLockName( ev.lockName );
|
||||||
break;
|
break;
|
||||||
case QueueType::PlotData:
|
case QueueType::PlotDataInt:
|
||||||
ProcessPlotData( ev.plotData );
|
ProcessPlotDataInt( ev.plotDataInt );
|
||||||
|
break;
|
||||||
|
case QueueType::PlotDataFloat:
|
||||||
|
ProcessPlotDataFloat( ev.plotDataFloat );
|
||||||
|
break;
|
||||||
|
case QueueType::PlotDataDouble:
|
||||||
|
ProcessPlotDataDouble( ev.plotDataDouble );
|
||||||
break;
|
break;
|
||||||
case QueueType::PlotConfig:
|
case QueueType::PlotConfig:
|
||||||
ProcessPlotConfig( ev.plotConfig );
|
ProcessPlotConfig( ev.plotConfig );
|
||||||
@ -5637,21 +5643,26 @@ void Worker::ProcessLockName( const QueueLockName& ev )
|
|||||||
lit->second->customName = StringIdx( GetSingleStringIdx() );
|
lit->second->customName = StringIdx( GetSingleStringIdx() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::ProcessPlotData( const QueuePlotData& ev )
|
void Worker::ProcessPlotDataInt( const QueuePlotDataInt& ev )
|
||||||
{
|
{
|
||||||
switch( ev.type )
|
ProcessPlotDataImpl( ev.name, ev.time, (double)ev.val );
|
||||||
{
|
}
|
||||||
case PlotDataType::Double:
|
|
||||||
if( !isfinite( ev.data.d ) ) return;
|
|
||||||
break;
|
|
||||||
case PlotDataType::Float:
|
|
||||||
if( !isfinite( ev.data.f ) ) return;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlotData* plot = m_data.plots.Retrieve( ev.name, [this] ( uint64_t name ) {
|
void Worker::ProcessPlotDataFloat( const QueuePlotDataFloat& ev )
|
||||||
|
{
|
||||||
|
if( !isfinite( ev.val ) ) return;
|
||||||
|
ProcessPlotDataImpl( ev.name, ev.time, (double)ev.val );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Worker::ProcessPlotDataDouble( const QueuePlotDataDouble& ev )
|
||||||
|
{
|
||||||
|
if( !isfinite( ev.val ) ) return;
|
||||||
|
ProcessPlotDataImpl( ev.name, ev.time, ev.val );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Worker::ProcessPlotDataImpl( uint64_t name, int64_t evTime, double val )
|
||||||
|
{
|
||||||
|
PlotData* plot = m_data.plots.Retrieve( name, [this] ( uint64_t name ) {
|
||||||
auto plot = m_slab.AllocInit<PlotData>();
|
auto plot = m_slab.AllocInit<PlotData>();
|
||||||
plot->name = name;
|
plot->name = name;
|
||||||
plot->type = PlotType::User;
|
plot->type = PlotType::User;
|
||||||
@ -5662,23 +5673,9 @@ void Worker::ProcessPlotData( const QueuePlotData& ev )
|
|||||||
Query( ServerQueryPlotName, name );
|
Query( ServerQueryPlotName, name );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
const auto time = TscTime( RefTime( m_refTimeThread, ev.time ) );
|
const auto time = TscTime( RefTime( m_refTimeThread, evTime ) );
|
||||||
if( m_data.lastTime < time ) m_data.lastTime = time;
|
if( m_data.lastTime < time ) m_data.lastTime = time;
|
||||||
switch( ev.type )
|
InsertPlot( plot, time, val );
|
||||||
{
|
|
||||||
case PlotDataType::Double:
|
|
||||||
InsertPlot( plot, time, ev.data.d );
|
|
||||||
break;
|
|
||||||
case PlotDataType::Float:
|
|
||||||
InsertPlot( plot, time, (double)ev.data.f );
|
|
||||||
break;
|
|
||||||
case PlotDataType::Int:
|
|
||||||
InsertPlot( plot, time, (double)ev.data.i );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert( false );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::ProcessPlotConfig( const QueuePlotConfig& ev )
|
void Worker::ProcessPlotConfig( const QueuePlotConfig& ev )
|
||||||
|
@ -698,7 +698,9 @@ private:
|
|||||||
tracy_force_inline void ProcessLockSharedRelease( const QueueLockReleaseShared& ev );
|
tracy_force_inline void ProcessLockSharedRelease( const QueueLockReleaseShared& ev );
|
||||||
tracy_force_inline void ProcessLockMark( const QueueLockMark& ev );
|
tracy_force_inline void ProcessLockMark( const QueueLockMark& ev );
|
||||||
tracy_force_inline void ProcessLockName( const QueueLockName& ev );
|
tracy_force_inline void ProcessLockName( const QueueLockName& ev );
|
||||||
tracy_force_inline void ProcessPlotData( const QueuePlotData& ev );
|
tracy_force_inline void ProcessPlotDataInt( const QueuePlotDataInt& ev );
|
||||||
|
tracy_force_inline void ProcessPlotDataFloat( const QueuePlotDataFloat& ev );
|
||||||
|
tracy_force_inline void ProcessPlotDataDouble( const QueuePlotDataDouble& ev );
|
||||||
tracy_force_inline void ProcessPlotConfig( const QueuePlotConfig& ev );
|
tracy_force_inline void ProcessPlotConfig( const QueuePlotConfig& ev );
|
||||||
tracy_force_inline void ProcessMessage( const QueueMessage& ev );
|
tracy_force_inline void ProcessMessage( const QueueMessage& ev );
|
||||||
tracy_force_inline void ProcessMessageLiteral( const QueueMessageLiteral& ev );
|
tracy_force_inline void ProcessMessageLiteral( const QueueMessageLiteral& ev );
|
||||||
@ -757,6 +759,7 @@ private:
|
|||||||
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev, bool serial );
|
tracy_force_inline void ProcessGpuZoneBeginImpl( GpuEvent* zone, const QueueGpuZoneBegin& ev, bool serial );
|
||||||
tracy_force_inline void ProcessGpuZoneBeginAllocSrcLocImpl( GpuEvent* zone, const QueueGpuZoneBeginLean& ev, bool serial );
|
tracy_force_inline void ProcessGpuZoneBeginAllocSrcLocImpl( GpuEvent* zone, const QueueGpuZoneBeginLean& ev, bool serial );
|
||||||
tracy_force_inline void ProcessGpuZoneBeginImplCommon( GpuEvent* zone, const QueueGpuZoneBeginLean& ev, bool serial );
|
tracy_force_inline void ProcessGpuZoneBeginImplCommon( GpuEvent* zone, const QueueGpuZoneBeginLean& ev, bool serial );
|
||||||
|
tracy_force_inline void ProcessPlotDataImpl( uint64_t name, int64_t evTime, double val );
|
||||||
tracy_force_inline MemEvent* ProcessMemAllocImpl( uint64_t memname, MemData& memdata, const QueueMemAlloc& ev );
|
tracy_force_inline MemEvent* ProcessMemAllocImpl( uint64_t memname, MemData& memdata, const QueueMemAlloc& ev );
|
||||||
tracy_force_inline MemEvent* ProcessMemFreeImpl( uint64_t memname, MemData& memdata, const QueueMemFree& ev );
|
tracy_force_inline MemEvent* ProcessMemFreeImpl( uint64_t memname, MemData& memdata, const QueueMemFree& ev );
|
||||||
tracy_force_inline void ProcessCallstackSampleImpl( const SampleData& sd, ThreadData& td );
|
tracy_force_inline void ProcessCallstackSampleImpl( const SampleData& sd, ThreadData& td );
|
||||||
|
Loading…
Reference in New Issue
Block a user