Track separate time offset for GPU times.

This is second version of 0.4.2 dump file format. Previous 0.4.2 format
cannot be read anymore.

041/aa.tracy (0.4.1) {18987 KB} -> 042/aa.tracy (0.4.2) {10051 KB}  52.94% size change
041/android.tracy (0.4.1) {696753 KB} -> 042/android.tracy (0.4.2) {542738 KB}  77.90% size change
041/asset-new.tracy (0.4.1) {97163 KB} -> 042/asset-new.tracy (0.4.2) {78402 KB}  80.69% size change
041/asset-new-id.tracy (0.4.1) {105683 KB} -> 042/asset-new-id.tracy (0.4.2) {84341 KB}  79.81% size change
041/asset-old.tracy (0.4.1) {100205 KB} -> 042/asset-old.tracy (0.4.2) {80688 KB}  80.52% size change
041/big.tracy (0.4.1) {2246014 KB} -> 042/big.tracy (0.4.2) {939578 KB}  41.83% size change
041/crash.tracy (0.4.1) {143 KB} -> 042/crash.tracy (0.4.2) {131 KB}  91.37% size change
041/crash2.tracy (0.4.1) {3411 KB} -> 042/crash2.tracy (0.4.2) {1420 KB}  41.63% size change
041/darkrl.tracy (0.4.1) {31818 KB} -> 042/darkrl.tracy (0.4.2) {15762 KB}  49.54% size change
041/darkrl2.tracy (0.4.1) {18778 KB} -> 042/darkrl2.tracy (0.4.2) {7945 KB}  42.31% size change
041/darkrl-old.tracy (0.4.1) {151346 KB} -> 042/darkrl-old.tracy (0.4.2) {67449 KB}  44.57% size change
041/deadlock.tracy (0.4.1) {53 KB} -> 042/deadlock.tracy (0.4.2) {52 KB}  98.55% size change
041/gn-opengl.tracy (0.4.1) {45860 KB} -> 042/gn-opengl.tracy (0.4.2) {29005 KB}  63.25% size change
041/gn-vulkan.tracy (0.4.1) {45618 KB} -> 042/gn-vulkan.tracy (0.4.2) {29352 KB}  64.34% size change
041/long.tracy (0.4.1) {1583550 KB} -> 042/long.tracy (0.4.2) {1182800 KB}  74.69% size change
041/mem.tracy (0.4.1) {1243058 KB} -> 042/mem.tracy (0.4.2) {1369067 KB}  110.14% size change
041/multi.tracy (0.4.1) {14519 KB} -> 042/multi.tracy (0.4.2) {8000 KB}  55.10% size change
041/new.tracy (0.4.1) {1439 KB} -> 042/new.tracy (0.4.2) {1105 KB}  76.75% size change
041/q3bsp-mt.tracy (0.4.1) {1414323 KB} -> 042/q3bsp-mt.tracy (0.4.2) {949855 KB}  67.16% size change
041/q3bsp-st.tracy (0.4.1) {301334 KB} -> 042/q3bsp-st.tracy (0.4.2) {240347 KB}  79.76% size change
041/selfprofile.tracy (0.4.1) {399648 KB} -> 042/selfprofile.tracy (0.4.2) {197704 KB}  49.47% size change
041/tbrowser.tracy (0.4.1) {13052 KB} -> 042/tbrowser.tracy (0.4.2) {9503 KB}  72.81% size change
041/test.tracy (0.4.1) {60309 KB} -> 042/test.tracy (0.4.2) {40700 KB}  67.49% size change
041/virtualfile_hc.tracy (0.4.1) {108967 KB} -> 042/virtualfile_hc.tracy (0.4.2) {72424 KB}  66.46% size change
041/zfile_hc.tracy (0.4.1) {58814 KB} -> 042/zfile_hc.tracy (0.4.2) {39418 KB}  67.02% size change
This commit is contained in:
Bartosz Taudul 2019-01-03 20:09:45 +01:00
parent d49b005900
commit a313ed4720
2 changed files with 17 additions and 17 deletions

View File

