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

Pack start time and srcloc together in ZoneEvent.

This reduces ZoneEvent struct size by 2 bytes. Memory savings on various
captures:

10.62 GB -> 10.29 GB
 2342 MB ->  2276 MB
 1706 MB ->  1635 MB
 6277 MB ->  6085 MB
This commit is contained in:
Bartosz Taudul
2019-08-15 20:12:09 +02:00
parent 3e06daef31
commit bf3ad57456
4 changed files with 142 additions and 109 deletions
+20 -2
View File
@@ -1,6 +1,7 @@
#ifndef __TRACYEVENT_HPP__
#define __TRACYEVENT_HPP__
#include <assert.h>
#include <limits>
#include <stdint.h>
#include <string.h>
@@ -75,9 +76,26 @@ enum { SourceLocationSize = sizeof( SourceLocation ) };
struct ZoneEvent
{
int64_t start;
int64_t Start() const
{
return int64_t( _start_srcloc ) >> 16;
}
void SetStart( int64_t start )
{
assert( start < ( 1ll << 47 ) );
_start_srcloc = ( _start_srcloc & 0xFFFF ) | ( start << 16 );
}
int16_t SrcLoc() const
{
return int16_t( _start_srcloc & 0xFFFF );
}
void SetSrcLoc( int16_t srcloc )
{
_start_srcloc = ( _start_srcloc & 0xFFFFFFFFFFFF0000 ) | srcloc;
}
uint64_t _start_srcloc;
int64_t end;
int16_t srcloc;
StringIdx text;
uint32_t callstack;
StringIdx name;