From 0ce113a96cca0cedcead445bb12d8ce86468d6ea Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 31 Jan 2021 17:42:44 +0100 Subject: [PATCH] Check mtime of profiled executable. --- client/TracyProfiler.cpp | 12 ++++++++++++ client/TracyProfiler.hpp | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 2f94eaef..96a9f348 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -57,6 +57,7 @@ #include #include #include +#include #include #include "../common/TracyAlign.hpp" @@ -1260,6 +1261,17 @@ void Profiler::Worker() rpmalloc_thread_initialize(); + m_exectime = 0; + const auto execname = GetProcessExecutablePath(); + if( execname ) + { + struct stat st; + if( stat( execname, &st ) == 0 ) + { + m_exectime = (uint64_t)st.st_mtime; + } + } + const auto procname = GetProcessName(); const auto pnsz = std::min( strlen( procname ), WelcomeMessageProgramNameSize - 1 ); diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 697f5fa6..fb8c8077 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -759,7 +759,7 @@ private: uint64_t m_delay; std::atomic m_timeBegin; uint64_t m_mainThread; - uint64_t m_epoch; + uint64_t m_epoch, m_exectime; std::atomic m_shutdown; std::atomic m_shutdownManual; std::atomic m_shutdownFinished;