@ -822,7 +822,8 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
else else
{ {
int64_t refTime = 0; int64_t refTime = 0;
ReadTimeline( f, ctx->timeline, tsz, refTime ); int64_t refGpuTime = 0;
ReadTimeline( f, ctx->timeline, tsz, refTime, refGpuTime );
} }
} }
} }
@ -3097,7 +3098,7 @@ void Worker::ReadTimelinePre042( FileRead& f, ZoneEvent* zone, uint16_t thread,
} }
} }
void Worker::ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime ) void Worker::ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime, int64_t& refGpuTime )
{ {
uint64_t sz; uint64_t sz;
f.Read( sz ); f.Read( sz );
@ -3110,7 +3111,7 @@ void Worker::ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime )
zone->child = m_data.m_gpuChildren.size(); zone->child = m_data.m_gpuChildren.size();
m_data.m_gpuChildren.push_back( Vector<GpuEvent*>() ); m_data.m_gpuChildren.push_back( Vector<GpuEvent*>() );
Vector<GpuEvent*> tmp; Vector<GpuEvent*> tmp;
ReadTimeline( f, tmp, sz, refTime ); ReadTimeline( f, tmp, sz, refTime, refGpuTime );
m_data.m_gpuChildren[zone->child] = std::move( tmp ); m_data.m_gpuChildren[zone->child] = std::move( tmp );
} }
} }
@ -3224,7 +3225,7 @@ void Worker::ReadTimelinePre042( FileRead& f, Vector<ZoneEvent*>& vec, uint16_t
} }
} }
void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, int64_t& refTime ) void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, int64_t& refTime, int64_t& refGpuTime )
{ {
assert( size != 0 ); assert( size != 0 );
vec.reserve_exact( size ); vec.reserve_exact( size );
@ -3236,9 +3237,7 @@ void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, i
vec[i] = zone; vec[i] = zone;
zone->cpuStart = ReadTimeOffset( f, refTime ); zone->cpuStart = ReadTimeOffset( f, refTime );
int64_t gpuOffset; zone->gpuStart = ReadTimeOffset( f, refGpuTime );
f.Read2( zone->gpuStart, gpuOffset );
zone->gpuEnd = zone->gpuStart + gpuOffset;
f.Read2( zone->srcloc, zone->callstack ); f.Read2( zone->srcloc, zone->callstack );
uint64_t thread; uint64_t thread;
@ -3251,9 +3250,10 @@ void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, i
{ {
zone->thread = CompressThread( thread ); zone->thread = CompressThread( thread );
} }
ReadTimeline( f, zone, refTime ); ReadTimeline( f, zone, refTime, refGpuTime );
zone->cpuEnd = ReadTimeOffset( f, refTime ); zone->cpuEnd = ReadTimeOffset( f, refTime );
zone->gpuEnd = ReadTimeOffset( f, refGpuTime );
} }
} }
@ -3484,11 +3484,12 @@ void Worker::Write( FileWrite& f )
for( auto& ctx : m_data.gpuData ) for( auto& ctx : m_data.gpuData )
{ {
int64_t refTime = 0; int64_t refTime = 0;
int64_t refGpuTime = 0;
f.Write( &ctx->thread, sizeof( ctx->thread ) ); f.Write( &ctx->thread, sizeof( ctx->thread ) );
f.Write( &ctx->accuracyBits, sizeof( ctx->accuracyBits ) ); f.Write( &ctx->accuracyBits, sizeof( ctx->accuracyBits ) );
f.Write( &ctx->count, sizeof( ctx->count ) ); f.Write( &ctx->count, sizeof( ctx->count ) );
f.Write( &ctx->period, sizeof( ctx->period ) ); f.Write( &ctx->period, sizeof( ctx->period ) );
WriteTimeline( f, ctx->timeline, refTime ); WriteTimeline( f, ctx->timeline, refTime, refGpuTime );
} }
sz = m_data.plots.Data().size(); sz = m_data.plots.Data().size();
@ -3585,7 +3586,7 @@ void Worker::WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec, int64_t
} }
} }
void Worker::WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec, int64_t& refTime ) void Worker::WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec, int64_t& refTime, int64_t& refGpuTime )
{ {
uint64_t sz = vec.size(); uint64_t sz = vec.size();
f.Write( &sz, sizeof( sz ) ); f.Write( &sz, sizeof( sz ) );
@ -3593,9 +3594,7 @@ void Worker::WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec, int64_t&
for( auto& v : vec ) for( auto& v : vec )
{ {
WriteTimeOffset( f, refTime, v->cpuStart ); WriteTimeOffset( f, refTime, v->cpuStart );
f.Write( &v->gpuStart, sizeof( v->gpuStart ) ); WriteTimeOffset( f, refGpuTime, v->gpuStart );
int64_t gpuOffset = v->gpuEnd - v->gpuStart;
f.Write( &gpuOffset, sizeof( gpuOffset ) );
f.Write( &v->srcloc, sizeof( v->srcloc ) ); f.Write( &v->srcloc, sizeof( v->srcloc ) );
f.Write( &v->callstack, sizeof( v->callstack ) ); f.Write( &v->callstack, sizeof( v->callstack ) );
@ -3608,10 +3607,11 @@ void Worker::WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec, int64_t&
} }
else else
{ {
WriteTimeline( f, GetGpuChildren( v->child ), refTime ); WriteTimeline( f, GetGpuChildren( v->child ), refTime, refGpuTime );
} }
WriteTimeOffset( f, refTime, v->cpuEnd ); WriteTimeOffset( f, refTime, v->cpuEnd );
WriteTimeOffset( f, refGpuTime, v->gpuEnd );
} }
} }

View File

@ -354,18 +354,18 @@ private:
tracy_force_inline void ReadTimeline( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime ); 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 ReadTimelinePre042( FileRead& f, ZoneEvent* zone, uint16_t thread, int fileVer );
tracy_force_inline void ReadTimeline( FileRead& f, GpuEvent* zone, int64_t& refTime ); 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 ReadTimelinePre042( FileRead& f, GpuEvent* zone, int fileVer );
tracy_force_inline void ReadTimelineUpdateStatistics( ZoneEvent* zone, uint16_t thread ); 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 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 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 ); 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 ReadTimelinePre042( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size, int fileVer );
void WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec, int64_t& refTime ); void WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec, int64_t& refTime );
void WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec, int64_t& refTime ); void WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec, int64_t& refTime, int64_t& refGpuTime );
int64_t TscTime( int64_t tsc ) { return int64_t( tsc * m_timerMul ); } int64_t TscTime( int64_t tsc ) { return int64_t( tsc * m_timerMul ); }
int64_t TscTime( uint64_t tsc ) { return int64_t( tsc * m_timerMul ); } int64_t TscTime( uint64_t tsc ) { return int64_t( tsc * m_timerMul ); }