| 1379 | TRACY_API bool ProfilerAllocatorAvailable() { return !RpThreadShutdown; } |
| 1380 | |
| 1381 | Profiler::Profiler() |
| 1382 | : m_timeBegin( 0 ) |
| 1383 | , m_mainThread( detail::GetThreadHandleImpl() ) |
| 1384 | , m_epoch( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count() ) |
| 1385 | , m_shutdown( false ) |
| 1386 | , m_shutdownManual( false ) |
| 1387 | , m_shutdownFinished( false ) |
| 1388 | , m_sock( nullptr ) |
| 1389 | , m_broadcast( nullptr ) |
| 1390 | , m_noExit( false ) |
| 1391 | , m_userPort( 0 ) |
| 1392 | , m_zoneId( 1 ) |
| 1393 | , m_samplingPeriod( 0 ) |
| 1394 | , m_stream( LZ4_createStream() ) |
| 1395 | , m_buffer( (char*)tracy_malloc( TargetFrameSize*3 ) ) |
| 1396 | , m_bufferOffset( 0 ) |
| 1397 | , m_bufferStart( 0 ) |
| 1398 | , m_lz4Buf( (char*)tracy_malloc( LZ4Size + sizeof( lz4sz_t ) ) ) |
| 1399 | , m_serialQueue( 1024*1024 ) |
| 1400 | , m_serialDequeue( 1024*1024 ) |
| 1401 | #ifndef TRACY_NO_FRAME_IMAGE |
| 1402 | , m_fiQueue( 16 ) |
| 1403 | , m_fiDequeue( 16 ) |
| 1404 | #endif |
| 1405 | , m_symbolQueue( 8*1024 ) |
| 1406 | , m_frameCount( 0 ) |
| 1407 | , m_isConnected( false ) |
| 1408 | #ifdef TRACY_ON_DEMAND |
| 1409 | , m_connectionId( 0 ) |
| 1410 | , m_deferredQueue( 64*1024 ) |
| 1411 | #endif |
| 1412 | , m_paramCallback( nullptr ) |
| 1413 | , m_sourceCallback( nullptr ) |
| 1414 | , m_queryImage( nullptr ) |
| 1415 | , m_queryData( nullptr ) |
| 1416 | , m_crashHandlerInstalled( false ) |
| 1417 | , m_programName( nullptr ) |
| 1418 | { |
| 1419 | assert( !s_instance ); |
| 1420 | s_instance = this; |
| 1421 | |
| 1422 | #ifndef TRACY_DELAYED_INIT |
| 1423 | # ifdef _MSC_VER |
| 1424 | // 3. But these variables need to be initialized in main thread within the .CRT$XCB section. Do it here. |
| 1425 | s_token_detail = moodycamel::ProducerToken( s_queue ); |
| 1426 | s_token = ProducerWrapper { s_queue.get_explicit_producer( s_token_detail ) }; |
| 1427 | s_threadHandle = ThreadHandleWrapper { m_mainThread }; |
| 1428 | # endif |
| 1429 | #endif |
| 1430 | |
| 1431 | CalibrateTimer(); |
| 1432 | CalibrateDelay(); |
| 1433 | ReportTopology(); |
| 1434 | |
| 1435 | #ifdef __linux__ |
| 1436 | m_kcore = (KCore*)tracy_malloc( sizeof( KCore ) ); |
| 1437 | new(m_kcore) KCore(); |
| 1438 | #endif |
nothing calls this directly
no test coverage detected