diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp new file mode 100755 index 00000000..89d53ad2 --- /dev/null +++ b/client/TracyProfiler.cpp @@ -0,0 +1,36 @@ +#include + +#include "TracyProfiler.hpp" + +namespace tracy +{ + +static Profiler* s_instance = nullptr; + +Profiler::Profiler() + : m_shutdown( false ) +{ + assert( !s_instance ); + s_instance = this; + + m_thread = std::thread( [this] { Worker(); } ); +} + +Profiler::~Profiler() +{ + assert( s_instance ); + s_instance = nullptr; + + m_shutdown.store( true, std::memory_order_relaxed ); + m_thread.join(); +} + +void Profiler::Worker() +{ + for(;;) + { + if( m_shutdown.load( std::memory_order_relaxed ) ) return; + } +} + +} diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp new file mode 100755 index 00000000..66a7dba9 --- /dev/null +++ b/client/TracyProfiler.hpp @@ -0,0 +1,25 @@ +#ifndef __TRACYPROFILER_HPP__ +#define __TRACYPROFILER_HPP__ + +#include +#include + +namespace tracy +{ + +class Profiler +{ +public: + Profiler(); + ~Profiler(); + +private: + void Worker(); + + std::thread m_thread; + std::atomic m_shutdown; +}; + +}; + +#endif