mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Send single string for lock name.
This commit is contained in:
parent
e91950f006
commit
a7d2ab4d4f
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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 )
|
||||
|
Loading…
Reference in New Issue
Block a user