From 800d95c08924b1a4d18943bc1d664fb7eca7971a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 18 Jun 2019 20:51:12 +0200 Subject: [PATCH] Display discovered clients activity times. --- profiler/src/main.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index e238873f..7ccf82bf 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -32,6 +32,7 @@ #include "../../server/TracyBadVersion.hpp" #include "../../server/TracyFileRead.hpp" #include "../../server/TracyImGui.hpp" +#include "../../server/TracyPrint.hpp" #include "../../server/TracyStorage.hpp" #include "../../server/TracyView.hpp" #include "../../server/TracyWorker.hpp" @@ -89,6 +90,7 @@ struct ClientData { int64_t time; uint32_t protocolVersion; + uint32_t activeTime; std::string procName; std::string address; }; @@ -305,16 +307,18 @@ int main( int argc, char** argv ) { const uint32_t protoVer = bm.protocolVersion; const auto procname = bm.programName; + const auto activeTime = bm.activeTime; auto address = addr.GetText(); auto it = clients.find( addr.GetNumber() ); if( it == clients.end() ) { - clients.emplace( addr.GetNumber(), ClientData { t, protoVer, procname, address } ); + clients.emplace( addr.GetNumber(), ClientData { t, protoVer, activeTime, procname, address } ); } else { it->second.time = t; + it->second.activeTime = activeTime; if( it->second.protocolVersion != protoVer ) it->second.protocolVersion = protoVer; if( strcmp( it->second.procName.c_str(), procname ) != 0 ) it->second.procName = procname; if( strcmp( it->second.address.c_str(), address ) != 0 ) it->second.address = address; @@ -470,7 +474,16 @@ int main( int argc, char** argv ) ImGui::Separator(); ImGui::TextUnformatted( "Discovered clients:" ); ImGui::Separator(); - ImGui::Columns( 2 ); + static bool widthSet = false; + ImGui::Columns( 3 ); + if( !widthSet ) + { + widthSet = true; + const auto w = ImGui::GetWindowWidth(); + ImGui::SetColumnWidth( 0, w * 0.35f ); + ImGui::SetColumnWidth( 1, w * 0.175f ); + ImGui::SetColumnWidth( 2, w * 0.425f ); + } for( auto& v : clients ) { const bool badProto = v.second.protocolVersion != tracy::ProtocolVersion; @@ -483,6 +496,15 @@ int main( int argc, char** argv ) } ImGui::NextColumn(); if( badProto ) + { + tracy::TextDisabledUnformatted( tracy::TimeToString( v.second.activeTime * 1000000000ll ) ); + } + else + { + ImGui::TextUnformatted( tracy::TimeToString( v.second.activeTime * 1000000000ll ) ); + } + ImGui::NextColumn(); + if( badProto ) { tracy::TextDisabledUnformatted( v.second.procName.c_str() ); }