mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Try to fix current program's thread names.
External thread names can be cut-off to include only the first 15-or-so characters. If a local thread name is known and its beginning matches the external name, use the local name instead.
This commit is contained in:
parent
8bb13ca09e
commit
f8e3d1ad0a
@ -10519,15 +10519,20 @@ void View::DrawCpuDataWindow()
|
|||||||
for( auto& tid : pid.second.tids )
|
for( auto& tid : pid.second.tids )
|
||||||
{
|
{
|
||||||
const auto tidMatch = pidMatch && m_worker.IsThreadLocal( tid );
|
const auto tidMatch = pidMatch && m_worker.IsThreadLocal( tid );
|
||||||
|
auto tname = m_worker.GetExternalName( tid ).second;
|
||||||
if( tidMatch )
|
if( tidMatch )
|
||||||
{
|
{
|
||||||
|
auto lname = m_worker.GetThreadString( tid );
|
||||||
|
const auto tsz = strlen( tname );
|
||||||
|
const auto lsz = strlen( lname );
|
||||||
|
if( lsz > tsz && strncmp( tname, lname, tsz ) == 0 ) tname = lname;
|
||||||
ImGui::PushStyleColor( ImGuiCol_Text, ImVec4( 1.0f, 1.0f, 0.2f, 1.0f ) );
|
ImGui::PushStyleColor( ImGuiCol_Text, ImVec4( 1.0f, 1.0f, 0.2f, 1.0f ) );
|
||||||
}
|
}
|
||||||
const auto& tit = ctd.find( tid );
|
const auto& tit = ctd.find( tid );
|
||||||
assert( tit != ctd.end() );
|
assert( tit != ctd.end() );
|
||||||
ImGui::TextUnformatted( RealToString( tid, true ) );
|
ImGui::TextUnformatted( RealToString( tid, true ) );
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::TextUnformatted( m_worker.GetExternalName( tid ).second );
|
ImGui::TextUnformatted( tname );
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
sprintf( buf, "%s (%.2f%%)", TimeToString( tit->second.runningTime ), double( tit->second.runningTime ) * rtimespan * 100 );
|
sprintf( buf, "%s (%.2f%%)", TimeToString( tit->second.runningTime ), double( tit->second.runningTime ) * rtimespan * 100 );
|
||||||
ImGui::ProgressBar( double( tit->second.runningTime ) * rtimespan, ImVec2( -1, ty ), buf );
|
ImGui::ProgressBar( double( tit->second.runningTime ) * rtimespan, ImVec2( -1, ty ), buf );
|
||||||
|
Loading…
Reference in New Issue
Block a user