diff --git a/server/TracyVersion.hpp b/server/TracyVersion.hpp index 7574895f..59ddae75 100644 --- a/server/TracyVersion.hpp +++ b/server/TracyVersion.hpp @@ -7,7 +7,7 @@ namespace Version { enum { Major = 0 }; enum { Minor = 3 }; -enum { Patch = 204 }; +enum { Patch = 205 }; } } diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 21f5e042..1f586481 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -278,6 +278,38 @@ Worker::Worker( FileRead& f, EventType::Type eventMask ) m_captureName = std::string( tmp, tmp+sz ); } + if( fileVer >= FileVersion( 0, 3, 205 ) ) + { + f.Read( sz ); + assert( sz < 1024 ); + char tmp[1024]; + f.Read( tmp, sz ); + m_captureProgram = std::string( tmp, tmp+sz ); + + f.Read( m_captureTime ); + } + else + { + const auto sz = m_captureName.size(); + char tmp[1024]; + memcpy( tmp, m_captureName.c_str(), sz ); + tmp[sz] = '\0'; + auto ptr = tmp + sz - 1; + while( *ptr != '@' ) + { + if( *ptr == '#' ) *ptr = '\0'; + ptr--; + } + + m_captureProgram = std::string( tmp, ptr-1 ); + + tm epoch = {}; + sscanf( ptr+1, "%d-%d-%d %d:%d:%d", &epoch.tm_year, &epoch.tm_mon, &epoch.tm_mday, &epoch.tm_hour, &epoch.tm_min, &epoch.tm_sec ); + epoch.tm_year -= 1900; + epoch.tm_mon--; + m_captureTime = (uint64_t)mktime( &epoch ); + } + if( fileVer >= FileVersion( 0, 3, 203 ) ) { f.Read( sz ); @@ -1244,6 +1276,8 @@ void Worker::Exec() m_delay = TscTime( welcome.delay ); m_resolution = TscTime( welcome.resolution ); m_onDemand = welcome.onDemand; + m_captureProgram = welcome.programName; + m_captureTime = welcome.epoch; char dtmp[64]; time_t date = welcome.epoch; @@ -2980,6 +3014,12 @@ void Worker::Write( FileWrite& f ) f.Write( &sz, sizeof( sz ) ); f.Write( m_captureName.c_str(), sz ); + sz = m_captureProgram.size(); + f.Write( &sz, sizeof( sz ) ); + f.Write( m_captureProgram.c_str(), sz ); + + f.Write( &m_captureTime, sizeof( m_captureTime ) ); + sz = m_hostInfo.size(); f.Write( &sz, sizeof( sz ) ); f.Write( m_hostInfo.c_str(), sz ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 8d77f961..d35c0e7f 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -177,6 +177,8 @@ public: const std::string& GetAddr() const { return m_addr; } const std::string& GetCaptureName() const { return m_captureName; } + const std::string& GetCaptureProgram() const { return m_captureProgram; } + uint64_t GetCaptureTime() const { return m_captureTime; } const std::string& GetHostInfo() const { return m_hostInfo; } int64_t GetDelay() const { return m_delay; } int64_t GetResolution() const { return m_resolution; } @@ -379,6 +381,8 @@ private: int64_t m_resolution; double m_timerMul; std::string m_captureName; + std::string m_captureProgram; + uint64_t m_captureTime; std::string m_hostInfo; bool m_terminate; bool m_crashed;