mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Pack ZoneThreadData.
This reduces struct size from 10 to 8 bytes. Assumes 48-bit pointers (4-level paging)! Memory savings (MB): android 2766 -> 2757 (99%) big 10.29 G -> 9902 (96%) chicken 2244 -> 2172 (96%) ctx-android 228 -> 224 (98%) drl-l-b 1635 -> 1570 (96%) gn-vulkan 244 -> 240 (98%) long 5656 -> 5496 (97%) q3bsp-mt 6043 -> 5784 (95%) selfprofile 1554 -> 1486 (95%)
This commit is contained in:
@@ -86,9 +86,15 @@ public:
|
||||
#pragma pack( 1 )
|
||||
struct ZoneThreadData
|
||||
{
|
||||
ZoneEvent* zone;
|
||||
uint16_t thread;
|
||||
ZoneEvent* Zone() const { return (ZoneEvent*)( _zone_thread >> 16 ); }
|
||||
void SetZone( ZoneEvent* zone ) { assert( ( uint64_t( zone ) & 0xFFFF000000000000 ) == 0 ); _zone_thread = ( _zone_thread & 0xFFFF ) | ( uint64_t( zone ) << 16 ); }
|
||||
uint16_t Thread() const { return uint16_t( _zone_thread & 0xFFFF ); }
|
||||
void SetThread( uint16_t thread ) { _zone_thread = ( _zone_thread & 0xFFFFFFFFFFFF0000 ) | uint64_t( thread ); }
|
||||
|
||||
uint64_t _zone_thread;
|
||||
};
|
||||
|
||||
enum { ZoneThreadDataSize = sizeof( ZoneThreadData ) };
|
||||
#pragma pack()
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user