Agent Profile Counting Service

Agent Profile Counting Service#

Rocprofiler SDK Developer API: Agent Profile Counting Service
Rocprofiler SDK Developer API 0.6.0
ROCm Profiling API and tools
Agent Profile Counting Service

needs brief description More...

Typedefs

typedef rocprofiler_status_t(* rocprofiler_agent_set_profile_callback_t) (rocprofiler_context_id_t context_id, rocprofiler_profile_config_id_t config_id)
 Callback to set the profile config for the agent.
 
typedef void(* rocprofiler_device_counting_service_callback_t) (rocprofiler_context_id_t context_id, rocprofiler_agent_id_t agent_id, rocprofiler_agent_set_profile_callback_t set_config, void *user_data)
 Configure Profile Counting Service for agent. Called when the context is started. Selects the counters to be used for agent profiling.
 

Functions

rocprofiler_status_t rocprofiler_configure_device_counting_service (rocprofiler_context_id_t context_id, rocprofiler_buffer_id_t buffer_id, rocprofiler_agent_id_t agent_id, rocprofiler_device_counting_service_callback_t cb, void *user_data)
 Configure Device Counting Service for agent. There may only be one counting service configured per agent in a context and can be only one active context that is profiling a single agent at a time. Multiple agent contexts can be started at the same time if they are profiling different agents.
 
rocprofiler_status_t rocprofiler_sample_device_counting_service (rocprofiler_context_id_t context_id, rocprofiler_user_data_t user_data, rocprofiler_counter_flag_t flags, rocprofiler_record_counter_t *output_records, unsigned long *rec_count)
 Trigger a read of the counter data for the agent profile. The counter data will be written to the buffer specified in rocprofiler_configure_device_counting_service. The data in rocprofiler_user_data_t will be written to the buffer along with the counter data. flags can be used to specify if this call should be performed asynchronously (default is synchronous).
 

Detailed Description

needs brief description

Typedef Documentation

◆ rocprofiler_agent_set_profile_callback_t

typedef rocprofiler_status_t(* rocprofiler_agent_set_profile_callback_t) (rocprofiler_context_id_t context_id, rocprofiler_profile_config_id_t config_id)

Callback to set the profile config for the agent.

Parameters
[in]context_idcontext id
[in]config_idProfile config detailing the counters to collect for this kernel
Returns
rocprofiler_status_t
Return values
ROCPROFILER_STATUS_ERROR_PROFILE_NOT_FOUNDReturned if the config_id is not found
ROCPROFILER_STATUS_ERROR_CONTEXT_INVALIDReturned if the ctx is not valid
ROCPROFILER_STATUS_ERROR_CONFIGURATION_LOCKEDReturned if attempting to make this call outside of context startup.
ROCPROFILER_STATUS_ERROR_AGENT_MISMATCHAgent of profile does not match agent of the context.
ROCPROFILER_STATUS_SUCCESSReturned if succesfully configured

Definition at line 50 of file device_counting_service.h.

◆ rocprofiler_device_counting_service_callback_t

typedef void(* rocprofiler_device_counting_service_callback_t) (rocprofiler_context_id_t context_id, rocprofiler_agent_id_t agent_id, rocprofiler_agent_set_profile_callback_t set_config, void *user_data)

Configure Profile Counting Service for agent. Called when the context is started. Selects the counters to be used for agent profiling.

Parameters
[in]context_idcontext id
[in]agent_idagent id
[in]set_configFunction to call to set the profile config (see rocprofiler_agent_set_profile_callback_t)
[in]user_dataData supplied to rocprofiler_configure_device_counting_service

Definition at line 64 of file device_counting_service.h.

Function Documentation

◆ rocprofiler_configure_device_counting_service()

rocprofiler_status_t rocprofiler_configure_device_counting_service ( rocprofiler_context_id_t  context_id,
rocprofiler_buffer_id_t  buffer_id,
rocprofiler_agent_id_t  agent_id,
rocprofiler_device_counting_service_callback_t  cb,
void *  user_data 
)

Configure Device Counting Service for agent. There may only be one counting service configured per agent in a context and can be only one active context that is profiling a single agent at a time. Multiple agent contexts can be started at the same time if they are profiling different agents.

Parameters
[in]context_idcontext id
[in]buffer_idid of the buffer to use for the counting service. When rocprofiler_sample_device_counting_service is called, counter data will be written to this buffer.
[in]agent_idagent to configure profiling on.
[in]cbCallback called when the context is started for the tool to specify what counters to collect (rocprofiler_profile_config_id_t).
[in]user_dataUser supplied data to be passed to the callback cb when triggered
Returns
rocprofiler_status_t
Return values
ROCPROFILER_STATUS_ERROR_CONTEXT_INVALIDReturned if the context does not exist.
ROCPROFILER_STATUS_ERROR_BUFFER_NOT_FOUNDReturned if the buffer is not found.
ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENTReturned if context already has agent profiling configured for agent_id.
ROCPROFILER_STATUS_SUCCESSReturned if succesfully configured

◆ rocprofiler_sample_device_counting_service()

rocprofiler_status_t rocprofiler_sample_device_counting_service ( rocprofiler_context_id_t  context_id,
rocprofiler_user_data_t  user_data,
rocprofiler_counter_flag_t  flags,
rocprofiler_record_counter_t output_records,
unsigned long *  rec_count 
)

Trigger a read of the counter data for the agent profile. The counter data will be written to the buffer specified in rocprofiler_configure_device_counting_service. The data in rocprofiler_user_data_t will be written to the buffer along with the counter data. flags can be used to specify if this call should be performed asynchronously (default is synchronous).

Parameters
[in]context_idcontext id
[in]user_dataUser supplied data, included in records outputted to buffer.
[in]flagsFlags to specify how the counter data should be collected (defaults to sync).
[in/out]output_records Output records collected via sampling (output is also written to buffer). Must be allocated by caller.
[in/out]rec_count On entry, this is the maximum number of records rocprof can store in output_records. On exit, contains the number of actual records.
Returns
rocprofiler_status_t
Return values
ROCPROFILER_STATUS_ERROR_CONTEXT_INVALIDReturned if the context does not exist or the context is not configured for agent profiling.
ROCPROFILER_STATUS_ERROR_CONTEXT_ERRORReturned if another operation is in progress ( start/stop ctx or another read).
ROCPROFILER_STATUS_ERRORReturned if HSA has not been initialized yet.
ROCPROFILER_STATUS_ERROR_OUT_OF_RESOURCESReturned output_records is set but size is too small to store results
ROCPROFILER_STATUS_SUCCESSReturned if read request was successful.
ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENTReturned If ASYNC is being used while output_records is not null.