Skip to content

Commit

Permalink
Minor changes to fix thread tracing
Browse files Browse the repository at this point in the history
When threads are created before main (looking at you, CUDA), or are
not terminated before main terminates (looking at you, Iris), we need
to make sure that the registered new threads have a thread ID. To do
that, the top level timers for those threads should have synchronous
start/stop events, otherwise they get a single "unified" event at the
end with the thread ID belonging to the main thread (because it is
the one cleaning up a the end).
  • Loading branch information
khuck committed May 20, 2024
1 parent abb795e commit a704117
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/apex/apex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,7 @@ void register_thread(const std::string &name,
std::shared_ptr<task_wrapper> twp =
new_task(task_name, UINTMAX_MAX,
(parent == nullptr ? task_wrapper::get_apex_main_wrapper() : parent));
twp->explicit_trace_start = true;
start(twp);
//printf("New thread: %p\n", &(*twp));
thread_instance::set_top_level_timer(twp);
Expand Down
1 change: 1 addition & 0 deletions src/wrappers/pthread_wrapper_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class apex_wrapper {
apex::register_thread("APEX pthread wrapper", parent);
//_twp = apex::new_task((apex_function_address)func, UINTMAX_MAX, parent);
_twp = apex::new_task((apex_function_address)func);
_twp->explicit_trace_start = true;
}
~apex_wrapper() {
this->stop();
Expand Down

0 comments on commit a704117

Please sign in to comment.