From b2252de9c848e9582f39b1ac0675e3e3a142e197 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 3 Oct 2017 23:26:41 +0200 Subject: [PATCH] Send and display program execution date. --- client/TracyProfiler.cpp | 1 + common/TracyProtocol.hpp | 1 + server/TracyView.cpp | 15 ++++++++++----- server/TracyView.hpp | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index c5b8beec..4aeeba30 100755 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -128,6 +128,7 @@ void Profiler::Worker() welcome.timeBegin = m_timeBegin; welcome.delay = m_delay; welcome.resolution = m_resolution; + welcome.epoch = std::chrono::duration_cast( std::chrono::system_clock::now().time_since_epoch() ).count(); memcpy( welcome.programName, procname, pnsz ); memset( welcome.programName + pnsz, 0, WelcomeMessageProgramNameSize - pnsz ); diff --git a/common/TracyProtocol.hpp b/common/TracyProtocol.hpp index 5334e0f6..bee493e7 100755 --- a/common/TracyProtocol.hpp +++ b/common/TracyProtocol.hpp @@ -34,6 +34,7 @@ struct WelcomeMessage uint64_t timeBegin; uint64_t delay; uint64_t resolution; + uint64_t epoch; char programName[WelcomeMessageProgramNameSize]; }; #pragma pack() diff --git a/server/TracyView.cpp b/server/TracyView.cpp index a056663a..4e6eb57a 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include "../common/TracyProtocol.hpp" #include "../common/TracySystem.hpp" @@ -198,7 +199,14 @@ void View::Worker() m_frames.push_back( welcome.timeBegin * m_timerMul ); m_delay = welcome.delay * m_timerMul; m_resolution = welcome.resolution * m_timerMul; - m_programName = welcome.programName; + + char dtmp[64]; + time_t date = welcome.epoch; + auto lt = localtime( &date ); + strftime( dtmp, 64, "%F %T", lt ); + char tmp[1024]; + sprintf( tmp, "%s @ %s###Profiler", welcome.programName, dtmp ); + m_captureName = tmp; } m_hasData.store( true, std::memory_order_release ); @@ -741,11 +749,8 @@ void View::DrawImpl() DrawConnection(); } - char title[1024]; - sprintf( title, "%s###Profiler", m_programName.c_str() ); - std::lock_guard lock( m_lock ); - ImGui::Begin( title, nullptr, ImGuiWindowFlags_ShowBorders ); + ImGui::Begin( m_captureName.c_str(), nullptr, ImGuiWindowFlags_ShowBorders ); if( ImGui::Button( m_pause ? "Resume" : "Pause", ImVec2( 80, 0 ) ) ) m_pause = !m_pause; ImGui::SameLine(); ImGui::Text( "Frames: %-7" PRIu64 " Time span: %-10s View span: %-10s Zones: %-10" PRIu64" Queue delay: %s Timer resolution: %s", m_frames.size(), TimeToString( GetLastTime() - m_frames[0] ), TimeToString( m_zvEnd - m_zvStart ), m_zonesCnt, TimeToString( m_delay ), TimeToString( m_resolution ) ); diff --git a/server/TracyView.hpp b/server/TracyView.hpp index c9b39118..c88890d0 100755 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -152,7 +152,7 @@ private: uint64_t m_delay; uint64_t m_resolution; double m_timerMul; - std::string m_programName; + std::string m_captureName; int8_t m_lastCpu;