Fix the main library stop routine for timemory (#39)

* Fix the main library stop routine for timemory

- the main pop_timemory function was popping too many calls
- this primarily affected recursive calls

* Lengthen the timeout for the Configure CMake step

* Fix python tests

- new validate-timemory-json.py script

* Documentation update

- Call-counts in timemory output examples in documentation were affected by the changes

* Fix the per-thread metrics during finalization

- pthread_create_mutex starts/stops the per-thread data
- removed unintentional continue statement

* Docs tweaks

* Fix lap counter on per-thread metrics
This commit is contained in:
Jonathan R. Madsen
2022-06-13 15:57:44 -05:00
committed by GitHub
parent ab395f86c4
commit a142b2029d
12 changed files with 209 additions and 102 deletions
@@ -109,6 +109,8 @@ pthread_create_gotcha::wrapper::wrapper(routine_t _routine, void* _arg,
void*
pthread_create_gotcha::wrapper::operator()() const
{
using thread_bundle_data_t = thread_data<omnitrace_thread_bundle_t>;
if(is_shutdown && *is_shutdown)
{
if(m_promise) m_promise->set_value();
@@ -134,6 +136,10 @@ pthread_create_gotcha::wrapper::operator()() const
if(_tid >= 0)
{
get_execution_time(_tid)->second = comp::wall_clock::record();
auto& _thr_bundle = thread_bundle_data_t::instance();
if(_thr_bundle && _thr_bundle->get<comp::wall_clock>() &&
_thr_bundle->get<comp::wall_clock>()->get_is_running())
_thr_bundle->stop();
pthread_create_gotcha::shutdown(_tid);
}
set_thread_state(ThreadState::Completed);
@@ -146,6 +152,13 @@ pthread_create_gotcha::wrapper::operator()() const
{
_tid = threading::get_id();
threading::set_thread_name(TIMEMORY_JOIN(" ", "Thread", _tid).c_str());
if(!thread_bundle_data_t::instances().at(_tid))
{
thread_data<omnitrace_thread_bundle_t>::construct(
TIMEMORY_JOIN("", get_exe_name(), "/thread-", threading::get_id()),
quirk::config<quirk::auto_start>{});
thread_bundle_data_t::instances().at(_tid)->start();
}
if(bundles && bundles_mutex)
{
std::unique_lock<std::mutex> _lk{ *bundles_mutex };