| 1407 | constexpr static size_t SafeSendBufferSize = 65536; |
| 1408 | |
| 1409 | Profiler::Profiler() |
| 1410 | : m_timeBegin( 0 ) |
| 1411 | , m_mainThread( detail::GetThreadHandleImpl() ) |
| 1412 | , m_epoch( std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch() ).count() ) |
| 1413 | , m_shutdown( false ) |
| 1414 | , m_shutdownManual( false ) |
| 1415 | , m_shutdownFinished( false ) |
| 1416 | , m_sock( nullptr ) |
| 1417 | , m_broadcast( nullptr ) |
| 1418 | , m_noExit( false ) |
| 1419 | , m_userPort( 0 ) |
| 1420 | , m_zoneId( 1 ) |
| 1421 | , m_samplingPeriod( 0 ) |
| 1422 | , m_stream( LZ4_createStream() ) |
| 1423 | , m_buffer( (char*)tracy_malloc( TargetFrameSize*3 ) ) |
| 1424 | , m_bufferOffset( 0 ) |
| 1425 | , m_bufferStart( 0 ) |
| 1426 | , m_lz4Buf( (char*)tracy_malloc( LZ4Size + sizeof( lz4sz_t ) ) ) |
| 1427 | , m_serialQueue( 1024*1024 ) |
| 1428 | , m_serialDequeue( 1024*1024 ) |
| 1429 | #ifndef TRACY_NO_FRAME_IMAGE |
| 1430 | , m_fiQueue( 16 ) |
| 1431 | , m_fiDequeue( 16 ) |
| 1432 | #endif |
| 1433 | , m_symbolQueue( 8*1024 ) |
| 1434 | , m_frameCount( 0 ) |
| 1435 | , m_isConnected( false ) |
| 1436 | #ifdef TRACY_ON_DEMAND |
| 1437 | , m_connectionId( 0 ) |
| 1438 | , m_deferredQueue( 64*1024 ) |
| 1439 | #endif |
| 1440 | , m_paramCallback( nullptr ) |
| 1441 | , m_sourceCallback( nullptr ) |
| 1442 | , m_queryImage( nullptr ) |
| 1443 | , m_queryData( nullptr ) |
| 1444 | , m_crashHandlerInstalled( false ) |
| 1445 | , m_programName( nullptr ) |
| 1446 | { |
| 1447 | assert( !s_instance ); |
| 1448 | s_instance = this; |
| 1449 | |
| 1450 | #ifndef TRACY_DELAYED_INIT |
| 1451 | # ifdef _MSC_VER |
| 1452 | // 3. But these variables need to be initialized in main thread within the .CRT$XCB section. Do it here. |
| 1453 | s_token_detail = moodycamel::ProducerToken( s_queue ); |
| 1454 | s_token = ProducerWrapper { s_queue.get_explicit_producer( s_token_detail ) }; |
| 1455 | s_threadHandle = ThreadHandleWrapper { m_mainThread }; |
| 1456 | # endif |
| 1457 | #endif |
| 1458 | |
| 1459 | CalibrateTimer(); |
| 1460 | CalibrateDelay(); |
| 1461 | ReportTopology(); |
| 1462 | |
| 1463 | #ifdef __linux__ |
| 1464 | m_kcore = (KCore*)tracy_malloc( sizeof( KCore ) ); |
| 1465 | new(m_kcore) KCore(); |
| 1466 | #endif |
nothing calls this directly
no test coverage detected