mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Custom lock name transfer.
This commit is contained in:
@@ -533,6 +533,7 @@ struct LockMap
|
||||
int64_t end = std::numeric_limits<int64_t>::min();
|
||||
};
|
||||
|
||||
StringIdx customName;
|
||||
int16_t srcloc;
|
||||
Vector<LockEventPtr> timeline;
|
||||
unordered_flat_map<uint64_t, uint8_t> threadMap;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Version
|
||||
{
|
||||
enum { Major = 0 };
|
||||
enum { Minor = 6 };
|
||||
enum { Patch = 5 };
|
||||
enum { Patch = 6 };
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -718,6 +718,10 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
uint32_t id;
|
||||
uint64_t tsz;
|
||||
f.Read( id );
|
||||
if( fileVer >= FileVersion( 0, 6, 6 ) )
|
||||
{
|
||||
f.Read( lockmap.customName );
|
||||
}
|
||||
if( fileVer >= FileVersion( 0, 5, 2 ) )
|
||||
{
|
||||
f.Read( lockmap.srcloc );
|
||||
@@ -832,6 +836,10 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
||||
{
|
||||
LockType type;
|
||||
uint64_t tsz;
|
||||
if( fileVer >= FileVersion( 0, 6, 6 ) )
|
||||
{
|
||||
f.Skip( sizeof( LockMap::customName ) );
|
||||
}
|
||||
if( fileVer >= FileVersion( 0, 5, 2 ) )
|
||||
{
|
||||
f.Skip( sizeof( uint32_t ) + sizeof( LockMap::srcloc ) );
|
||||
@@ -3476,6 +3484,9 @@ bool Worker::Process( const QueueItem& ev )
|
||||
case QueueType::LockMark:
|
||||
ProcessLockMark( ev.lockMark );
|
||||
break;
|
||||
case QueueType::LockName:
|
||||
ProcessLockName( ev.lockName );
|
||||
break;
|
||||
case QueueType::PlotData:
|
||||
ProcessPlotData( ev.plotData );
|
||||
break;
|
||||
@@ -4223,6 +4234,16 @@ void Worker::ProcessLockMark( const QueueLockMark& ev )
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::ProcessLockName( const QueueLockName& ev )
|
||||
{
|
||||
auto lit = m_data.lockMap.find( ev.id );
|
||||
assert( lit != m_data.lockMap.end() );
|
||||
auto it = m_pendingCustomStrings.find( ev.name );
|
||||
assert( it != m_pendingCustomStrings.end() );
|
||||
lit->second->customName = StringIdx( it->second.idx );
|
||||
m_pendingCustomStrings.erase( it );
|
||||
}
|
||||
|
||||
void Worker::ProcessPlotData( const QueuePlotData& ev )
|
||||
{
|
||||
PlotData* plot = m_data.plots.Retrieve( ev.name, [this] ( uint64_t name ) {
|
||||
@@ -6011,6 +6032,7 @@ void Worker::Write( FileWrite& f )
|
||||
for( auto& v : m_data.lockMap )
|
||||
{
|
||||
f.Write( &v.first, sizeof( v.first ) );
|
||||
f.Write( &v.second->customName, sizeof( v.second->customName ) );
|
||||
f.Write( &v.second->srcloc, sizeof( v.second->srcloc ) );
|
||||
f.Write( &v.second->type, sizeof( v.second->type ) );
|
||||
f.Write( &v.second->valid, sizeof( v.second->valid ) );
|
||||
|
||||
@@ -523,6 +523,7 @@ private:
|
||||
tracy_force_inline void ProcessLockSharedObtain( const QueueLockObtain& ev );
|
||||
tracy_force_inline void ProcessLockSharedRelease( const QueueLockRelease& ev );
|
||||
tracy_force_inline void ProcessLockMark( const QueueLockMark& ev );
|
||||
tracy_force_inline void ProcessLockName( const QueueLockName& ev );
|
||||
tracy_force_inline void ProcessPlotData( const QueuePlotData& ev );
|
||||
tracy_force_inline void ProcessPlotConfig( const QueuePlotConfig& ev );
|
||||
tracy_force_inline void ProcessMessage( const QueueMessage& ev );
|
||||
|
||||
Reference in New Issue
Block a user