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);
|
||||
|
||||
+10
-10
@@ -55,25 +55,25 @@ extern "C"
|
||||
rocprofsys_annotated_region_func_t annotated_progress;
|
||||
|
||||
/// @var start_trace
|
||||
/// @brief callback for enabling tracing globally
|
||||
/// @brief Callback for enabling user defined tracing globally.
|
||||
/// @var stop_trace
|
||||
/// @brief callback for disabling tracing globally
|
||||
/// @brief Callback for disabling user defined tracing globally.
|
||||
/// @var start_thread_trace
|
||||
/// @brief callback for enabling tracing on current thread
|
||||
/// @brief Callback for enabling user defined tracing on the current thread.
|
||||
/// @var stop_thread_trace
|
||||
/// @brief callback for disabling tracing on current thread
|
||||
/// @brief Callback for disabling user defined tracing on the current thread.
|
||||
/// @var push_region
|
||||
/// @brief callback for starting a trace region
|
||||
/// @brief Callback for starting a user defined trace region.
|
||||
/// @var pop_region
|
||||
/// @brief callback for ending a trace region
|
||||
/// @brief Callback for ending a user defined trace region.
|
||||
/// @var progress
|
||||
/// @brief callback for marking an causal profiling event
|
||||
/// @brief Callback for marking a causal profiling event.
|
||||
/// @var push_annotated_region
|
||||
/// @brief callback for starting a trace region + annotations
|
||||
/// @brief Callback for starting a user defined trace region with annotations.
|
||||
/// @var pop_annotated_region
|
||||
/// @brief callback for ending a trace region + annotations
|
||||
/// @brief Callback for ending a user defined trace region with annotations.
|
||||
/// @var annotated_progress
|
||||
/// @brief callback for marking an causal profiling event + annotations
|
||||
/// @brief Callback for marking a causal profiling event with annotations.
|
||||
} rocprofsys_user_callbacks_t;
|
||||
|
||||
/// @enum ROCPROFSYS_USER_CONFIGURE_MODE
|
||||
|
||||
@@ -43,24 +43,26 @@ extern "C"
|
||||
|
||||
/// @fn int rocprofsys_user_start_trace(void)
|
||||
/// @return rocprofsys_user_error_t value
|
||||
/// @brief Enable tracing on this thread and all subsequently created threads
|
||||
/// @brief Enable user defined tracing on this thread and on all subsequently created
|
||||
/// threads.
|
||||
extern int rocprofsys_user_start_trace(void) ROCPROFSYS_PUBLIC_API;
|
||||
|
||||
/// @fn int rocprofsys_user_stop_trace(void)
|
||||
/// @return rocprofsys_user_error_t value
|
||||
/// @brief Disable tracing on this thread and all subsequently created threads
|
||||
/// @brief Disable user defined tracing on this thread and on all subsequently created
|
||||
/// threads.
|
||||
extern int rocprofsys_user_stop_trace(void) ROCPROFSYS_PUBLIC_API;
|
||||
|
||||
/// @fn int rocprofsys_user_start_thread_trace(void)
|
||||
/// @return rocprofsys_user_error_t value
|
||||
/// @brief Enable tracing on this specific thread. Does not apply to subsequently
|
||||
/// created threads
|
||||
/// @brief Enable user defined tracing on this specific thread. Does not apply to
|
||||
/// subsequently created threads.
|
||||
extern int rocprofsys_user_start_thread_trace(void) ROCPROFSYS_PUBLIC_API;
|
||||
|
||||
/// @fn int rocprofsys_user_stop_thread_trace(void)
|
||||
/// @return rocprofsys_user_error_t value
|
||||
/// @brief Disable tracing on this specific thread. Does not apply to subsequently
|
||||
/// created threads
|
||||
/// @brief Disable user defined tracing on this specific thread. Does not apply to
|
||||
/// subsequently created threads.
|
||||
extern int rocprofsys_user_stop_thread_trace(void) ROCPROFSYS_PUBLIC_API;
|
||||
|
||||
/// @fn int rocprofsys_user_push_region(const char* id)
|
||||
|
||||
Reference in New Issue
Block a user