mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Save/load GPU events.
This commit is contained in:
parent
7db21f23b5
commit
dcc2b3fb09
@ -351,6 +351,16 @@ View::View( FileRead& f )
|
||||
m_threads.push_back( td );
|
||||
}
|
||||
|
||||
f.Read( &sz, sizeof( sz ) );
|
||||
m_gpuData.reserve( sz );
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
auto ctx = m_slab.AllocInit<GpuCtxData>();
|
||||
ReadTimeline( f, ctx->timeline );
|
||||
ctx->showFull = true;
|
||||
m_gpuData.push_back( ctx );
|
||||
}
|
||||
|
||||
f.Read( &sz, sizeof( sz ) );
|
||||
m_plots.reserve( sz );
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
@ -3658,6 +3668,13 @@ void View::Write( FileWrite& f )
|
||||
}
|
||||
}
|
||||
|
||||
sz = m_gpuData.size();
|
||||
f.Write( &sz, sizeof( sz ) );
|
||||
for( auto& ctx : m_gpuData )
|
||||
{
|
||||
WriteTimeline( f, ctx->timeline );
|
||||
}
|
||||
|
||||
sz = m_plots.size();
|
||||
f.Write( &sz, sizeof( sz ) );
|
||||
for( auto& plot : m_plots )
|
||||
@ -3691,6 +3708,24 @@ void View::WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec )
|
||||
}
|
||||
}
|
||||
|
||||
void View::WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec )
|
||||
{
|
||||
uint64_t sz = vec.size();
|
||||
f.Write( &sz, sizeof( sz ) );
|
||||
|
||||
for( auto& v : vec )
|
||||
{
|
||||
f.Write( &v->cpuStart, sizeof( v->cpuStart ) );
|
||||
f.Write( &v->cpuEnd, sizeof( v->cpuEnd ) );
|
||||
f.Write( &v->gpuStart, sizeof( v->gpuStart ) );
|
||||
f.Write( &v->gpuEnd, sizeof( v->gpuEnd ) );
|
||||
f.Write( &v->srcloc, sizeof( v->srcloc ) );
|
||||
f.Write( &v->name, sizeof( v->name ) );
|
||||
f.Write( &v->thread, sizeof( v->thread ) );
|
||||
WriteTimeline( f, v->child );
|
||||
}
|
||||
}
|
||||
|
||||
void View::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec )
|
||||
{
|
||||
uint64_t sz;
|
||||
@ -3713,4 +3748,26 @@ void View::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec )
|
||||
}
|
||||
}
|
||||
|
||||
void View::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec )
|
||||
{
|
||||
uint64_t sz;
|
||||
f.Read( &sz, sizeof( sz ) );
|
||||
vec.reserve( sz );
|
||||
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
auto zone = m_slab.AllocInit<GpuEvent>();
|
||||
vec.push_back( zone );
|
||||
|
||||
f.Read( &zone->cpuStart, sizeof( zone->cpuStart ) );
|
||||
f.Read( &zone->cpuEnd, sizeof( zone->cpuEnd ) );
|
||||
f.Read( &zone->gpuStart, sizeof( zone->gpuStart ) );
|
||||
f.Read( &zone->gpuEnd, sizeof( zone->gpuEnd ) );
|
||||
f.Read( &zone->srcloc, sizeof( zone->srcloc ) );
|
||||
f.Read( &zone->name, sizeof( zone->name ) );
|
||||
f.Read( &zone->thread, sizeof( zone->thread ) );
|
||||
ReadTimeline( f, zone->child );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -150,7 +150,9 @@ private:
|
||||
|
||||
void Write( FileWrite& f );
|
||||
void WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec );
|
||||
void WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec );
|
||||
void ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec );
|
||||
void ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec );
|
||||
|
||||
std::string m_addr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user