1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Allow sending application information messages.

This commit is contained in:
Bartosz Taudul
2019-07-12 18:14:42 +02:00
parent cd018e88a4
commit 60d2384a6a
6 changed files with 52 additions and 2 deletions
+22
View File
@@ -335,6 +335,28 @@ public:
tail.store( magic + 1, std::memory_order_release );
}
static tracy_force_inline void MessageAppInfo( const char* txt, size_t size )
{
Magic magic;
const auto thread = GetThreadHandle();
auto token = GetToken();
auto ptr = (char*)tracy_malloc( size+1 );
memcpy( ptr, txt, size );
ptr[size] = '\0';
auto& tail = token->get_tail_index();
auto item = token->enqueue_begin<tracy::moodycamel::CanAlloc>( magic );
MemWrite( &item->hdr.type, QueueType::MessageAppInfo );
MemWrite( &item->message.time, GetTime() );
MemWrite( &item->message.thread, thread );
MemWrite( &item->message.text, (uint64_t)ptr );
#ifdef TRACY_ON_DEMAND
GetProfiler().DeferItem( *item );
#endif
tail.store( magic + 1, std::memory_order_release );
}
static tracy_force_inline void MemAlloc( const void* ptr, size_t size )
{
#ifdef TRACY_ON_DEMAND