mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Allow queuing zones.
This commit is contained in:
parent
05486c8225
commit
12a6306c0b
@ -44,6 +44,20 @@ uint64_t Profiler::GetNewId()
|
||||
return s_instance->m_id.fetch_add( 1, std::memory_order_relaxed );
|
||||
}
|
||||
|
||||
void Profiler::ZoneBegin( QueueZoneBegin&& data )
|
||||
{
|
||||
QueueItem item { QueueType::ZoneBegin, GetTime() };
|
||||
item.zoneBegin = std::move( data );
|
||||
s_instance->m_queue.enqueue( std::move( item ) );
|
||||
}
|
||||
|
||||
void Profiler::ZoneEnd( QueueZoneEnd&& data )
|
||||
{
|
||||
QueueItem item { QueueType::ZoneEnd, GetTime() };
|
||||
item.zoneEnd = std::move( data );
|
||||
s_instance->m_queue.enqueue( std::move( item ) );
|
||||
}
|
||||
|
||||
void Profiler::Worker()
|
||||
{
|
||||
for(;;)
|
||||
|
@ -5,6 +5,9 @@
|
||||
#include <stdint.h>
|
||||
#include <thread>
|
||||
|
||||
#include "concurrentqueue.h"
|
||||
#include "TracyQueue.hpp"
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
@ -16,11 +19,15 @@ public:
|
||||
|
||||
static uint64_t GetNewId();
|
||||
|
||||
static void ZoneBegin( QueueZoneBegin&& data );
|
||||
static void ZoneEnd( QueueZoneEnd&& data );
|
||||
|
||||
private:
|
||||
void Worker();
|
||||
|
||||
std::thread m_thread;
|
||||
std::atomic<bool> m_shutdown;
|
||||
moodycamel::ConcurrentQueue<QueueItem> m_queue;
|
||||
std::atomic<uint64_t> m_id;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user