From 747f26ef74a6a6bc7b37e80e5101be2fb6b7aff4 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 24 Apr 2020 02:02:16 +0200 Subject: [PATCH] Display used CPUs as range, if possible. --- profiler/src/main.cpp | 1 + server/TracyView.cpp | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 53c5596a..ccf84f23 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -267,6 +267,7 @@ int main( int argc, char** argv ) 0x0020, 0x00FF, // Basic Latin + Latin Supplement 0x03BC, 0x03BC, // micro 0x03C3, 0x03C3, // small sigma + 0x2013, 0x2013, // en dash 0, }; static const ImWchar rangesIcons[] = { diff --git a/server/TracyView.cpp b/server/TracyView.cpp index e26db6b7..d9658209 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -6437,7 +6437,32 @@ void View::DrawZoneInfoWindow() } else { - ImGui::Text( "%i,", i ); + int consecutive = 1; + int remaining = numCpus; + for(;;) + { + if( cpus[i+consecutive] == 0 ) break; + consecutive++; + if( --remaining == 0 ) break; + } + if( consecutive > 2 ) + { + if( remaining == 0 ) + { + ImGui::Text( "%i \xE2\x80\x93 %i", i, i+consecutive-1 ); + break; + } + else + { + ImGui::Text( "%i \xE2\x80\x93 %i,", i, i+consecutive-1 ); + i += consecutive - 1; + numCpus = remaining; + } + } + else + { + ImGui::Text( "%i,", i ); + } } } }