From 1f5381e56a292340d9cb1142eb5535924e2dce57 Mon Sep 17 00:00:00 2001 From: "Jonathan R. Madsen" Date: Tue, 27 Sep 2022 05:46:39 -0500 Subject: [PATCH] Fix thread_info::is_valid_time when threads do not terminate - was discarding samples - timemory fixes for BFD support --- .../library/components/pthread_create_gotcha.cpp | 16 ++++++++++++---- source/lib/omnitrace/library/sampling.cpp | 8 ++++---- source/lib/omnitrace/library/thread_info.cpp | 13 +++++++++---- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/source/lib/omnitrace/library/components/pthread_create_gotcha.cpp b/source/lib/omnitrace/library/components/pthread_create_gotcha.cpp index 2e56b98ab..2d09ae3d5 100644 --- a/source/lib/omnitrace/library/components/pthread_create_gotcha.cpp +++ b/source/lib/omnitrace/library/components/pthread_create_gotcha.cpp @@ -289,10 +289,18 @@ pthread_create_gotcha::shutdown() bundles->clear(); - OMNITRACE_BASIC_VERBOSE( - 1 && _ndangling > 0, - "[pthread_create_gotcha::shutdown] cleaned up %lu dangling bundles\n", - _ndangling); + if(config::settings_are_configured()) + { + OMNITRACE_VERBOSE(2 && _ndangling > 0, + "[pthread_create_gotcha] cleaned up %lu dangling bundles\n", + _ndangling); + } + else + { + OMNITRACE_BASIC_VERBOSE( + 2 && _ndangling > 0, + "[pthread_create_gotcha] cleaned up %lu dangling bundles\n", _ndangling); + } } void diff --git a/source/lib/omnitrace/library/sampling.cpp b/source/lib/omnitrace/library/sampling.cpp index b27eaf5a8..15981f3e3 100644 --- a/source/lib/omnitrace/library/sampling.cpp +++ b/source/lib/omnitrace/library/sampling.cpp @@ -534,10 +534,10 @@ post_process() if(_data.empty()) { - OMNITRACE_VERBOSE( - 3 || get_debug_sampling(), - "Sampler data for thread %lu has %zu valid entries... (skipped)\n", i, - _raw_data.size()); + OMNITRACE_VERBOSE(2 || get_debug_sampling(), + "Sampler data for thread %lu has zero valid entries out of " + "%zu... (skipped)\n", + i, _raw_data.size()); continue; } diff --git a/source/lib/omnitrace/library/thread_info.cpp b/source/lib/omnitrace/library/thread_info.cpp index 7d6bd14f5..675d846e9 100644 --- a/source/lib/omnitrace/library/thread_info.cpp +++ b/source/lib/omnitrace/library/thread_info.cpp @@ -53,17 +53,20 @@ init_index_data(int64_t _tid, bool _offset = false) if(!itr) { threading::offset_this_id(_offset); - itr = thread_index_data{}; + itr = thread_index_data{}; + int _verb = 2; + // if thread created using finalization, bump up the minimum verbosity level + if(get_state() == State::Finalized && _offset) _verb += 2; if(!config::settings_are_configured()) { OMNITRACE_BASIC_VERBOSE_F( - 2, "Thread %li on PID %i (rank: %i) assigned omnitrace TID %li\n", + _verb, "Thread %li on PID %i (rank: %i) assigned omnitrace TID %li\n", itr->system_value, process::get_id(), dmp::rank(), itr->sequent_value); } else { OMNITRACE_VERBOSE_F( - 2, "Thread %li on PID %i (rank: %i) assigned omnitrace TID %li\n", + _verb, "Thread %li on PID %i (rank: %i) assigned omnitrace TID %li\n", itr->system_value, process::get_id(), dmp::rank(), itr->sequent_value); } } @@ -149,10 +152,12 @@ thread_info::set_stop(uint64_t _ts) { for(auto& itr : thread_info_data_t::instances()) { - if(itr && itr->index_data && itr->index_data->internal_value > _tid) + if(itr && itr->index_data && itr->index_data->internal_value != _tid) { if(itr->lifetime.second > _v->lifetime.second) itr->lifetime.second = _v->lifetime.second; + else if(itr->lifetime.second == 0) + itr->lifetime.second = _v->lifetime.second; } } }