Compress thread id in MessageData.

This commit is contained in:
Bartosz Taudul 2019-08-28 21:03:01 +02:00
parent ede26b0caf
commit a2f968d843
3 changed files with 12 additions and 10 deletions

View File

@ -279,7 +279,7 @@ struct MessageData
{
int64_t time;
StringRef ref;
uint64_t thread;
uint16_t thread;
uint32_t color;
};

View File

@ -2100,7 +2100,7 @@ void View::DrawZones()
float animOff = 0;
if( dist > 1 )
{
if( m_msgHighlight && m_msgHighlight->thread == v->id )
if( m_msgHighlight && m_worker.DecompressThread( m_msgHighlight->thread ) == v->id )
{
const auto hTime = m_msgHighlight->time;
if( (*msgit)->time <= hTime && ( next == v->messages.end() || (*next)->time > hTime ) )
@ -6826,7 +6826,8 @@ void View::DrawMessages()
const auto filterActive = m_messageFilter.IsActive();
for( const auto& v : msgs )
{
if( VisibleMsgThread( v->thread ) )
const auto tid = m_worker.DecompressThread( v->thread );
if( VisibleMsgThread( tid ) )
{
const auto text = m_worker.GetString( v->ref );
if( !filterActive || m_messageFilter.PassFilter( text ) )
@ -6848,9 +6849,9 @@ void View::DrawMessages()
}
ImGui::PopID();
ImGui::NextColumn();
ImGui::TextUnformatted( m_worker.GetThreadName( v->thread ) );
ImGui::TextUnformatted( m_worker.GetThreadName( tid ) );
ImGui::SameLine();
ImGui::TextDisabled( "(%s)", RealToString( v->thread, true ) );
ImGui::TextDisabled( "(%s)", RealToString( tid, true ) );
ImGui::NextColumn();
ImGui::PushStyleColor( ImGuiCol_Text, v->color );
ImGui::TextWrapped( "%s", text );

View File

@ -913,6 +913,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
f.Read( msz );
if( eventMask & EventType::Messages )
{
const auto ctid = CompressThread( tid );
td->messages.reserve_exact( msz, m_slab );
for( uint64_t j=0; j<msz; j++ )
{
@ -920,7 +921,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
f.Read( ptr );
auto md = msgMap[ptr];
td->messages[j] = md;
md->thread = tid;
md->thread = ctid;
}
}
else
@ -3648,7 +3649,7 @@ void Worker::ProcessMessage( const QueueMessage& ev )
auto msg = m_slab.Alloc<MessageData>();
msg->time = TscTime( ev.time - m_data.baseTime );
msg->ref = StringRef( StringRef::Type::Idx, it->second.idx );
msg->thread = m_threadCtx;
msg->thread = CompressThread( m_threadCtx );
msg->color = 0xFFFFFFFF;
m_data.lastTime = std::max( m_data.lastTime, msg->time );
InsertMessageData( msg, m_threadCtx );
@ -3661,7 +3662,7 @@ void Worker::ProcessMessageLiteral( const QueueMessage& ev )
auto msg = m_slab.Alloc<MessageData>();
msg->time = TscTime( ev.time - m_data.baseTime );
msg->ref = StringRef( StringRef::Type::Ptr, ev.text );
msg->thread = m_threadCtx;
msg->thread = CompressThread( m_threadCtx );
msg->color = 0xFFFFFFFF;
m_data.lastTime = std::max( m_data.lastTime, msg->time );
InsertMessageData( msg, m_threadCtx );
@ -3674,7 +3675,7 @@ void Worker::ProcessMessageColor( const QueueMessageColor& ev )
auto msg = m_slab.Alloc<MessageData>();
msg->time = TscTime( ev.time - m_data.baseTime );
msg->ref = StringRef( StringRef::Type::Idx, it->second.idx );
msg->thread = m_threadCtx;
msg->thread = CompressThread( m_threadCtx );
msg->color = 0xFF000000 | ( ev.r << 16 ) | ( ev.g << 8 ) | ev.b;
m_data.lastTime = std::max( m_data.lastTime, msg->time );
InsertMessageData( msg, m_threadCtx );
@ -3687,7 +3688,7 @@ void Worker::ProcessMessageLiteralColor( const QueueMessageColor& ev )
auto msg = m_slab.Alloc<MessageData>();
msg->time = TscTime( ev.time - m_data.baseTime );
msg->ref = StringRef( StringRef::Type::Ptr, ev.text );
msg->thread = m_threadCtx;
msg->thread = CompressThread( m_threadCtx );
msg->color = 0xFF000000 | ( ev.r << 16 ) | ( ev.g << 8 ) | ev.b;
m_data.lastTime = std::max( m_data.lastTime, msg->time );
InsertMessageData( msg, m_threadCtx );