mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Preserve messages size.
This commit is contained in:
parent
9d01fa86ab
commit
02e7893c75
@ -372,13 +372,14 @@ static inline int LuaMessage( lua_State* L )
|
|||||||
|
|
||||||
auto txt = lua_tostring( L, 1 );
|
auto txt = lua_tostring( L, 1 );
|
||||||
const auto size = strlen( txt );
|
const auto size = strlen( txt );
|
||||||
|
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||||
|
|
||||||
TracyLfqPrepare( QueueType::Message );
|
TracyLfqPrepare( QueueType::Message );
|
||||||
auto ptr = (char*)tracy_malloc( size+1 );
|
auto ptr = (char*)tracy_malloc( size );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
MemWrite( &item->messageFat.time, Profiler::GetTime() );
|
||||||
MemWrite( &item->message.time, Profiler::GetTime() );
|
MemWrite( &item->messageFat.text, (uint64_t)ptr );
|
||||||
MemWrite( &item->message.text, (uint64_t)ptr );
|
MemWrite( &item->messageFat.size, (uint16_t)size );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1839,11 +1839,17 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
|
|||||||
tracy_free( (void*)ptr );
|
tracy_free( (void*)ptr );
|
||||||
break;
|
break;
|
||||||
case QueueType::Message:
|
case QueueType::Message:
|
||||||
case QueueType::MessageColor:
|
|
||||||
case QueueType::MessageCallstack:
|
case QueueType::MessageCallstack:
|
||||||
|
ptr = MemRead<uint64_t>( &item->messageFat.text );
|
||||||
|
size = MemRead<uint16_t>( &item->messageFat.size );
|
||||||
|
SendString( ptr, (const char*)ptr, size, QueueType::CustomStringData );
|
||||||
|
tracy_free( (void*)ptr );
|
||||||
|
break;
|
||||||
|
case QueueType::MessageColor:
|
||||||
case QueueType::MessageColorCallstack:
|
case QueueType::MessageColorCallstack:
|
||||||
ptr = MemRead<uint64_t>( &item->message.text );
|
ptr = MemRead<uint64_t>( &item->messageColorFat.text );
|
||||||
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
|
size = MemRead<uint16_t>( &item->messageColorFat.size );
|
||||||
|
SendString( ptr, (const char*)ptr, size, QueueType::CustomStringData );
|
||||||
tracy_free( (void*)ptr );
|
tracy_free( (void*)ptr );
|
||||||
break;
|
break;
|
||||||
case QueueType::MessageAppInfo:
|
case QueueType::MessageAppInfo:
|
||||||
|
@ -277,15 +277,16 @@ public:
|
|||||||
|
|
||||||
static tracy_force_inline void Message( const char* txt, size_t size, int callstack )
|
static tracy_force_inline void Message( const char* txt, size_t size, int callstack )
|
||||||
{
|
{
|
||||||
|
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
TracyLfqPrepare( callstack == 0 ? QueueType::Message : QueueType::MessageCallstack );
|
TracyLfqPrepare( callstack == 0 ? QueueType::Message : QueueType::MessageCallstack );
|
||||||
auto ptr = (char*)tracy_malloc( size+1 );
|
auto ptr = (char*)tracy_malloc( size );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
MemWrite( &item->messageFat.time, GetTime() );
|
||||||
MemWrite( &item->message.time, GetTime() );
|
MemWrite( &item->messageFat.text, (uint64_t)ptr );
|
||||||
MemWrite( &item->message.text, (uint64_t)ptr );
|
MemWrite( &item->messageFat.size, (uint16_t)size );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
|
|
||||||
if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack );
|
if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack );
|
||||||
@ -306,18 +307,19 @@ public:
|
|||||||
|
|
||||||
static tracy_force_inline void MessageColor( const char* txt, size_t size, uint32_t color, int callstack )
|
static tracy_force_inline void MessageColor( const char* txt, size_t size, uint32_t color, int callstack )
|
||||||
{
|
{
|
||||||
|
assert( size < std::numeric_limits<uint16_t>::max() );
|
||||||
#ifdef TRACY_ON_DEMAND
|
#ifdef TRACY_ON_DEMAND
|
||||||
if( !GetProfiler().IsConnected() ) return;
|
if( !GetProfiler().IsConnected() ) return;
|
||||||
#endif
|
#endif
|
||||||
TracyLfqPrepare( callstack == 0 ? QueueType::MessageColor : QueueType::MessageColorCallstack );
|
TracyLfqPrepare( callstack == 0 ? QueueType::MessageColor : QueueType::MessageColorCallstack );
|
||||||
auto ptr = (char*)tracy_malloc( size+1 );
|
auto ptr = (char*)tracy_malloc( size );
|
||||||
memcpy( ptr, txt, size );
|
memcpy( ptr, txt, size );
|
||||||
ptr[size] = '\0';
|
MemWrite( &item->messageColorFat.time, GetTime() );
|
||||||
MemWrite( &item->messageColor.time, GetTime() );
|
MemWrite( &item->messageColorFat.text, (uint64_t)ptr );
|
||||||
MemWrite( &item->messageColor.text, (uint64_t)ptr );
|
MemWrite( &item->messageColorFat.r, uint8_t( ( color ) & 0xFF ) );
|
||||||
MemWrite( &item->messageColor.r, uint8_t( ( color ) & 0xFF ) );
|
MemWrite( &item->messageColorFat.g, uint8_t( ( color >> 8 ) & 0xFF ) );
|
||||||
MemWrite( &item->messageColor.g, uint8_t( ( color >> 8 ) & 0xFF ) );
|
MemWrite( &item->messageColorFat.b, uint8_t( ( color >> 16 ) & 0xFF ) );
|
||||||
MemWrite( &item->messageColor.b, uint8_t( ( color >> 16 ) & 0xFF ) );
|
MemWrite( &item->messageColorFat.size, (uint16_t)size );
|
||||||
TracyLfqCommit;
|
TracyLfqCommit;
|
||||||
|
|
||||||
if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack );
|
if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack );
|
||||||
|
@ -264,6 +264,16 @@ struct QueueMessageColor : public QueueMessage
|
|||||||
uint8_t b;
|
uint8_t b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct QueueMessageFat : public QueueMessage
|
||||||
|
{
|
||||||
|
uint16_t size;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct QueueMessageColorFat : public QueueMessageColor
|
||||||
|
{
|
||||||
|
uint16_t size;
|
||||||
|
};
|
||||||
|
|
||||||
// Don't change order, only add new entries at the end, this is also used on trace dumps!
|
// Don't change order, only add new entries at the end, this is also used on trace dumps!
|
||||||
enum class GpuContextType : uint8_t
|
enum class GpuContextType : uint8_t
|
||||||
{
|
{
|
||||||
@ -493,6 +503,8 @@ struct QueueItem
|
|||||||
QueuePlotData plotData;
|
QueuePlotData plotData;
|
||||||
QueueMessage message;
|
QueueMessage message;
|
||||||
QueueMessageColor messageColor;
|
QueueMessageColor messageColor;
|
||||||
|
QueueMessageFat messageFat;
|
||||||
|
QueueMessageColorFat messageColorFat;
|
||||||
QueueGpuNewContext gpuNewContext;
|
QueueGpuNewContext gpuNewContext;
|
||||||
QueueGpuZoneBegin gpuZoneBegin;
|
QueueGpuZoneBegin gpuZoneBegin;
|
||||||
QueueGpuZoneEnd gpuZoneEnd;
|
QueueGpuZoneEnd gpuZoneEnd;
|
||||||
|
Loading…
Reference in New Issue
Block a user