Synchronous Tracing Services#
Rocprofiler SDK Developer API 0.4.0
ROCm Profiling API and tools
|
Receive immediate callbacks on the calling thread. More...
Typedefs | |
typedef void(* | rocprofiler_callback_tracing_cb_t) (rocprofiler_callback_tracing_record_t record, rocprofiler_user_data_t *user_data, void *callback_data) |
API Tracing callback function. This function is invoked twice per API function: once before the function is invoked and once after the function is invoked. The external correlation id value within the record is assigned the value at the top of the external correlation id stack. It is permissible to invoke rocprofiler_push_external_correlation_id within the enter phase; when a new external correlation id is pushed during the enter phase, rocprofiler will use that external correlation id for any async events and provide the new external correlation id during the exit callback... In other words, pushing a new external correlation id within the enter callback will result in that external correlation id value in the exit callback (which may or may not be different from the external correlation id value in the enter callback). If a tool pushes new external correlation ids in the enter phase, it is recommended to pop the external correlation id in the exit callback. | |
typedef int(* | rocprofiler_callback_tracing_kind_cb_t) (rocprofiler_callback_tracing_kind_t kind, void *data) |
Callback function for mapping rocprofiler_callback_tracing_kind_t ids to string names. | |
typedef int(* | rocprofiler_callback_tracing_kind_operation_cb_t) (rocprofiler_callback_tracing_kind_t kind, uint32_t operation, void *data) |
Callback function for mapping the operations of a given rocprofiler_callback_tracing_kind_t to string names. | |
typedef int(* | rocprofiler_callback_tracing_operation_args_cb_t) (rocprofiler_callback_tracing_kind_t kind, uint32_t operation, uint32_t arg_number, const void *const arg_value_addr, int32_t arg_indirection_count, const char *arg_type, const char *arg_name, const char *arg_value_str, int32_t arg_dereference_count, void *data) |
Callback function for iterating over the function arguments to a traced function. This function will be invoked for each argument. | |
Enumerations | |
enum | rocprofiler_code_object_storage_type_t { ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_NONE = HSA_VEN_AMD_LOADER_CODE_OBJECT_STORAGE_TYPE_NONE , ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_FILE = HSA_VEN_AMD_LOADER_CODE_OBJECT_STORAGE_TYPE_FILE , ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_MEMORY , ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_LAST } |
ROCProfiler Enumeration for code object storage types (identical values to hsa_ven_amd_loader_code_object_storage_type_t enumeration) More... | |
Functions | |
rocprofiler_status_t | rocprofiler_configure_callback_tracing_service (rocprofiler_context_id_t context_id, rocprofiler_callback_tracing_kind_t kind, rocprofiler_tracing_operation_t *operations, unsigned long operations_count, rocprofiler_callback_tracing_cb_t callback, void *callback_args) |
Configure Callback Tracing Service. The callback tracing service provides two synchronous callbacks around an API function on the same thread as the application which is invoking the API function. This function can only be invoked once per rocprofiler_callback_tracing_kind_t value, i.e. it can be invoked once for the HSA API, once for the HIP API, and so on but it will fail if it is invoked for the HSA API twice. Please note, the callback API does have the potentially non-trivial overhead of copying the function arguments into the record. If you are willing to let rocprofiler record the timestamps, do not require synchronous notifications of the API calls, and want to lowest possible overhead, use the. | |
rocprofiler_status_t | rocprofiler_query_callback_tracing_kind_name (rocprofiler_callback_tracing_kind_t kind, const char **name, uint64_t *name_len) |
Query the name of the callback tracing kind. The name retrieved from this function is a string literal that is encoded in the read-only section of the binary (i.e. it is always "allocated" and never "deallocated"). | |
rocprofiler_status_t | rocprofiler_query_callback_tracing_kind_operation_name (rocprofiler_callback_tracing_kind_t kind, uint32_t operation, const char **name, uint64_t *name_len) |
Query the name of the callback tracing kind. The name retrieved from this function is a string literal that is encoded in the read-only section of the binary (i.e. it is always "allocated" and never "deallocated"). | |
rocprofiler_status_t | rocprofiler_iterate_callback_tracing_kinds (rocprofiler_callback_tracing_kind_cb_t callback, void *data) |
Iterate over all the mappings of the callback tracing kinds and get a callback for each kind. | |
rocprofiler_status_t | rocprofiler_iterate_callback_tracing_kind_operations (rocprofiler_callback_tracing_kind_t kind, rocprofiler_callback_tracing_kind_operation_cb_t callback, void *data) |
Iterates over all the mappings of the operations for a given rocprofiler_callback_tracing_kind_t and invokes the callback with the kind id, operation id, and user-provided data. | |
rocprofiler_status_t | rocprofiler_iterate_callback_tracing_kind_operation_args (rocprofiler_callback_tracing_record_t record, rocprofiler_callback_tracing_operation_args_cb_t callback, int32_t max_dereference_count, void *user_data) |
Detailed Description
Receive immediate callbacks on the calling thread.
Data Structure Documentation
◆ rocprofiler_callback_tracing_hsa_api_data_t
struct rocprofiler_callback_tracing_hsa_api_data_t |
ROCProfiler HSA API Callback Data.
Definition at line 63 of file callback_tracing.h.
Data Fields | ||
---|---|---|
rocprofiler_hsa_api_args_t | args | |
rocprofiler_hsa_api_retval_t | retval | |
uint64_t | size | size of this struct |
◆ rocprofiler_callback_tracing_hip_api_data_t
struct rocprofiler_callback_tracing_hip_api_data_t |
ROCProfiler HIP runtime and compiler API Tracer Callback Data.
Definition at line 73 of file callback_tracing.h.
Data Fields | ||
---|---|---|
rocprofiler_hip_api_args_t | args | |
rocprofiler_hip_api_retval_t | retval | |
uint64_t | size | size of this struct |
◆ rocprofiler_callback_tracing_marker_api_data_t
struct rocprofiler_callback_tracing_marker_api_data_t |
ROCProfiler Marker Tracer Callback Data.
Definition at line 83 of file callback_tracing.h.
Data Fields | ||
---|---|---|
rocprofiler_marker_api_args_t | args | |
rocprofiler_marker_api_retval_t | retval | |
uint64_t | size | size of this struct |
◆ rocprofiler_callback_tracing_code_object_load_data_t
struct rocprofiler_callback_tracing_code_object_load_data_t |
ROCProfiler Code Object Load Tracer Callback Record.
Definition at line 93 of file callback_tracing.h.
Data Fields | ||
---|---|---|
union rocprofiler_callback_tracing_code_object_load_data_t.__unnamed9__ | __unnamed__ | |
uint64_t | code_object_id | unique code object identifier |
hsa_agent_t | hsa_agent | The agent on which this loaded code object is loaded. |
uint64_t | load_base | The base memory address at which the code object is loaded. This is the base address of the allocation for the lowest addressed segment of the code object that is loaded. Note that any non-loaded segments before the first loaded segment are ignored. |
int64_t | load_delta | The signed byte address difference of the memory address at which the code object is loaded minus the virtual address specified in the code object that is loaded. |
uint64_t | load_size | The byte size of the loaded code objects contiguous memory allocation. |
rocprofiler_agent_id_t | rocp_agent | The agent on which this loaded code object is loaded. |
uint64_t | size | size of this struct |
rocprofiler_code_object_storage_type_t | storage_type | storage type of the code object reader used to load the loaded code object |
const char * | uri | The URI name from which the code object was loaded. |
◆ rocprofiler_callback_tracing_code_object_kernel_symbol_register_data_t
struct rocprofiler_callback_tracing_code_object_kernel_symbol_register_data_t |
ROCProfiler Code Object Kernel Symbol Tracer Callback Record.
- Examples
- api_buffered_tracing/client.cpp.
Definition at line 137 of file callback_tracing.h.
◆ rocprofiler_callback_tracing_kernel_dispatch_data_t
struct rocprofiler_callback_tracing_kernel_dispatch_data_t |
ROCProfiler Kernel Dispatch Callback Tracer Record.
Definition at line 163 of file callback_tracing.h.
Data Fields | ||
---|---|---|
rocprofiler_kernel_dispatch_info_t | dispatch_info | Dispatch info. |
rocprofiler_timestamp_t | end_timestamp | end time in nanoseconds |
uint64_t | size | size of this struct |
rocprofiler_timestamp_t | start_timestamp | start time in nanoseconds |
◆ rocprofiler_callback_tracing_memory_copy_data_t
struct rocprofiler_callback_tracing_memory_copy_data_t |
ROCProfiler Memory Copy Callback Tracer Record.
The timestamps in this record will only be non-zero in the ROCPROFILER_CALLBACK_PHASE_EXIT callback
Definition at line 177 of file callback_tracing.h.
Data Fields | ||
---|---|---|
uint64_t | bytes | bytes copied |
rocprofiler_agent_id_t | dst_agent_id | destination agent of copy |
rocprofiler_timestamp_t | end_timestamp | end time in nanoseconds |
uint64_t | size | size of this struct |
rocprofiler_agent_id_t | src_agent_id | source agent of copy |
rocprofiler_timestamp_t | start_timestamp | start time in nanoseconds |
◆ rocprofiler_callback_tracing_scratch_memory_data_t
struct rocprofiler_callback_tracing_scratch_memory_data_t |
ROCProfiler Scratch Memory Callback Data.
Definition at line 190 of file callback_tracing.h.
Data Fields | ||
---|---|---|
rocprofiler_agent_id_t | agent_id | |
rocprofiler_scratch_memory_args_t | args | |
hsa_amd_tool_event_kind_t | args_kind | |
rocprofiler_scratch_alloc_flag_t | flags | |
rocprofiler_queue_id_t | queue_id | |
uint64_t | size | size of this struct |
◆ rocprofiler_callback_tracing_code_object_load_data_t.__unnamed9__
union rocprofiler_callback_tracing_code_object_load_data_t.__unnamed9__ |
Definition at line 111 of file callback_tracing.h.
Data Fields | ||
---|---|---|
struct rocprofiler_callback_tracing_code_object_load_data_t.__unnamed9__.__unnamed11__ | __unnamed__ | |
struct rocprofiler_callback_tracing_code_object_load_data_t.__unnamed9__.__unnamed13__ | __unnamed__ |
◆ rocprofiler_callback_tracing_code_object_load_data_t.__unnamed9__.__unnamed11__
struct rocprofiler_callback_tracing_code_object_load_data_t.__unnamed9__.__unnamed11__ |
Definition at line 113 of file callback_tracing.h.
Data Fields | ||
---|---|---|
int | storage_file | file descriptor of the code object that was loaded. Access this field if rocprofiler_code_object_storage_type_t is ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_FILE |
◆ rocprofiler_callback_tracing_code_object_load_data_t.__unnamed9__.__unnamed13__
struct rocprofiler_callback_tracing_code_object_load_data_t.__unnamed9__.__unnamed13__ |
Definition at line 119 of file callback_tracing.h.
Data Fields | ||
---|---|---|
uint64_t | memory_base | The memory address of the first byte of the code object that was loaded. Access this field if rocprofiler_code_object_storage_type_t is ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_MEMORY. |
uint64_t | memory_size | The memory size in bytes of the code object that was loaded. Access this field if rocprofiler_code_object_storage_type_t is ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_MEMORY. |
Typedef Documentation
◆ rocprofiler_callback_tracing_cb_t
typedef void(* rocprofiler_callback_tracing_cb_t) (rocprofiler_callback_tracing_record_t record, rocprofiler_user_data_t *user_data, void *callback_data) |
API Tracing callback function. This function is invoked twice per API function: once before the function is invoked and once after the function is invoked. The external correlation id value within the record is assigned the value at the top of the external correlation id stack. It is permissible to invoke rocprofiler_push_external_correlation_id within the enter phase; when a new external correlation id is pushed during the enter phase, rocprofiler will use that external correlation id for any async events and provide the new external correlation id during the exit callback... In other words, pushing a new external correlation id within the enter callback will result in that external correlation id value in the exit callback (which may or may not be different from the external correlation id value in the enter callback). If a tool pushes new external correlation ids in the enter phase, it is recommended to pop the external correlation id in the exit callback.
- Parameters
-
[in] record Callback record data [in,out] user_data This paramter can be used to retain information in between the enter and exit phases. [in] callback_data User data provided when configuring the callback tracing service
Definition at line 218 of file callback_tracing.h.
◆ rocprofiler_callback_tracing_kind_cb_t
typedef int(* rocprofiler_callback_tracing_kind_cb_t) (rocprofiler_callback_tracing_kind_t kind, void *data) |
Callback function for mapping rocprofiler_callback_tracing_kind_t ids to string names.
- See also
- rocprofiler_iterate_callback_tracing_kind_names.
Definition at line 226 of file callback_tracing.h.
◆ rocprofiler_callback_tracing_kind_operation_cb_t
typedef int(* rocprofiler_callback_tracing_kind_operation_cb_t) (rocprofiler_callback_tracing_kind_t kind, uint32_t operation, void *data) |
Callback function for mapping the operations of a given rocprofiler_callback_tracing_kind_t to string names.
- See also
- rocprofiler_iterate_callback_tracing_kind_operation_names.
Definition at line 234 of file callback_tracing.h.
◆ rocprofiler_callback_tracing_operation_args_cb_t
typedef int(* rocprofiler_callback_tracing_operation_args_cb_t) (rocprofiler_callback_tracing_kind_t kind, uint32_t operation, uint32_t arg_number, const void *const arg_value_addr, int32_t arg_indirection_count, const char *arg_type, const char *arg_name, const char *arg_value_str, int32_t arg_dereference_count, void *data) |
Callback function for iterating over the function arguments to a traced function. This function will be invoked for each argument.
- See also
- rocprofiler_iterate_callback_tracing_operation_args
- Parameters
-
[in] kind domain [in] operation associated domain operation [in] arg_number the argument number, starting at zero [in] arg_value_addr the address of the argument stored by rocprofiler. [in] arg_indirection_count the total number of indirection levels for the argument, e.g. int == 0, int* == 1, int** == 2 [in] arg_type the typeid name of the argument [in] arg_name the name of the argument in the prototype (or rocprofiler union) [in] arg_value_str conversion of the argument to a string, e.g. operator<< overload [in] arg_dereference_count the number of times the argument was dereferenced when it was converted to a string [in] data user data
Definition at line 257 of file callback_tracing.h.
Enumeration Type Documentation
◆ rocprofiler_code_object_storage_type_t
ROCProfiler Enumeration for code object storage types (identical values to hsa_ven_amd_loader_code_object_storage_type_t
enumeration)
Enumerator | |
---|---|
ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_NONE | |
ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_FILE | |
ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_MEMORY | |
ROCPROFILER_CODE_OBJECT_STORAGE_TYPE_LAST |
Definition at line 51 of file callback_tracing.h.
Function Documentation
◆ rocprofiler_configure_callback_tracing_service()
rocprofiler_status_t rocprofiler_configure_callback_tracing_service | ( | rocprofiler_context_id_t | context_id, |
rocprofiler_callback_tracing_kind_t | kind, | ||
rocprofiler_tracing_operation_t * | operations, | ||
unsigned long | operations_count, | ||
rocprofiler_callback_tracing_cb_t | callback, | ||
void * | callback_args | ||
) |
Configure Callback Tracing Service. The callback tracing service provides two synchronous callbacks around an API function on the same thread as the application which is invoking the API function. This function can only be invoked once per rocprofiler_callback_tracing_kind_t value, i.e. it can be invoked once for the HSA API, once for the HIP API, and so on but it will fail if it is invoked for the HSA API twice. Please note, the callback API does have the potentially non-trivial overhead of copying the function arguments into the record. If you are willing to let rocprofiler record the timestamps, do not require synchronous notifications of the API calls, and want to lowest possible overhead, use the.
- See also
- Asynchronous Tracing Service.
- Parameters
-
[in] context_id Context to associate the service with [in] kind The domain of the callback tracing service [in] operations Array of operations in the domain (i.e. enum values which identify specific API functions). If this is null, all API functions in the domain will be traced [in] operations_count If the operations array is non-null, set this to the size of the array. [in] callback The function to invoke before and after an API function [in] callback_args Data provided to every invocation of the callback function
- Returns
- rocprofiler_status_t
- Return values
-
ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKED Invoked outside of the initialization function in rocprofiler_tool_configure_result_t provided to rocprofiler via rocprofiler_configure function ROCPROFILER_STATUS_ERROR_CONTEXT_NOT_FOUND The provided context is not valid/registered ROCPROFILER_STATUS_ERROR_SERVICE_ALREADY_CONFIGURED if the same rocprofiler_callback_tracing_kind_t value is provided more than once (per context) – in other words, we do not support overriding or combining the operations in separate function calls.
◆ rocprofiler_iterate_callback_tracing_kind_operation_args()
rocprofiler_status_t rocprofiler_iterate_callback_tracing_kind_operation_args | ( | rocprofiler_callback_tracing_record_t | record, |
rocprofiler_callback_tracing_operation_args_cb_t | callback, | ||
int32_t | max_dereference_count, | ||
void * | user_data | ||
) |
◆ rocprofiler_iterate_callback_tracing_kind_operations()
rocprofiler_status_t rocprofiler_iterate_callback_tracing_kind_operations | ( | rocprofiler_callback_tracing_kind_t | kind, |
rocprofiler_callback_tracing_kind_operation_cb_t | callback, | ||
void * | data | ||
) |
Iterates over all the mappings of the operations for a given rocprofiler_callback_tracing_kind_t and invokes the callback with the kind id, operation id, and user-provided data.
- Parameters
-
[in] kind which tracing callback kind operations to iterate over [in] callback Callback function invoked for each operation associated with rocprofiler_callback_tracing_kind_t with the exception of the NONE
andLAST
values.[in] data User data passed back into the callback
- Returns
- rocprofiler_status_t
- Return values
-
ROCPROFILER_STATUS_ERROR_KIND_NOT_FOUND Invalid domain id ROCPROFILER_STATUS_SUCCESS Valid domain
Referenced by rocprofiler::sdk::get_callback_tracing_names().
◆ rocprofiler_iterate_callback_tracing_kinds()
rocprofiler_status_t rocprofiler_iterate_callback_tracing_kinds | ( | rocprofiler_callback_tracing_kind_cb_t | callback, |
void * | data | ||
) |
Iterate over all the mappings of the callback tracing kinds and get a callback for each kind.
- Parameters
-
[in] callback Callback function invoked for each enumeration value in rocprofiler_callback_tracing_kind_t with the exception of the NONE
andLAST
values.[in] data User data passed back into the callback
- Returns
- rocprofiler_status_t
Referenced by rocprofiler::sdk::get_callback_tracing_names().
◆ rocprofiler_query_callback_tracing_kind_name()
rocprofiler_status_t rocprofiler_query_callback_tracing_kind_name | ( | rocprofiler_callback_tracing_kind_t | kind, |
const char ** | name, | ||
uint64_t * | name_len | ||
) |
Query the name of the callback tracing kind. The name retrieved from this function is a string literal that is encoded in the read-only section of the binary (i.e. it is always "allocated" and never "deallocated").
- Parameters
-
[in] kind Callback tracing domain [out] name If non-null and the name is a constant string that does not require dynamic allocation, this paramter will be set to the address of the string literal, otherwise it will be set to nullptr [out] name_len If non-null, this will be assigned the length of the name (regardless of the name is a constant string or requires dynamic allocation)
- Returns
- rocprofiler_status_t
Referenced by rocprofiler::sdk::get_callback_tracing_names().
◆ rocprofiler_query_callback_tracing_kind_operation_name()
rocprofiler_status_t rocprofiler_query_callback_tracing_kind_operation_name | ( | rocprofiler_callback_tracing_kind_t | kind, |
uint32_t | operation, | ||
const char ** | name, | ||
uint64_t * | name_len | ||
) |
Query the name of the callback tracing kind. The name retrieved from this function is a string literal that is encoded in the read-only section of the binary (i.e. it is always "allocated" and never "deallocated").
- Parameters
-
[in] kind Callback tracing domain [in] operation Enumeration id value which maps to a specific API function or event type [out] name If non-null and the name is a constant string that does not require dynamic allocation, this paramter will be set to the address of the string literal, otherwise it will be set to nullptr [out] name_len If non-null, this will be assigned the length of the name (regardless of the name is a constant string or requires dynamic allocation)
- Returns
- rocprofiler_status_t
- Return values
-
ROCPROFILER_STATUS_ERROR_KIND_NOT_FOUND Domain id is not valid ROCPROFILER_STATUS_SUCCESS Valid domain provided, regardless if there is a constant string or not.
Referenced by rocprofiler::sdk::get_callback_tracing_names().
Generated by 1.9.8