1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Change thread id size from 64 to 32 bits.

Both Windows and Linux use 32-bit thread identifiers. MacOS has a 64-bit
counter, but in practice it will never overflow during profiling and no false
aliasing will happen.

These changes are only done client-side and in the network protocol. The
server still uses 64-bit thread identifiers, to enable virtual threads, etc.
This commit is contained in:
Bartosz Taudul
2021-10-08 00:42:52 +02:00
parent 07bc665d8c
commit 250ef2cf6e
8 changed files with 54 additions and 52 deletions
+4 -4
View File
@@ -127,7 +127,7 @@ struct ProducerWrapper
struct ThreadHandleWrapper
{
uint64_t val;
uint32_t val;
};
#endif
@@ -1057,7 +1057,7 @@ TRACY_API int64_t GetInitTime() { return GetProfilerData().initTime; }
TRACY_API std::atomic<uint32_t>& GetLockCounter() { return GetProfilerData().lockCounter; }
TRACY_API std::atomic<uint8_t>& GetGpuCtxCounter() { return GetProfilerData().gpuCtxCounter; }
TRACY_API GpuCtxWrapper& GetGpuCtx() { return GetProfilerThreadData().gpuCtx; }
TRACY_API uint64_t GetThreadHandle() { return detail::GetThreadHandleImpl(); }
TRACY_API uint32_t GetThreadHandle() { return detail::GetThreadHandleImpl(); }
std::atomic<ThreadNameData*>& GetThreadNameData() { return GetProfilerData().threadNameData; }
# ifdef TRACY_ON_DEMAND
@@ -1116,7 +1116,7 @@ TRACY_API int64_t GetInitTime() { return s_initTime.val; }
TRACY_API std::atomic<uint32_t>& GetLockCounter() { return s_lockCounter; }
TRACY_API std::atomic<uint8_t>& GetGpuCtxCounter() { return s_gpuCtxCounter; }
TRACY_API GpuCtxWrapper& GetGpuCtx() { return s_gpuCtx; }
TRACY_API uint64_t GetThreadHandle() { return s_threadHandle.val; }
TRACY_API uint32_t GetThreadHandle() { return s_threadHandle.val; }
std::atomic<ThreadNameData*>& GetThreadNameData() { return s_threadNameData; }
@@ -1957,7 +1957,7 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
{
bool connectionLost = false;
const auto sz = GetQueue().try_dequeue_bulk_single( token,
[this, &connectionLost] ( const uint64_t& threadId )
[this, &connectionLost] ( const uint32_t& threadId )
{
if( threadId != m_threadCtx )
{