Save message color data in trace dumps.

This commit is contained in:
Bartosz Taudul 2019-05-10 20:32:47 +02:00
parent 8cbd83c752
commit 74575250a5
2 changed files with 25 additions and 3 deletions

View File

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

View File

@ -719,7 +719,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
if( eventMask & EventType::Messages )
{
m_data.messages.reserve_exact( sz, m_slab );
if( fileVer >= FileVersion( 0, 4, 2 ) )
if( fileVer >= FileVersion( 0, 4, 8 ) )
{
int64_t refTime = 0;
for( uint64_t i=0; i<sz; i++ )
@ -729,6 +729,22 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
auto msgdata = m_slab.Alloc<MessageData>();
msgdata->time = ReadTimeOffset( f, refTime );
f.Read( msgdata->ref );
f.Read( msgdata->color );
m_data.messages[i] = msgdata;
msgMap.emplace( ptr, msgdata );
}
}
else if( fileVer >= FileVersion( 0, 4, 2 ) )
{
int64_t refTime = 0;
for( uint64_t i=0; i<sz; i++ )
{
uint64_t ptr;
f.Read( ptr );
auto msgdata = m_slab.Alloc<MessageData>();
msgdata->time = ReadTimeOffset( f, refTime );
f.Read( msgdata->ref );
msgdata->color = 0xFFFFFFFF;
m_data.messages[i] = msgdata;
msgMap.emplace( ptr, msgdata );
}
@ -742,6 +758,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
auto msgdata = m_slab.Alloc<MessageData>();
f.Read( msgdata, sizeof( MessageData::time ) + sizeof( MessageData::ref ) );
if( fileVer <= FileVersion( 0, 3, 0 ) ) f.Skip( 7 );
msgdata->color = 0xFFFFFFFF;
m_data.messages[i] = msgdata;
msgMap.emplace( ptr, msgdata );
}
@ -754,10 +771,14 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
{
f.Skip( sz * ( sizeof( uint64_t ) + 24 ) );
}
else
else if( fileVer <= FileVersion( 0, 4, 7 ) )
{
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( MessageData::time ) + sizeof( MessageData::ref ) ) );
}
else
{
f.Skip( sz * ( sizeof( uint64_t ) + sizeof( MessageData::time ) + sizeof( MessageData::ref ) + sizeof( MessageData::color ) ) );
}
}
s_loadProgress.progress.store( LoadProgress::Zones, std::memory_order_relaxed );
@ -4067,6 +4088,7 @@ void Worker::Write( FileWrite& f )
f.Write( &ptr, sizeof( ptr ) );
WriteTimeOffset( f, refTime, v->time );
f.Write( &v->ref, sizeof( v->ref ) );
f.Write( &v->color, sizeof( v->color ) );
}
}