Store total number of CPU and GPU zones in trace.

This commit is contained in:
Bartosz Taudul 2019-03-27 01:46:54 +01:00
parent 2e6ac050f4
commit fef417f286
2 changed files with 29 additions and 5 deletions

View File

@ -7,7 +7,7 @@ namespace Version
{ {
enum { Major = 0 }; enum { Major = 0 };
enum { Minor = 4 }; enum { Minor = 4 };
enum { Patch = 6 }; enum { Patch = 7 };
} }
} }

View File

@ -761,6 +761,12 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
} }
s_loadProgress.progress.store( LoadProgress::Zones, std::memory_order_relaxed ); s_loadProgress.progress.store( LoadProgress::Zones, std::memory_order_relaxed );
if( fileVer >= FileVersion( 0, 4, 7 ) )
{
f.Read( sz );
s_loadProgress.subTotal.store( sz, std::memory_order_relaxed );
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
}
f.Read( sz ); f.Read( sz );
m_data.threads.reserve_exact( sz, m_slab ); m_data.threads.reserve_exact( sz, m_slab );
for( uint64_t i=0; i<sz; i++ ) for( uint64_t i=0; i<sz; i++ )
@ -772,8 +778,11 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
f.Read( td->count ); f.Read( td->count );
uint64_t tsz; uint64_t tsz;
f.Read( tsz ); f.Read( tsz );
s_loadProgress.subTotal.store( td->count, std::memory_order_relaxed ); if( fileVer < FileVersion( 0, 4, 7 ) )
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed ); {
s_loadProgress.subTotal.store( td->count, std::memory_order_relaxed );
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
}
if( tsz != 0 ) if( tsz != 0 )
{ {
if( fileVer <= FileVersion( 0, 4, 1 ) ) if( fileVer <= FileVersion( 0, 4, 1 ) )
@ -808,6 +817,12 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
} }
s_loadProgress.progress.store( LoadProgress::GpuZones, std::memory_order_relaxed ); s_loadProgress.progress.store( LoadProgress::GpuZones, std::memory_order_relaxed );
if( fileVer >= FileVersion( 0, 4, 7 ) )
{
f.Read( sz );
s_loadProgress.subTotal.store( sz, std::memory_order_relaxed );
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed );
}
f.Read( sz ); f.Read( sz );
m_data.gpuData.reserve_exact( sz, m_slab ); m_data.gpuData.reserve_exact( sz, m_slab );
for( uint64_t i=0; i<sz; i++ ) for( uint64_t i=0; i<sz; i++ )
@ -816,8 +831,11 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
f.Read( ctx->thread ); f.Read( ctx->thread );
f.Read( ctx->accuracyBits ); f.Read( ctx->accuracyBits );
f.Read( ctx->count ); f.Read( ctx->count );
s_loadProgress.subTotal.store( ctx->count, std::memory_order_relaxed ); if( fileVer < FileVersion( 0, 4, 7 ) )
s_loadProgress.subProgress.store( 0, std::memory_order_relaxed ); {
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 refTime = 0;
int64_t refGpuTime = 0; int64_t refGpuTime = 0;
if( fileVer <= FileVersion( 0, 3, 1 ) ) if( fileVer <= FileVersion( 0, 3, 1 ) )
@ -3997,6 +4015,9 @@ void Worker::Write( FileWrite& f )
} }
} }
sz = 0;
for( auto& v : m_data.threads ) sz += v->count;
f.Write( &sz, sizeof( sz ) );
sz = m_data.threads.size(); sz = m_data.threads.size();
f.Write( &sz, sizeof( sz ) ); f.Write( &sz, sizeof( sz ) );
for( auto& thread : m_data.threads ) for( auto& thread : m_data.threads )
@ -4014,6 +4035,9 @@ void Worker::Write( FileWrite& f )
} }
} }
sz = 0;
for( auto& v : m_data.gpuData ) sz += v->count;
f.Write( &sz, sizeof( sz ) );
sz = m_data.gpuData.size(); sz = m_data.gpuData.size();
f.Write( &sz, sizeof( sz ) ); f.Write( &sz, sizeof( sz ) );
for( auto& ctx : m_data.gpuData ) for( auto& ctx : m_data.gpuData )