mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Don't decompress GpuZone threads while saving trace.
Saving the threads compressed in GPU zones and memory event has the following result on trace dump sizes: 043/aa.tracy (0.4.3) {10055 KB} -> 044/aa.tracy (0.4.4) {9975 KB} 99.20% size change 043/android.tracy (0.4.3) {542739 KB} -> 044/android.tracy (0.4.4) {519248 KB} 95.67% size change 043/asset-new.tracy (0.4.3) {78403 KB} -> 044/asset-new.tracy (0.4.4) {75899 KB} 96.81% size change 043/asset-new-id.tracy (0.4.3) {84341 KB} -> 044/asset-new-id.tracy (0.4.4) {81771 KB} 96.95% size change 043/asset-old.tracy (0.4.3) {80688 KB} -> 044/asset-old.tracy (0.4.4) {78410 KB} 97.18% size change 043/big.tracy (0.4.3) {939577 KB} -> 044/big.tracy (0.4.4) {938427 KB} 99.88% size change 043/callstack.tracy (0.4.3) {14557 KB} -> 044/callstack.tracy (0.4.4) {14465 KB} 99.37% size change 043/callstack-linux.tracy (0.4.3) {6949 KB} -> 044/callstack-linux.tracy (0.4.4) {6942 KB} 99.90% size change 043/crash.tracy (0.4.3) {131 KB} -> 044/crash.tracy (0.4.4) {127 KB} 97.10% size change 043/crash2.tracy (0.4.3) {1422 KB} -> 044/crash2.tracy (0.4.4) {1412 KB} 99.29% size change 043/darkrl.tracy (0.4.3) {15767 KB} -> 044/darkrl.tracy (0.4.4) {15663 KB} 99.34% size change 043/darkrl2.tracy (0.4.3) {7947 KB} -> 044/darkrl2.tracy (0.4.4) {7886 KB} 99.23% size change 043/darkrl-old.tracy (0.4.3) {67448 KB} -> 044/darkrl-old.tracy (0.4.4) {67004 KB} 99.34% size change 043/deadlock.tracy (0.4.3) {5984 KB} -> 044/deadlock.tracy (0.4.4) {5986 KB} 100.03% size change 043/gn-opengl.tracy (0.4.3) {29005 KB} -> 044/gn-opengl.tracy (0.4.4) {28885 KB} 99.59% size change 043/gn-vulkan.tracy (0.4.3) {29352 KB} -> 044/gn-vulkan.tracy (0.4.4) {29257 KB} 99.68% size change 043/long.tracy (0.4.3) {1182800 KB} -> 044/long.tracy (0.4.4) {1176584 KB} 99.47% size change 043/mem.tracy (0.4.3) {1369067 KB} -> 044/mem.tracy (0.4.4) {1262406 KB} 92.21% size change 043/multi.tracy (0.4.3) {8004 KB} -> 044/multi.tracy (0.4.4) {7944 KB} 99.24% size change 043/new.tracy (0.4.3) {1108 KB} -> 044/new.tracy (0.4.4) {1099 KB} 99.18% size change 043/q3bsp-mt.tracy (0.4.3) {949855 KB} -> 044/q3bsp-mt.tracy (0.4.4) {937574 KB} 98.71% size change 043/q3bsp-st.tracy (0.4.3) {240347 KB} -> 044/q3bsp-st.tracy (0.4.4) {230092 KB} 95.73% size change 043/selfprofile.tracy (0.4.3) {197708 KB} -> 044/selfprofile.tracy (0.4.4) {197659 KB} 99.98% size change 043/tbrowser.tracy (0.4.3) {9503 KB} -> 044/tbrowser.tracy (0.4.4) {9503 KB} 100.00% size change 043/test.tracy (0.4.3) {40700 KB} -> 044/test.tracy (0.4.4) {40699 KB} 100.00% size change 043/virtualfile_hc.tracy (0.4.3) {72424 KB} -> 044/virtualfile_hc.tracy (0.4.4) {72304 KB} 99.83% size change 043/zfile_hc.tracy (0.4.3) {39419 KB} -> 044/zfile_hc.tracy (0.4.4) {39328 KB} 99.77% size change
This commit is contained in:
parent
760e9105d0
commit
4422fce55c
@ -783,6 +783,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
|
||||
f.Read( ctx->count );
|
||||
s_loadProgress.subTotal.store( ctx->count, std::memory_order_relaxed );
|
||||
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
|
||||
int64_t refTime = 0;
|
||||
int64_t refGpuTime = 0;
|
||||
if( fileVer <= FileVersion( 0, 3, 1 ) )
|
||||
{
|
||||
ctx->period = 1.f;
|
||||
@ -790,7 +792,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
|
||||
f.Read( tsz );
|
||||
if( tsz != 0 )
|
||||
{
|
||||
ReadTimelinePre042( f, ctx->timeline, tsz, fileVer );
|
||||
ReadTimelinePre044( f, ctx->timeline, tsz, refTime, refGpuTime, fileVer );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -800,14 +802,13 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
|
||||
f.Read( tsz );
|
||||
if( tsz != 0 )
|
||||
{
|
||||
if( fileVer <= FileVersion( 0, 4, 1 ) )
|
||||
if( fileVer <= FileVersion( 0, 4, 3 ) )
|
||||
{
|
||||
ReadTimelinePre042( f, ctx->timeline, tsz, fileVer );
|
||||
ReadTimelinePre044( f, ctx->timeline, tsz, refTime, refGpuTime, fileVer );
|
||||
}
|
||||
else
|
||||
{
|
||||
int64_t refTime = 0;
|
||||
int64_t refGpuTime = 0;
|
||||
|
||||
ReadTimeline( f, ctx->timeline, tsz, refTime, refGpuTime );
|
||||
}
|
||||
}
|
||||
@ -3283,7 +3284,7 @@ void Worker::ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::ReadTimelinePre042( FileRead& f, GpuEvent* zone, int fileVer )
|
||||
void Worker::ReadTimelinePre044( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int fileVer )
|
||||
{
|
||||
uint64_t sz;
|
||||
f.Read( sz );
|
||||
@ -3296,7 +3297,7 @@ void Worker::ReadTimelinePre042( FileRead& f, GpuEvent* zone, int fileVer )
|
||||
zone->child = m_data.m_gpuChildren.size();
|
||||
m_data.m_gpuChildren.push_back( Vector<GpuEvent*>() );
|
||||
Vector<GpuEvent*> tmp;
|
||||
ReadTimelinePre042( f, tmp, sz, fileVer );
|
||||
ReadTimelinePre044( f, tmp, sz, refTime, refGpuTime, fileVer );
|
||||
m_data.m_gpuChildren[zone->child] = std::move( tmp );
|
||||
}
|
||||
}
|
||||
@ -3415,22 +3416,12 @@ void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, i
|
||||
|
||||
// Use zone->gpuStart as scratch buffer for CPU zone start time offset.
|
||||
// Use zone->gpuEnd as scratch buffer for GPU zone start time offset.
|
||||
f.Read( &zone->gpuStart, sizeof( zone->gpuStart ) + sizeof( zone->gpuEnd ) + sizeof( zone->srcloc ) + sizeof( zone->callstack ) );
|
||||
f.Read( &zone->gpuStart, sizeof( zone->gpuStart ) + sizeof( zone->gpuEnd ) + sizeof( zone->srcloc ) + sizeof( zone->callstack ) + sizeof( zone->thread ) );
|
||||
refTime += zone->gpuStart;
|
||||
refGpuTime += zone->gpuEnd;
|
||||
zone->cpuStart = refTime;
|
||||
zone->gpuStart = refGpuTime;
|
||||
|
||||
uint64_t thread;
|
||||
f.Read( thread );
|
||||
if( thread == 0 )
|
||||
{
|
||||
zone->thread = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
zone->thread = CompressThread( thread );
|
||||
}
|
||||
ReadTimeline( f, zone, refTime, refGpuTime );
|
||||
|
||||
zone->cpuEnd = ReadTimeOffset( f, refTime );
|
||||
@ -3439,7 +3430,7 @@ void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, i
|
||||
while( ++zone != zptr );
|
||||
}
|
||||
|
||||
void Worker::ReadTimelinePre042( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, int fileVer )
|
||||
void Worker::ReadTimelinePre044( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int fileVer )
|
||||
{
|
||||
assert( size != 0 );
|
||||
vec.reserve_exact( size, m_slab );
|
||||
@ -3456,9 +3447,8 @@ void Worker::ReadTimelinePre042( FileRead& f, Vector<GpuEvent*>& vec, uint64_t s
|
||||
zone->thread = 0;
|
||||
zone->callstack = 0;
|
||||
}
|
||||
else
|
||||
else if( fileVer <= FileVersion( 0, 4, 1 ) )
|
||||
{
|
||||
assert( fileVer <= FileVersion( 0, 4, 1 ) );
|
||||
f.Read( zone, sizeof( GpuEvent::cpuStart ) + sizeof( GpuEvent::cpuEnd ) + sizeof( GpuEvent::gpuStart ) + sizeof( GpuEvent::gpuEnd ) + sizeof( GpuEvent::srcloc ) + sizeof( GpuEvent::callstack ) );
|
||||
uint64_t thread;
|
||||
f.Read( thread );
|
||||
@ -3471,7 +3461,34 @@ void Worker::ReadTimelinePre042( FileRead& f, Vector<GpuEvent*>& vec, uint64_t s
|
||||
zone->thread = CompressThread( thread );
|
||||
}
|
||||
}
|
||||
ReadTimelinePre042( f, zone, fileVer );
|
||||
else
|
||||
{
|
||||
assert( fileVer <= FileVersion( 0, 4, 3 ) );
|
||||
|
||||
f.Read( &zone->gpuStart, sizeof( zone->gpuStart ) + sizeof( zone->gpuEnd ) + sizeof( zone->srcloc ) + sizeof( zone->callstack ) );
|
||||
refTime += zone->gpuStart;
|
||||
refGpuTime += zone->gpuEnd;
|
||||
zone->cpuStart = refTime;
|
||||
zone->gpuStart = refGpuTime;
|
||||
|
||||
uint64_t thread;
|
||||
f.Read( thread );
|
||||
if( thread == 0 )
|
||||
{
|
||||
zone->thread = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
zone->thread = CompressThread( thread );
|
||||
}
|
||||
}
|
||||
ReadTimelinePre044( f, zone, refTime, refGpuTime, fileVer );
|
||||
if( fileVer > FileVersion( 0, 4, 1 ) )
|
||||
{
|
||||
assert( fileVer <= FileVersion( 0, 4, 3 ) );
|
||||
zone->cpuEnd = ReadTimeOffset( f, refTime );
|
||||
zone->gpuEnd = ReadTimeOffset( f, refGpuTime );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3779,9 +3796,8 @@ void Worker::WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec, int64_t&
|
||||
WriteTimeOffset( f, refGpuTime, v->gpuStart );
|
||||
f.Write( &v->srcloc, sizeof( v->srcloc ) );
|
||||
f.Write( &v->callstack, sizeof( v->callstack ) );
|
||||
f.Write( &v->thread, sizeof( v->thread ) );
|
||||
|
||||
uint64_t thread = DecompressThread( v->thread );
|
||||
f.Write( &thread, sizeof( thread ) );
|
||||
if( v->child < 0 )
|
||||
{
|
||||
sz = 0;
|
||||
|
@ -393,14 +393,14 @@ private:
|
||||
tracy_force_inline void ReadTimeline( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime );
|
||||
tracy_force_inline void ReadTimelinePre042( FileRead& f, ZoneEvent* zone, uint16_t thread, int fileVer );
|
||||
tracy_force_inline void ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime );
|
||||
tracy_force_inline void ReadTimelinePre042( FileRead& f, GpuEvent* zone, int fileVer );
|
||||
tracy_force_inline void ReadTimelinePre044( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime, int fileVer );
|
||||
|
||||
tracy_force_inline void ReadTimelineUpdateStatistics( ZoneEvent* zone, uint16_t thread );
|
||||
|
||||
void ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint16_t thread, uint64_t size, int64_t& refTime );
|
||||
void ReadTimelinePre042( FileRead& f, Vector<ZoneEvent*>& vec, uint16_t thread, uint64_t size, int fileVer );
|
||||
void ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime );
|
||||
void ReadTimelinePre042( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, int fileVer );
|
||||
void ReadTimelinePre044( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime, int fileVer );
|
||||
|
||||
void WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec, int64_t& refTime );
|
||||
void WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec, int64_t& refTime, int64_t& refGpuTime );
|
||||
|
Loading…
Reference in New Issue
Block a user