Send and display program execution date.

This commit is contained in:
Bartosz Taudul 2017-10-03 23:26:41 +02:00
parent 7526ac83b5
commit b2252de9c8
4 changed files with 13 additions and 6 deletions

View File

@ -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::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count();
memcpy( welcome.programName, procname, pnsz );
memset( welcome.programName + pnsz, 0, WelcomeMessageProgramNameSize - pnsz );

View File

@ -34,6 +34,7 @@ struct WelcomeMessage
uint64_t timeBegin;
uint64_t delay;
uint64_t resolution;
uint64_t epoch;
char programName[WelcomeMessageProgramNameSize];
};
#pragma pack()

View File

@ -9,6 +9,7 @@
#include <inttypes.h>
#include <limits>
#include <stdlib.h>
#include <time.h>
#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<std::mutex> 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 ) );

View File

@ -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;