Skip to content

Commit

Permalink
Add pthread category
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmadsen committed Jul 21, 2022
1 parent f9e5c73 commit 3e89b55
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions source/lib/omnitrace/library/components/fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ TIMEMORY_DEFINE_NS_API(category, rocm_hip)
TIMEMORY_DEFINE_NS_API(category, rocm_hsa)
TIMEMORY_DEFINE_NS_API(category, rocm_smi)
TIMEMORY_DEFINE_NS_API(category, rocm_roctx)
TIMEMORY_DEFINE_NS_API(category, pthread)
TIMEMORY_DEFINE_NS_API(category, kokkos)
TIMEMORY_DEFINE_NS_API(category, mpi)
TIMEMORY_DEFINE_NS_API(category, ompt)
Expand All @@ -88,6 +89,7 @@ TIMEMORY_DEFINE_NAME_TRAIT("rocm_smi", category::rocm_smi);
TIMEMORY_DEFINE_NAME_TRAIT("rocm_roctx", category::rocm_roctx);
TIMEMORY_DEFINE_NAME_TRAIT("sampling", category::sampling);
TIMEMORY_DEFINE_NAME_TRAIT("thread_sampling", category::thread_sampling);
TIMEMORY_DEFINE_NAME_TRAIT("pthread", category::pthread);
TIMEMORY_DEFINE_NAME_TRAIT("kokkos", category::kokkos);
TIMEMORY_DEFINE_NAME_TRAIT("mpi", category::mpi);
TIMEMORY_DEFINE_NAME_TRAIT("ompt", category::ompt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ int
pthread_create_gotcha::operator()(pthread_t* thread, const pthread_attr_t* attr,
void* (*start_routine)(void*), void* arg) const
{
// auto _initial_thread_state = get_thread_state();
auto _initial_thread_state = get_thread_state();
OMNITRACE_SCOPED_THREAD_STATE(ThreadState::Internal);
bundle_t _bundle{ "pthread_create" };
auto _enable_sampling = pthread_gotcha::sampling_enabled_on_child_threads();
Expand All @@ -344,14 +344,14 @@ pthread_create_gotcha::operator()(pthread_t* thread, const pthread_attr_t* attr,
if(!get_use_sampling() || !_enable_sampling)
{
auto* _obj = new wrapper(start_routine, arg, _enable_sampling, _tid, nullptr);
// if(_active && !_coverage && _enable_sampling &&
// _initial_thread_state == ThreadState::Enabled)
// start_bundle(_bundle, audit::incoming{}, thread, attr, start_routine, arg);
if(_active && !_coverage && _enable_sampling &&
_initial_thread_state == ThreadState::Enabled)
start_bundle(_bundle, audit::incoming{}, thread, attr, start_routine, arg);
// create the thread
auto _ret = (*m_wrappee)(thread, attr, &wrapper::wrap, static_cast<void*>(_obj));
// if(_active && !_coverage && _enable_sampling &&
// _initial_thread_state == ThreadState::Enabled)
// stop_bundle(_bundle, _tid, audit::outgoing{}, _ret);
if(_active && !_coverage && _enable_sampling &&
_initial_thread_state == ThreadState::Enabled)
stop_bundle(_bundle, _tid, audit::outgoing{}, _ret);
return _ret;
}

Expand Down
3 changes: 2 additions & 1 deletion source/lib/omnitrace/library/perfetto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@
perfetto::Category("process_kernel_cpu_time") \
.SetDescription("CPU time of functions executing in kernel-space in " \
"process in seconds (collected in background thread)"), \
perfetto::Category("mpi").SetDescription("MPI regions"), \
perfetto::Category("pthread").SetDescription("Pthread functions"), \
perfetto::Category("kokkos").SetDescription("Kokkos regions"), \
perfetto::Category("mpi").SetDescription("MPI regions"), \
perfetto::Category("ompt").SetDescription("OpenMP Tools regions"), \
perfetto::Category("critical-trace").SetDescription("Combined critical traces"), \
perfetto::Category("host-critical-trace") \
Expand Down

0 comments on commit 3e89b55

Please sign in to comment.