diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 9cd7273d..2e49606d 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -1033,6 +1033,7 @@ Profiler::Profiler() , m_sock( nullptr ) , m_broadcast( nullptr ) , m_noExit( false ) + , m_userPort( 0 ) , m_zoneId( 1 ) , m_samplingPeriod( 0 ) , m_stream( LZ4_createStream() ) @@ -1076,6 +1077,12 @@ Profiler::Profiler() } #endif + const char* userPort = getenv( "TRACY_PORT" ); + if( userPort ) + { + m_userPort = atoi( userPort ); + } + s_thread = (Thread*)tracy_malloc( sizeof( Thread ) ); new(s_thread) Thread( LaunchWorker, this ); @@ -1169,9 +1176,9 @@ void Profiler::Worker() SetThreadName( "Tracy Profiler" ); #ifdef TRACY_DATA_PORT - const auto dataPort = TRACY_DATA_PORT; + const auto dataPort = m_userPort != 0 ? m_userPort : TRACY_DATA_PORT; #else - const auto dataPort = 8086; + const auto dataPort = m_userPort != 0 ? m_userPort : 8086; #endif #ifdef TRACY_BROADCAST_PORT const auto broadcastPort = TRACY_BROADCAST_PORT; diff --git a/client/TracyProfiler.hpp b/client/TracyProfiler.hpp index 4fa499b0..3ab94726 100644 --- a/client/TracyProfiler.hpp +++ b/client/TracyProfiler.hpp @@ -619,6 +619,7 @@ private: Socket* m_sock; UdpBroadcast* m_broadcast; bool m_noExit; + uint32_t m_userPort; std::atomic m_zoneId; int64_t m_samplingPeriod;