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

Store extra zone data separately.

Extra zone data consists of:
- custom zone name,
- zone text,
- zone callstack index.

If neither of these data values is stored in zone, 5 bytes are saved. If
any one of them is required, extra 4 bytes are added, for an index into
extra data array.

Memory savings:

android         2371 MB -> 2324 MB
big             7593 MB -> 6747 MB
chicken         1687 MB -> 1501 MB
drl-l-b         1119 MB -> 1013 MB
long            4289 MB -> 4190 MB
q3bsp-mt        4399 MB -> 3918 MB
q3bsp-st        1067 MB -> 1027 MB
raytracer       6057 MB -> 5342 MB
selfprofile     1177 MB -> 1079 MB
tracy-dynamic   4489 MB -> 4013 MB
tracy-static    16.2 GB -> 14.3 GB
This commit is contained in:
Bartosz Taudul
2020-01-26 15:57:55 +01:00
parent 3aa427fdd6
commit f2a226407f
5 changed files with 178 additions and 71 deletions
+15 -7
View File
@@ -164,22 +164,30 @@ struct ZoneEvent
tracy_force_inline bool IsEndValid() const { return ( _end_child1 >> 63 ) == 0; }
tracy_force_inline int16_t SrcLoc() const { return int16_t( _start_srcloc & 0xFFFF ); }
tracy_force_inline void SetSrcLoc( int16_t srcloc ) { memcpy( &_start_srcloc, &srcloc, 2 ); }
tracy_force_inline int32_t Child() const { return int32_t( uint32_t( _end_child1 & 0xFFFF ) | ( uint32_t( _child2 ) << 16 ) ); }
tracy_force_inline void SetChild( int32_t child ) { memcpy( &_end_child1, &child, 2 ); _child2 = uint32_t( child ) >> 16; }
tracy_force_inline bool HasChildren() const { return ( _child2 >> 15 ) == 0; }
tracy_force_inline int32_t Child() const { int32_t child; memcpy( &child, &_child2, 4 ); return child; }
tracy_force_inline void SetChild( int32_t child ) { memcpy( &_child2, &child, 4 ); }
tracy_force_inline bool HasChildren() const { uint8_t tmp; memcpy( &tmp, ((char*)&_end_child1)+1, 1 ); return ( tmp >> 7 ) == 0; }
uint64_t _start_srcloc;
uint64_t _end_child1;
StringIdx text;
Int24 callstack;
StringIdx name;
uint16_t _child2;
uint64_t _end_child1;
uint32_t extra;
};
enum { ZoneEventSize = sizeof( ZoneEvent ) };
static_assert( std::is_standard_layout<ZoneEvent>::value, "ZoneEvent is not standard layout" );
struct ZoneExtra
{
Int24 callstack;
StringIdx text;
StringIdx name;
};
enum { ZoneExtraSize = sizeof( ZoneExtra ) };
struct LockEvent
{
enum class Type : uint8_t