Save/load CPU thread data.

This commit is contained in:
Bartosz Taudul 2019-08-18 01:53:38 +02:00
parent 62dbe522c5
commit 3b8518f7b6
2 changed files with 20 additions and 0 deletions

View File

@ -449,6 +449,8 @@ struct CpuThreadData
uint32_t migrations = 0;
};
enum { CpuThreadDataSize = sizeof( CpuThreadData ) };
}
#endif

View File

@ -1517,6 +1517,16 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
f.Read2( tid, pid );
m_data.tidToPid.emplace( tid, pid );
}
f.Read( sz );
for( uint64_t i=0; i<sz; i++ )
{
uint64_t tid;
CpuThreadData data;
f.Read( tid );
f.Read( data );
m_data.cpuThreadData.emplace( tid, data );
}
}
s_loadProgress.total.store( 0, std::memory_order_relaxed );
@ -5093,6 +5103,14 @@ void Worker::Write( FileWrite& f )
f.Write( &v.first, sizeof( v.first ) );
f.Write( &v.second, sizeof( v.second ) );
}
sz = m_data.cpuThreadData.size();
f.Write( &sz, sizeof( sz ) );
for( auto& v : m_data.cpuThreadData )
{
f.Write( &v.first, sizeof( v.first ) );
f.Write( &v.second, sizeof( v.second ) );
}
}
void Worker::WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec, int64_t& refTime )