mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 05:03:53 +00:00
Allow specification of port through env variable.
This commit is contained in:
parent
2671245d41
commit
c6bb08355c
@ -1033,6 +1033,7 @@ Profiler::Profiler()
|
|||||||
, m_sock( nullptr )
|
, m_sock( nullptr )
|
||||||
, m_broadcast( nullptr )
|
, m_broadcast( nullptr )
|
||||||
, m_noExit( false )
|
, m_noExit( false )
|
||||||
|
, m_userPort( 0 )
|
||||||
, m_zoneId( 1 )
|
, m_zoneId( 1 )
|
||||||
, m_samplingPeriod( 0 )
|
, m_samplingPeriod( 0 )
|
||||||
, m_stream( LZ4_createStream() )
|
, m_stream( LZ4_createStream() )
|
||||||
@ -1076,6 +1077,12 @@ Profiler::Profiler()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char* userPort = getenv( "TRACY_PORT" );
|
||||||
|
if( userPort )
|
||||||
|
{
|
||||||
|
m_userPort = atoi( userPort );
|
||||||
|
}
|
||||||
|
|
||||||
s_thread = (Thread*)tracy_malloc( sizeof( Thread ) );
|
s_thread = (Thread*)tracy_malloc( sizeof( Thread ) );
|
||||||
new(s_thread) Thread( LaunchWorker, this );
|
new(s_thread) Thread( LaunchWorker, this );
|
||||||
|
|
||||||
@ -1169,9 +1176,9 @@ void Profiler::Worker()
|
|||||||
SetThreadName( "Tracy Profiler" );
|
SetThreadName( "Tracy Profiler" );
|
||||||
|
|
||||||
#ifdef TRACY_DATA_PORT
|
#ifdef TRACY_DATA_PORT
|
||||||
const auto dataPort = TRACY_DATA_PORT;
|
const auto dataPort = m_userPort != 0 ? m_userPort : TRACY_DATA_PORT;
|
||||||
#else
|
#else
|
||||||
const auto dataPort = 8086;
|
const auto dataPort = m_userPort != 0 ? m_userPort : 8086;
|
||||||
#endif
|
#endif
|
||||||
#ifdef TRACY_BROADCAST_PORT
|
#ifdef TRACY_BROADCAST_PORT
|
||||||
const auto broadcastPort = TRACY_BROADCAST_PORT;
|
const auto broadcastPort = TRACY_BROADCAST_PORT;
|
||||||
|
@ -619,6 +619,7 @@ private:
|
|||||||
Socket* m_sock;
|
Socket* m_sock;
|
||||||
UdpBroadcast* m_broadcast;
|
UdpBroadcast* m_broadcast;
|
||||||
bool m_noExit;
|
bool m_noExit;
|
||||||
|
uint32_t m_userPort;
|
||||||
std::atomic<uint32_t> m_zoneId;
|
std::atomic<uint32_t> m_zoneId;
|
||||||
int64_t m_samplingPeriod;
|
int64_t m_samplingPeriod;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user