mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 09:14:36 +00:00
Add CPU usage graph tooltip.
This commit is contained in:
parent
7a9d4aecd3
commit
bfbd09b619
@ -4433,6 +4433,21 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover,
|
|||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
draw->AddLine( wpos + ImVec2( 0, offset+cpuUsageHeight+2 ), wpos + ImVec2( w, offset+cpuUsageHeight+2 ), 0x22DD88DD );
|
draw->AddLine( wpos + ImVec2( 0, offset+cpuUsageHeight+2 ), wpos + ImVec2( w, offset+cpuUsageHeight+2 ), 0x22DD88DD );
|
||||||
|
|
||||||
|
if( ImGui::IsMouseHoveringRect( ImVec2( wpos.x, wpos.y + offset ), ImVec2( wpos.x + w, wpos.y + offset + cpuUsageHeight ), true ) )
|
||||||
|
{
|
||||||
|
int usageOwn, usageOther;
|
||||||
|
m_worker.GetCpuUsageAtTime( m_vd.zvStart + ( ImGui::GetIO().MousePos.x - wpos.x ) * nspx, usageOwn, usageOther );
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
TextFocused( "Cores used by profiled program:", RealToString( usageOwn, true ) );
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextDisabled( "(%.2f%%)", usageOwn * cpuCntRev * 100 );
|
||||||
|
TextFocused( "Cores used by other programs:", RealToString( usageOther, true ) );
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextDisabled( "(%.2f%%)", usageOther * cpuCntRev * 100 );
|
||||||
|
TextFocused( "Number of cores:", RealToString( cpuCnt, true ) );
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
offset += cpuUsageHeight + 3;
|
offset += cpuUsageHeight + 3;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user