/** Is called by DoOneTimeInitializations and ITT_DoOneTimeInitialization in a protected (one-time) manner. Not to be invoked directly. **/ bool InitializeITT() { bool result = false; // Check if we are running under a performance or correctness tool bool t_checker = GetBoolEnvironmentVariable("KMP_FOR_TCHECK"); bool t_profiler = GetBoolEnvironmentVariable("KMP_FOR_TPROFILE"); __TBB_ASSERT(!(t_checker&&t_profiler), NULL); if ( t_checker || t_profiler ) { // Yes, we are in the tool mode. Try to load libittnotify library. result = FillDynamicLinks( LIBITTNOTIFY_NAME, ITT_HandlerTable, ITT_HandlerTable_size, 4 ); } if (result){ if ( t_checker ) { current_tool = ITC; } else if ( t_profiler ) { current_tool = ITP; } } else { // Clear away the proxy (dummy) handlers for (int i = 0; i < ITT_HandlerTable_size; i++) *ITT_HandlerTable[i].handler = NULL; current_tool = NONE; } PrintExtraVersionInfo( "ITT", result?"yes":"no" ); return result; }
/** Caller is responsible for ensuring this routine is called exactly once. */ void MallocInitializeITT() { bool success = false; // Check if we are running under control of VTune. if( GetBoolEnvironmentVariable("KMP_FOR_TCHECK") || GetBoolEnvironmentVariable("KMP_FOR_TPROFILE") ) { // Yes, we are under control of VTune. Check for libittnotify library. success = FillDynamicLinks( LIBITTNOTIFY_NAME, ITT_HandlerTable, 5 ); } if (!success){ for (int i = 0; i < 5; i++) *ITT_HandlerTable[i].handler = NULL; } }
//! Performs thread-safe lazy one-time general TBB initialization. void DoOneTimeInitializations() { suppress_unused_warning(_pad); __TBB_InitOnce::lock(); // No fence required for load of InitializationDone, because we are inside a critical section. if( !__TBB_InitOnce::InitializationDone ) { __TBB_InitOnce::add_ref(); if( GetBoolEnvironmentVariable("TBB_VERSION") ) PrintVersion(); bool itt_present = false; #if DO_ITT_NOTIFY ITT_DoUnsafeOneTimeInitialization(); itt_present = ITT_Present; #endif /* DO_ITT_NOTIFY */ initialize_cache_aligned_allocator(); governor::initialize_rml_factory(); Scheduler_OneTimeInitialization( itt_present ); // Force processor groups support detection governor::default_num_threads(); // Dump version data governor::print_version_info(); PrintExtraVersionInfo( "Tools support", itt_present ? "enabled" : "disabled" ); __TBB_InitOnce::InitializationDone = true; } __TBB_InitOnce::unlock(); }
/** Caller is responsible for ensuring this routine is called exactly once. */ void MallocInitializeITT() { #if __TBB_NEW_ITT_NOTIFY tbb::internal::__TBB_load_ittnotify(); #else bool success = false; // Check if we are running under control of VTune. if( GetBoolEnvironmentVariable("KMP_FOR_TCHECK") || GetBoolEnvironmentVariable("KMP_FOR_TPROFILE") ) { // Yes, we are under control of VTune. Check for libittnotify library. success = dynamic_link( LIBITTNOTIFY_NAME, ITT_HandlerTable, 5 ); } if (!success){ for (int i = 0; i < 5; i++) *ITT_HandlerTable[i].handler = NULL; } #endif /* !__TBB_NEW_ITT_NOTIFY */ }
//! Performs thread-safe lazy one-time general TBB initialization. void DoOneTimeInitializations() { __TBB_InitOnce::lock(); // No fence required for load of InitializationDone, because we are inside a critical section. if( !__TBB_InitOnce::InitializationDone ) { __TBB_InitOnce::add_ref(); if( GetBoolEnvironmentVariable("TBB_VERSION") ) PrintVersion(); bool have_itt = false; #if DO_ITT_NOTIFY ITT_DoUnsafeOneTimeInitialization(); have_itt = ITT_Present; #endif /* DO_ITT_NOTIFY */ initialize_cache_aligned_allocator(); #if __TBB_SURVIVE_THREAD_SWITCH initialize_survive_thread_switch(); #endif /* __TBB_SURVIVE_THREAD_SWITCH */ governor::print_version_info(); PrintExtraVersionInfo( "SCHEDULER", have_itt ? "default" : "Intel" ); Scheduler_OneTimeInitialization( have_itt ); __TBB_InitOnce::InitializationDone = true; } __TBB_InitOnce::unlock(); }