Add user_api_active flag to enable/disable user-defined regions (#312)
* Add user start/stop bool * Update documentation for user-api * Update projects/rocprofiler-systems/source/lib/rocprof-sys-dl/dl.cpp Co-authored-by: Aleksandar Djordjevic <aleksandar.djordjevic@amd.com> * Format fix --------- Co-authored-by: Aleksandar Djordjevic <aleksandar.djordjevic@amd.com>
This commit is contained in:
committed by
GitHub
parent
9fa00a76d3
commit
3ee393047c
@@ -511,6 +511,13 @@ get_active()
|
||||
return *_v;
|
||||
}
|
||||
|
||||
auto&
|
||||
get_user_api_active()
|
||||
{
|
||||
static bool _v{ false };
|
||||
return _v;
|
||||
}
|
||||
|
||||
auto&
|
||||
get_enabled()
|
||||
{
|
||||
@@ -797,12 +804,14 @@ extern "C"
|
||||
int rocprofsys_user_start_trace_dl(void)
|
||||
{
|
||||
dl::get_enabled().store(true);
|
||||
dl::get_user_api_active() = true;
|
||||
return rocprofsys_user_start_thread_trace_dl();
|
||||
}
|
||||
|
||||
int rocprofsys_user_stop_trace_dl(void)
|
||||
{
|
||||
dl::get_enabled().store(false);
|
||||
dl::get_user_api_active() = false;
|
||||
return rocprofsys_user_stop_thread_trace_dl();
|
||||
}
|
||||
|
||||
@@ -820,13 +829,13 @@ extern "C"
|
||||
|
||||
int rocprofsys_user_push_region_dl(const char* name)
|
||||
{
|
||||
if(!dl::get_active()) return 0;
|
||||
if(!dl::get_active() && !dl::get_user_api_active()) return 0;
|
||||
return ROCPROFSYS_DL_INVOKE(get_indirect().rocprofsys_push_region_f, name);
|
||||
}
|
||||
|
||||
int rocprofsys_user_pop_region_dl(const char* name)
|
||||
{
|
||||
if(!dl::get_active()) return 0;
|
||||
if(!dl::get_active() && !dl::get_user_api_active()) return 0;
|
||||
return ROCPROFSYS_DL_INVOKE(get_indirect().rocprofsys_pop_region_f, name);
|
||||
}
|
||||
|
||||
@@ -840,7 +849,7 @@ extern "C"
|
||||
rocprofsys_annotation_t* _annotations,
|
||||
size_t _annotation_count)
|
||||
{
|
||||
if(!dl::get_active()) return 0;
|
||||
if(!dl::get_active() && !dl::get_user_api_active()) return 0;
|
||||
return ROCPROFSYS_DL_INVOKE(get_indirect().rocprofsys_push_category_region_f,
|
||||
ROCPROFSYS_CATEGORY_USER, name, _annotations,
|
||||
_annotation_count);
|
||||
@@ -850,7 +859,7 @@ extern "C"
|
||||
rocprofsys_annotation_t* _annotations,
|
||||
size_t _annotation_count)
|
||||
{
|
||||
if(!dl::get_active()) return 0;
|
||||
if(!dl::get_active() && !dl::get_user_api_active()) return 0;
|
||||
return ROCPROFSYS_DL_INVOKE(get_indirect().rocprofsys_pop_category_region_f,
|
||||
ROCPROFSYS_CATEGORY_USER, name, _annotations,
|
||||
_annotation_count);
|
||||
|
||||
Reference in New Issue
Block a user