| 1561 | } |
| 1562 | |
| 1563 | void Profiler::SpawnWorkerThreads() |
| 1564 | { |
| 1565 | #ifdef TRACY_HAS_SYSTEM_TRACING |
| 1566 | // use TRACY_NO_SYS_TRACE=1 to force disabling sys tracing (even if available in the underlying system) |
| 1567 | // as it can have significant impact on the size of the traces |
| 1568 | const char* noSysTrace = GetEnvVar( "TRACY_NO_SYS_TRACE" ); |
| 1569 | const bool disableSystrace = (noSysTrace && noSysTrace[0] == '1'); |
| 1570 | if( disableSystrace ) |
| 1571 | { |
| 1572 | TracyDebug("TRACY: Sys Trace was disabled by 'TRACY_NO_SYS_TRACE=1'\n"); |
| 1573 | } |
| 1574 | else if( SysTraceStart( m_samplingPeriod ) ) |
| 1575 | { |
| 1576 | s_sysTraceThread = (Thread*)tracy_malloc( sizeof( Thread ) ); |
| 1577 | new(s_sysTraceThread) Thread( SysTraceWorker, nullptr ); |
| 1578 | std::this_thread::sleep_for( std::chrono::milliseconds( 1 ) ); |
| 1579 | } |
| 1580 | #endif |
| 1581 | |
| 1582 | s_thread = (Thread*)tracy_malloc( sizeof( Thread ) ); |
| 1583 | new(s_thread) Thread( LaunchWorker, this ); |
| 1584 | |
| 1585 | #ifndef TRACY_NO_FRAME_IMAGE |
| 1586 | s_compressThread = (Thread*)tracy_malloc( sizeof( Thread ) ); |
| 1587 | new(s_compressThread) Thread( LaunchCompressWorker, this ); |
| 1588 | #endif |
| 1589 | |
| 1590 | #ifdef TRACY_HAS_CALLSTACK |
| 1591 | s_symbolThread = (Thread*)tracy_malloc( sizeof( Thread ) ); |
| 1592 | new(s_symbolThread) Thread( LaunchSymbolWorker, this ); |
| 1593 | #endif |
| 1594 | |
| 1595 | #if defined _WIN32 && !defined TRACY_UWP && !defined TRACY_NO_CRASH_HANDLER |
| 1596 | s_profilerThreadId = GetThreadId( s_thread->Handle() ); |
| 1597 | # ifdef TRACY_HAS_CALLSTACK |
| 1598 | s_symbolThreadId = GetThreadId( s_symbolThread->Handle() ); |
| 1599 | # endif |
| 1600 | #endif |
| 1601 | |
| 1602 | #ifdef TRACY_HAS_CALLSTACK |
| 1603 | InitCallstackCritical(); |
| 1604 | #endif |
| 1605 | |
| 1606 | m_timeBegin.store( GetTime(), std::memory_order_relaxed ); |
| 1607 | } |
| 1608 | |
| 1609 | Profiler::~Profiler() |
| 1610 | { |
no test coverage detected