More PR feedback

This commit is contained in:
Joshua Kriegshauser 2024-10-02 12:50:12 -07:00
parent e1554a13e0
commit 66edfaec42
2 changed files with 5 additions and 4 deletions

View File

@ -1390,6 +1390,8 @@ TRACY_API LuaZoneState& GetLuaZoneState() { return s_luaZoneState; }
TRACY_API bool ProfilerAvailable() { return s_instance != nullptr; } TRACY_API bool ProfilerAvailable() { return s_instance != nullptr; }
TRACY_API bool ProfilerAllocatorAvailable() { return !RpThreadShutdown; } TRACY_API bool ProfilerAllocatorAvailable() { return !RpThreadShutdown; }
constexpr static size_t SafeSendBufferSize = 65536;
Profiler::Profiler() Profiler::Profiler()
: m_timeBegin( 0 ) : m_timeBegin( 0 )
, m_mainThread( detail::GetThreadHandleImpl() ) , m_mainThread( detail::GetThreadHandleImpl() )
@ -1463,7 +1465,7 @@ Profiler::Profiler()
m_userPort = atoi( userPort ); m_userPort = atoi( userPort );
} }
m_safeSendBuffer = (char*)tracy_malloc( m_safeSendBufferSize ); m_safeSendBuffer = (char*)tracy_malloc( SafeSendBufferSize );
#ifndef _WIN32 #ifndef _WIN32
pipe(m_pipe); pipe(m_pipe);
@ -1471,7 +1473,7 @@ Profiler::Profiler()
// FreeBSD/XNU don't have F_SETPIPE_SZ, so use the default // FreeBSD/XNU don't have F_SETPIPE_SZ, so use the default
m_pipeBufSize = 16384; m_pipeBufSize = 16384;
# else # else
m_pipeBufSize = (int)(ptrdiff_t)m_safeSendBufferSize; m_pipeBufSize = (int)(ptrdiff_t)SafeSendBufferSize;
while( fcntl( m_pipe[0], F_SETPIPE_SZ, m_pipeBufSize ) < 0 && errno == EPERM ) m_pipeBufSize /= 2; // too big; reduce while( fcntl( m_pipe[0], F_SETPIPE_SZ, m_pipeBufSize ) < 0 && errno == EPERM ) m_pipeBufSize /= 2; // too big; reduce
m_pipeBufSize = fcntl( m_pipe[0], F_GETPIPE_SZ ); m_pipeBufSize = fcntl( m_pipe[0], F_GETPIPE_SZ );
# endif # endif
@ -3104,7 +3106,7 @@ char* Profiler::SafeCopyProlog( const char* data, size_t size )
assert( !m_inUse.exchange(true) ); assert( !m_inUse.exchange(true) );
#endif #endif
if( size > m_safeSendBufferSize ) buf = (char*)tracy_malloc( size ); if( size > SafeSendBufferSize ) buf = (char*)tracy_malloc( size );
#ifdef _WIN32 #ifdef _WIN32
__try __try

View File

@ -1010,7 +1010,6 @@ private:
std::atomic_bool m_inUse{ false }; std::atomic_bool m_inUse{ false };
#endif #endif
char* m_safeSendBuffer; char* m_safeSendBuffer;
constexpr static size_t m_safeSendBufferSize = 65536;
#if defined _WIN32 #if defined _WIN32
void* m_prevHandler; void* m_prevHandler;