From faeecdd773b681c564e98786930645ce7c74ae1f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 1 Apr 2018 19:53:05 +0200 Subject: [PATCH] Add serial queue to profiler. --- client/TracyProfiler.cpp | 3 ++- client/TracyProfiler.hpp | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index b9b8a561..c5a7d200 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -108,7 +108,7 @@ struct ThreadNameData; std::atomic init_order(104) s_threadNameData( nullptr ); #endif -static Profiler init_order(105) s_profiler; +Profiler init_order(105) s_profiler; enum { BulkSize = TargetFrameSize / QueueItemSize }; @@ -125,6 +125,7 @@ Profiler::Profiler() , m_bufferStart( 0 ) , m_itemBuf( (QueueItem*)tracy_malloc( sizeof( QueueItem ) * BulkSize ) ) , m_lz4Buf( (char*)tracy_malloc( LZ4Size + sizeof( lz4sz_t ) ) ) + , m_serialQueue( 1024*1024 ) { assert( !s_instance ); s_instance = this; diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index ea3af51c..f03c51d2 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -7,7 +7,9 @@ #include #include "concurrentqueue.h" +#include "TracyFastVector.hpp" #include "../common/tracy_lz4.hpp" +#include "../common/tracy_benaphore.h" #include "../common/TracyQueue.hpp" #include "../common/TracyAlign.hpp" #include "../common/TracyAlloc.hpp" @@ -50,6 +52,9 @@ struct GpuCtxWrapper using Magic = moodycamel::ConcurrentQueueDefaultTraits::index_t; +class Profiler; +extern Profiler s_profiler; + class Profiler { public: @@ -252,6 +257,9 @@ private: QueueItem* m_itemBuf; char* m_lz4Buf; + + FastVector m_serialQueue; + NonRecursiveBenaphore m_serialLock; }; };