Counters#
-
typedef rocprofiler_status_t (*rocprofiler_available_counters_cb_t)(rocprofiler_agent_id_t agent_id, rocprofiler_counter_id_t *counters, unsigned long num_counters, void *user_data)#
(experimental) Callback that gives a list of counters available on an agent. The counters variable is owned by rocprofiler and should not be free’d.
- Param agent_id:
[in] Agent ID of the current callback
- Param counters:
[in] An array of counters that are avialable on the agent rocprofiler_iterate_agent_supported_counters was called on.
- Param num_counters:
[in] Number of counters contained in counters
- Param user_data:
[in] User data supplied by rocprofiler_iterate_agent_supported_counters
-
rocprofiler_status_t rocprofiler_query_record_counter_id(rocprofiler_counter_instance_id_t id, rocprofiler_counter_id_t *counter_id)#
(experimental) Query counter id information from record_id.
- Parameters:
id – [in] record id from rocprofiler_counter_record_t
counter_id – [out] counter id associated with the record
- Return values:
ROCPROFILER_STATUS_SUCCESS – if id decoded
- Returns:
-
rocprofiler_status_t rocprofiler_query_record_dimension_position(rocprofiler_counter_instance_id_t id, rocprofiler_counter_dimension_id_t dim, unsigned long *pos)#
(experimental) Query dimension position from record_id. If the dimension does not exist in the counter, the return will be 0.
- Parameters:
id – [in] record id from rocprofiler_counter_record_t
dim – [in] dimension for which positional info is requested (currently only 0 is allowed, i.e. flat array without dimension).
pos – [out] value of the dimension in id
- Return values:
ROCPROFILER_STATUS_SUCCESS – if dimension decoded
- Returns:
-
rocprofiler_status_t rocprofiler_query_counter_info(rocprofiler_counter_id_t counter_id, rocprofiler_counter_info_version_id_t version, void *info)#
(experimental) Query Counter info such as name or description.
- Parameters:
counter_id – [in] counter to get info for
version – [in] Version of struct in info, see rocprofiler_counter_info_version_id_t for available types
info – [out] rocprofiler_counter_info_{version}_t struct to write info to.
- Return values:
ROCPROFILER_STATUS_SUCCESS – if counter found
ROCPROFILER_STATUS_ERROR_COUNTER_NOT_FOUND – if counter not found
ROCPROFILER_STATUS_ERROR_INCOMPATIBLE_ABI – Version is not supported
- Returns:
-
rocprofiler_status_t rocprofiler_iterate_agent_supported_counters(rocprofiler_agent_id_t agent_id, rocprofiler_available_counters_cb_t cb, void *user_data)#
(experimental) Query Agent Counters Availability.
- Parameters:
agent_id – [in] GPU agent identifier
cb – [in] callback to caller to get counters
user_data – [in] data to pass into the callback
- Return values:
ROCPROFILER_STATUS_SUCCESS – if counters found for agent
ROCPROFILER_STATUS_ERROR – if no counters found for agent
- Returns:
-
rocprofiler_status_t rocprofiler_create_counter(const char *name, unsigned long name_len, const char *expr, unsigned long expr_len, const char *description, unsigned long description_len, rocprofiler_agent_id_t agent, rocprofiler_counter_id_t *counter_id)#
(experimental) Creates a new counter based on a derived metric provided. The counter will only be available for counter collection profiles created after the addition of this counter. Due to the regeneration of internal ASTs and dimension cache, this call may be slow and should generally be avoided in performance sensitive code blocks (i.e. dispatch callbacks).
- Parameters:
name – [in] The name of the new counter.
name_len – [in] The length of the counter name.
expr – [in] The counter expression, formatted identically to YAML counter definitions.
expr_len – [in] The length of the expression.
agent – [in] The rocprofiler_agent_id_t specifying the agent for which to create the counter.
description – [in] The description of the new counter (optional).
description_len – [in] The length of the description.
counter_id – [out] The rocprofiler_counter_id_t of the created counter.
- Return values:
ROCPROFILER_STATUS_SUCCESS – if the counter was successfully created.
ROCPROFILER_STATUS_ERROR_AST_GENERATION_FAILED – if the counter could not be created.
ROCPROFILER_STATUS_ERROR_INVALID_ARGUMENT – if a counter argument is incorrect
ROCPROFILER_STATUS_ERROR_AGENT_NOT_FOUND – if the agent is not found
- Returns:
-
struct rocprofiler_counter_info_v0_t#
- #include <rocprofiler-sdk/counters.h>
(experimental) Counter info struct version 0
-
struct rocprofiler_counter_info_v1_t#
- #include <rocprofiler-sdk/counters.h>
(experimental) Counter info struct version 1. Combines information from rocprofiler_counter_info_v0_t with the dimension information.