mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 09:14:36 +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 )
|
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 );
|
memcpy( ptr, name, size );
|
||||||
ptr[size] = '\0';
|
|
||||||
TracyLfqPrepare( QueueType::LockName );
|
TracyLfqPrepare( QueueType::LockName );
|
||||||
MemWrite( &item->lockName.id, m_id );
|
MemWrite( &item->lockNameFat.id, m_id );
|
||||||
MemWrite( &item->lockName.name, (uint64_t)ptr );
|
MemWrite( &item->lockNameFat.name, (uint64_t)ptr );
|
||||||
|
MemWrite( &item->lockNameFat.size, (uint16_t)size );
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().DeferItem( *item );
|
GetProfiler().DeferItem( *item );
|
||||||
#endif
|
#endif
|
||||||
@ -455,12 +456,13 @@ public:
|
|||||||
|
|
||||||
tracy_force_inline void CustomName( const char* name, size_t size )
|
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 );
|
memcpy( ptr, name, size );
|
||||||
ptr[size] = '\0';
|
|
||||||
TracyLfqPrepare( QueueType::LockName );
|
TracyLfqPrepare( QueueType::LockName );
|
||||||
MemWrite( &item->lockName.id, m_id );
|
MemWrite( &item->lockNameFat.id, m_id );
|
||||||
MemWrite( &item->lockName.name, (uint64_t)ptr );
|
MemWrite( &item->lockNameFat.name, (uint64_t)ptr );
|
||||||
|
MemWrite( &item->lockNameFat.size, (uint16_t)size );
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
GetProfiler().DeferItem( *item );
|
GetProfiler().DeferItem( *item );
|
||||||
#endif
|
#endif
|
||||||
|
@ -1457,8 +1457,9 @@ void Profiler::Worker()
|
|||||||
SendSingleString( (const char*)ptr, size );
|
SendSingleString( (const char*)ptr, size );
|
||||||
break;
|
break;
|
||||||
case QueueType::LockName:
|
case QueueType::LockName:
|
||||||
ptr = MemRead<uint64_t>( &item.lockName.name );
|
ptr = MemRead<uint64_t>( &item.lockNameFat.name );
|
||||||
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
|
size = MemRead<uint16_t>( &item.lockNameFat.size );
|
||||||
|
SendSingleString( (const char*)ptr, size );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1754,7 +1755,7 @@ static void FreeAssociatedMemory( const QueueItem& item )
|
|||||||
break;
|
break;
|
||||||
#ifndef TRACY_ON_DEMAND
|
#ifndef TRACY_ON_DEMAND
|
||||||
case QueueType::LockName:
|
case QueueType::LockName:
|
||||||
ptr = MemRead<uint64_t>( &item.lockName.name );
|
ptr = MemRead<uint64_t>( &item.lockNameFat.name );
|
||||||
tracy_free( (void*)ptr );
|
tracy_free( (void*)ptr );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
@ -1940,8 +1941,9 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QueueType::LockName:
|
case QueueType::LockName:
|
||||||
ptr = MemRead<uint64_t>( &item->lockName.name );
|
ptr = MemRead<uint64_t>( &item->lockNameFat.name );
|
||||||
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
|
size = MemRead<uint16_t>( &item->lockNameFat.size );
|
||||||
|
SendSingleString( (const char*)ptr, size );
|
||||||
#ifndef TRACY_ON_DEMAND
|
#ifndef TRACY_ON_DEMAND
|
||||||
tracy_free( (void*)ptr );
|
tracy_free( (void*)ptr );
|
||||||
#endif
|
#endif
|
||||||
|
@ -225,7 +225,12 @@ struct QueueLockMark
|
|||||||
struct QueueLockName
|
struct QueueLockName
|
||||||
{
|
{
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct QueueLockNameFat : public QueueLockName
|
||||||
|
{
|
||||||
uint64_t name; // ptr
|
uint64_t name; // ptr
|
||||||
|
uint16_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PlotDataType : uint8_t
|
enum class PlotDataType : uint8_t
|
||||||
@ -503,6 +508,7 @@ struct QueueItem
|
|||||||
QueueLockRelease lockRelease;
|
QueueLockRelease lockRelease;
|
||||||
QueueLockMark lockMark;
|
QueueLockMark lockMark;
|
||||||
QueueLockName lockName;
|
QueueLockName lockName;
|
||||||
|
QueueLockNameFat lockNameFat;
|
||||||
QueuePlotData plotData;
|
QueuePlotData plotData;
|
||||||
QueueMessage message;
|
QueueMessage message;
|
||||||
QueueMessageColor messageColor;
|
QueueMessageColor messageColor;
|
||||||
|
@ -4755,10 +4755,7 @@ void Worker::ProcessLockName( const QueueLockName& ev )
|
|||||||
{
|
{
|
||||||
auto lit = m_data.lockMap.find( ev.id );
|
auto lit = m_data.lockMap.find( ev.id );
|
||||||
assert( lit != m_data.lockMap.end() );
|
assert( lit != m_data.lockMap.end() );
|
||||||
auto it = m_pendingCustomStrings.find( ev.name );
|
lit->second->customName = StringIdx( GetSingleStringIdx() );
|
||||||
assert( it != m_pendingCustomStrings.end() );
|
|
||||||
lit->second->customName = StringIdx( it->second.idx );
|
|
||||||
m_pendingCustomStrings.erase( it );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Worker::ProcessPlotData( const QueuePlotData& ev )
|
void Worker::ProcessPlotData( const QueuePlotData& ev )
|
||||||
|
Loading…
Reference in New Issue
Block a user