1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

SetThreadName() only works on the current thread.

This breaking change is required, because kernel trace facilities use
kernel thread ids, which are inaccessible from the pthread_t level.
This commit is contained in:
Bartosz Taudul
2019-08-14 02:22:45 +02:00
parent 339b7fd2a6
commit 92b6da7cc2
6 changed files with 34 additions and 71 deletions
+3 -3
View File
@@ -1137,18 +1137,15 @@ Profiler::Profiler()
s_thread = (Thread*)tracy_malloc( sizeof( Thread ) );
new(s_thread) Thread( LaunchWorker, this );
SetThreadName( s_thread->Handle(), "Tracy Profiler" );
s_compressThread = (Thread*)tracy_malloc( sizeof( Thread ) );
new(s_compressThread) Thread( LaunchCompressWorker, this );
SetThreadName( s_compressThread->Handle(), "Tracy Profiler DXT1" );
#ifdef TRACY_HAS_SYSTEM_TRACING
if( SysTraceStart() )
{
s_sysTraceThread = (Thread*)tracy_malloc( sizeof( Thread ) );
new(s_sysTraceThread) Thread( SysTraceWorker, nullptr );
SetThreadName( s_sysTraceThread->Handle(), "Tracy Profiler system trace" );
}
#endif
@@ -1235,6 +1232,8 @@ void Profiler::Worker()
s_profilerTid = syscall( SYS_gettid );
#endif
SetThreadName( "Tracy Profiler" );
while( m_timeBegin.load( std::memory_order_relaxed ) == 0 ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
rpmalloc_thread_initialize();
@@ -1576,6 +1575,7 @@ void Profiler::Worker()
void Profiler::CompressWorker()
{
SetThreadName( "Tracy Profiler DXT1" );
while( m_timeBegin.load( std::memory_order_relaxed ) == 0 ) std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
rpmalloc_thread_initialize();
for(;;)