1
0
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:
Bartosz Taudul
2020-03-08 13:47:38 +01:00
parent 0fe606dd8b
commit e7240cb77d
9 changed files with 88 additions and 2 deletions
+1
View File
@@ -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;
+1 -1
View File
@@ -7,7 +7,7 @@ namespace Version
{
enum { Major = 0 };
enum { Minor = 6 };
enum { Patch = 5 };
enum { Patch = 6 };
}
}
+22
View File
@@ -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 ) );
+1
View File
@@ -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 );