Send single string for lock name.

This commit is contained in:
Bartosz Taudul 2020-07-26 01:22:09 +02:00
parent e91950f006
commit a7d2ab4d4f
4 changed files with 24 additions and 17 deletions

View File

@ -155,12 +155,13 @@ public:
tracy_force_inline void CustomName( const char* name, size_t size )
{
auto ptr = (char*)tracy_malloc( size+1 );
assert( size < std::numeric_limits<uint16_t>::max() );
auto ptr = (char*)tracy_malloc( size );
memcpy( ptr, name, size );
ptr[size] = '\0';
TracyLfqPrepare( QueueType::LockName );
MemWrite( &item->lockName.id, m_id );
MemWrite( &item->lockName.name, (uint64_t)ptr );
MemWrite( &item->lockNameFat.id, m_id );
MemWrite( &item->lockNameFat.name, (uint64_t)ptr );
MemWrite( &item->lockNameFat.size, (uint16_t)size );
#ifdef TRACY_ON_DEMAND
GetProfiler().DeferItem( *item );
#endif
@ -455,12 +456,13 @@ public:
tracy_force_inline void CustomName( const char* name, size_t size )
{
auto ptr = (char*)tracy_malloc( size+1 );
assert( size < std::numeric_limits<uint16_t>::max() );
auto ptr = (char*)tracy_malloc( size );
memcpy( ptr, name, size );
ptr[size] = '\0';
TracyLfqPrepare( QueueType::LockName );
MemWrite( &item->lockName.id, m_id );
MemWrite( &item->lockName.name, (uint64_t)ptr );
MemWrite( &item->lockNameFat.id, m_id );
MemWrite( &item->lockNameFat.name, (uint64_t)ptr );
MemWrite( &item->lockNameFat.size, (uint16_t)size );
#ifdef TRACY_ON_DEMAND
GetProfiler().DeferItem( *item );
#endif

View File

@ -1457,8 +1457,9 @@ void Profiler::Worker()
SendSingleString( (const char*)ptr, size );
break;
case QueueType::LockName:
ptr = MemRead<uint64_t>( &item.lockName.name );
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
ptr = MemRead<uint64_t>( &item.lockNameFat.name );
size = MemRead<uint16_t>( &item.lockNameFat.size );
SendSingleString( (const char*)ptr, size );
break;
default:
break;
@ -1754,7 +1755,7 @@ static void FreeAssociatedMemory( const QueueItem& item )
break;
#ifndef TRACY_ON_DEMAND
case QueueType::LockName:
ptr = MemRead<uint64_t>( &item.lockName.name );
ptr = MemRead<uint64_t>( &item.lockNameFat.name );
tracy_free( (void*)ptr );
break;
#endif
@ -1940,8 +1941,9 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
break;
}
case QueueType::LockName:
ptr = MemRead<uint64_t>( &item->lockName.name );
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
ptr = MemRead<uint64_t>( &item->lockNameFat.name );
size = MemRead<uint16_t>( &item->lockNameFat.size );
SendSingleString( (const char*)ptr, size );
#ifndef TRACY_ON_DEMAND
tracy_free( (void*)ptr );
#endif

View File

@ -225,7 +225,12 @@ struct QueueLockMark
struct QueueLockName
{
uint32_t id;
};
struct QueueLockNameFat : public QueueLockName
{
uint64_t name; // ptr
uint16_t size;
};
enum class PlotDataType : uint8_t
@ -503,6 +508,7 @@ struct QueueItem
QueueLockRelease lockRelease;
QueueLockMark lockMark;
QueueLockName lockName;
QueueLockNameFat lockNameFat;
QueuePlotData plotData;
QueueMessage message;
QueueMessageColor messageColor;

View File

@ -4755,10 +4755,7 @@ 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 );
lit->second->customName = StringIdx( GetSingleStringIdx() );
}
void Worker::ProcessPlotData( const QueuePlotData& ev )