diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 8f2b1f49..5c43270b 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -179,6 +179,21 @@ struct CallstackFrameData enum { CallstackFrameDataSize = sizeof( CallstackFrameData ) }; +// This union exploits the fact that the current implementations of x64 and arm64 do not provide +// full 64 bit address space. The high bits must be bit-extended, so 0x80... is an invalid pointer. +// This allows using the highest bit as a selector between a native pointer and a table index here. +union CallstackFrameId +{ + struct + { + uint64_t idx : 63; + uint64_t sel : 1; + }; + uint64_t data; +}; + +enum { CallstackFrameIdSize = sizeof( CallstackFrameId ) }; + struct CallstackFrameTree { diff --git a/server/TracyVarArray.hpp b/server/TracyVarArray.hpp index 45f6d2c9..72684021 100644 --- a/server/TracyVarArray.hpp +++ b/server/TracyVarArray.hpp @@ -8,6 +8,7 @@ #include "tracy_flat_hash_map.hpp" #include "TracyCharUtil.hpp" #include "TracyMemory.hpp" +#include "TracyEvent.hpp" namespace tracy { @@ -65,6 +66,17 @@ void VarArray::CalcHash() m_hash = uint32_t( hash ); } +template<> +void VarArray::CalcHash() +{ + uint64_t hash = 5381; + for( uint8_t i=0; i bool Compare( const VarArray& lhs, const VarArray& rhs ) { diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index dea28be9..b5fd5ead 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -100,6 +100,17 @@ private: int64_t selfTotal; }; + struct CallstackFrameIdHash + { + size_t operator()( const CallstackFrameId& id ) { return id.data; } + typedef tracy::power_of_two_hash_policy hash_policy; + }; + + struct CallstackFrameIdCompare + { + bool operator()( const CallstackFrameId& lhs, const CallstackFrameId& rhs ) { return lhs.data == rhs.data; } + }; + struct DataBlock { DataBlock() : zonesCnt( 0 ), lastTime( 0 ), frameOffset( 0 ), threadLast( std::numeric_limits::max(), 0 ) {}