1
0
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:
Bartosz Taudul
2017-10-14 13:23:13 +02:00
parent e0300c3524
commit 8c7b60fbe6
3 changed files with 31 additions and 0 deletions
+4
View File
@@ -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
+17
View File
@@ -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: