mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Allow sending text messages.
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
#define TracyPlot(x,y)
|
||||
|
||||
#define TracyMesage(x,y)
|
||||
|
||||
#else
|
||||
|
||||
#include "TracyLock.hpp"
|
||||
@@ -39,6 +41,8 @@
|
||||
|
||||
#define TracyPlot( name, val ) tracy::Profiler::PlotData( name, val );
|
||||
|
||||
#define TracyMessage( txt, size ) tracy::Profiler::Message( txt, size );
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -127,6 +127,23 @@ public:
|
||||
tail.store( magic + 1, std::memory_order_release );
|
||||
}
|
||||
|
||||
static tracy_force_inline void Message( const char* txt, size_t size )
|
||||
{
|
||||
uint32_t cpu;
|
||||
Magic magic;
|
||||
auto ptr = new char[size+1];
|
||||
memcpy( ptr, txt, size );
|
||||
ptr[size] = '\0';
|
||||
auto& token = s_token.ptr;
|
||||
auto& tail = token->get_tail_index();
|
||||
auto item = token->enqueue_begin<moodycamel::CanAlloc>( magic );
|
||||
item->hdr.type = QueueType::Message;
|
||||
item->message.time = GetTime( cpu );
|
||||
item->message.thread = GetThreadHandle();
|
||||
item->message.text = (uint64_t)ptr;
|
||||
tail.store( magic + 1, std::memory_order_release );
|
||||
}
|
||||
|
||||
static bool ShouldExit();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user