Check mtime of profiled executable.

This commit is contained in:
Bartosz Taudul 2021-01-31 17:42:44 +01:00
parent 2890f24c97
commit 0ce113a96c
2 changed files with 13 additions and 1 deletions

View File

@ -57,6 +57,7 @@
#include <new>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <thread>
#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<size_t>( strlen( procname ), WelcomeMessageProgramNameSize - 1 );

View File

@ -759,7 +759,7 @@ private:
uint64_t m_delay;
std::atomic<int64_t> m_timeBegin;
uint64_t m_mainThread;
uint64_t m_epoch;
uint64_t m_epoch, m_exectime;
std::atomic<bool> m_shutdown;
std::atomic<bool> m_shutdownManual;
std::atomic<bool> m_shutdownFinished;