Add CPU data thread highlight.

This commit is contained in:
Bartosz Taudul 2019-11-24 01:40:32 +01:00
parent 07e69a88c2
commit ace780ea74
2 changed files with 28 additions and 4 deletions

View File

@ -2008,6 +2008,7 @@ void View::DrawZones()
m_lockHoverHighlight.Decay( InvalidId ); m_lockHoverHighlight.Decay( InvalidId );
m_drawThreadMigrations.Decay( 0 ); m_drawThreadMigrations.Decay( 0 );
m_drawThreadHighlight.Decay( 0 ); m_drawThreadHighlight.Decay( 0 );
m_cpuDataThread.Decay( 0 );
m_zoneHover = nullptr; m_zoneHover = nullptr;
if( m_vd.zvStart == m_vd.zvEnd ) return; if( m_vd.zvStart == m_vd.zvEnd ) return;
@ -2532,6 +2533,11 @@ void View::DrawZones()
draw->AddRectFilled( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( w, offset ), 0x2288DD88 ); draw->AddRectFilled( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( w, offset ), 0x2288DD88 );
draw->AddRect( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( w, offset ), 0x4488DD88 ); draw->AddRect( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( w, offset ), 0x4488DD88 );
} }
if( m_cpuDataThread == v->id )
{
draw->AddRectFilled( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( w, offset ), 0x2DFF8888 );
draw->AddRect( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( w, offset ), 0x4DFF8888 );
}
DrawTextContrast( draw, wpos + ImVec2( ty, oldOffset ), labelColor, txt ); DrawTextContrast( draw, wpos + ImVec2( ty, oldOffset ), labelColor, txt );
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( ty + txtsz.x, oldOffset + ty ) ) ) if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 0, oldOffset ), wpos + ImVec2( ty + txtsz.x, oldOffset + ty ) ) )
@ -4740,6 +4746,7 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover,
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextDisabled( "(%s)", RealToString( thread, true ) ); ImGui::TextDisabled( "(%s)", RealToString( thread, true ) );
m_drawThreadMigrations = thread; m_drawThreadMigrations = thread;
m_cpuDataThread = thread;
} }
else else
{ {
@ -11867,7 +11874,11 @@ void View::DrawCpuDataWindow()
const auto expand = ImGui::TreeNode( pidtxt ); const auto expand = ImGui::TreeNode( pidtxt );
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )
{ {
if( pidMatch ) m_drawThreadMigrations = pid.first; if( pidMatch )
{
m_drawThreadMigrations = pid.first;
m_cpuDataThread = pid.first;
}
m_drawThreadHighlight = pid.first; m_drawThreadHighlight = pid.first;
} }
const auto tsz = pid.second.tids.size(); const auto tsz = pid.second.tids.size();
@ -11880,7 +11891,11 @@ void View::DrawCpuDataWindow()
ImGui::TextUnformatted( pid.first == 0 ? "???" : name ); ImGui::TextUnformatted( pid.first == 0 ? "???" : name );
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )
{ {
if( pidMatch ) m_drawThreadMigrations = pid.first; if( pidMatch )
{
m_drawThreadMigrations = pid.first;
m_cpuDataThread = pid.first;
}
m_drawThreadHighlight = pid.first; m_drawThreadHighlight = pid.first;
} }
ImGui::NextColumn(); ImGui::NextColumn();
@ -11923,7 +11938,11 @@ void View::DrawCpuDataWindow()
ImGui::TextUnformatted( RealToString( tid, true ) ); ImGui::TextUnformatted( RealToString( tid, true ) );
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )
{ {
if( tidMatch ) m_drawThreadMigrations = tid; if( tidMatch )
{
m_drawThreadMigrations = tid;
m_cpuDataThread = tid;
}
m_drawThreadHighlight = tid; m_drawThreadHighlight = tid;
} }
ImGui::NextColumn(); ImGui::NextColumn();
@ -11935,7 +11954,11 @@ void View::DrawCpuDataWindow()
ImGui::TextUnformatted( tname ); ImGui::TextUnformatted( tname );
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )
{ {
if( tidMatch ) m_drawThreadMigrations = tid; if( tidMatch )
{
m_drawThreadMigrations = tid;
m_cpuDataThread = tid;
}
m_drawThreadHighlight = tid; m_drawThreadHighlight = tid;
} }
ImGui::NextColumn(); ImGui::NextColumn();

View File

@ -314,6 +314,7 @@ private:
Region m_highlight; Region m_highlight;
Region m_highlightZoom; Region m_highlightZoom;
DecayValue<uint64_t> m_cpuDataThread = 0;
uint64_t m_gpuThread = 0; uint64_t m_gpuThread = 0;
int64_t m_gpuStart = 0; int64_t m_gpuStart = 0;
int64_t m_gpuEnd = 0; int64_t m_gpuEnd = 0;