mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Add callstack frame identifier and the required plumbing.
This commit is contained in:
parent
cf8d17c2ec
commit
1feedb17ac
@ -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
|
||||
{
|
||||
|
@ -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<T>::CalcHash()
|
||||
m_hash = uint32_t( hash );
|
||||
}
|
||||
|
||||
template<>
|
||||
void VarArray<CallstackFrameId>::CalcHash()
|
||||
{
|
||||
uint64_t hash = 5381;
|
||||
for( uint8_t i=0; i<m_size; i++ )
|
||||
{
|
||||
hash = ( ( hash << 5 ) + hash ) ^ m_ptr[i].data;
|
||||
}
|
||||
m_hash = uint32_t( hash );
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool Compare( const VarArray<T>& lhs, const VarArray<T>& rhs )
|
||||
{
|
||||
|
@ -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<uint64_t>::max(), 0 ) {}
|
||||
|
Loading…
Reference in New Issue
Block a user