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

Store instruction pointers in per-symbol sample data.

This commit is contained in:
Bartosz Taudul
2020-08-10 14:52:51 +02:00
parent 85f54499fe
commit 7a4ecc5417
4 changed files with 53 additions and 43 deletions
+28 -18
View File
@@ -212,6 +212,25 @@ struct ZoneExtra
enum { ZoneExtraSize = sizeof( ZoneExtra ) };
// 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 : 62;
uint64_t sel : 1;
uint64_t custom : 1;
};
uint64_t data;
};
enum { CallstackFrameIdSize = sizeof( CallstackFrameId ) };
static tracy_force_inline bool operator==( const CallstackFrameId& lhs, const CallstackFrameId& rhs ) { return lhs.data == rhs.data; }
struct SampleData
{
Int48 time;
@@ -221,6 +240,15 @@ struct SampleData
enum { SampleDataSize = sizeof( SampleData ) };
struct SampleDataRange
{
Int48 time;
CallstackFrameId ip;
};
enum { SampleDataRangeSize = sizeof( SampleDataRange ) };
struct LockEvent
{
enum class Type : uint8_t
@@ -368,24 +396,6 @@ 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 : 62;
uint64_t sel : 1;
uint64_t custom : 1;
};
uint64_t data;
};
enum { CallstackFrameIdSize = sizeof( CallstackFrameId ) };
static tracy_force_inline bool operator==( const CallstackFrameId& lhs, const CallstackFrameId& rhs ) { return lhs.data == rhs.data; }
struct CallstackFrameTree
{