64 switch (event_sample_type) {
66 return "Event sample type empty sample";
68 return "Event sample type schedule in";
70 return "Event sample type schedule out";
72 return "Event sample type buffer full";
74 return "Unrecognized event sample type";
90 if (dpa_process_list ==
NULL) {
91 DOCA_LOG_ERR(
"Failed to print processes list: parameter dpa_process_list=NULL");
95 if (dpa_process_num == 0) {
96 DOCA_LOG_ERR(
"Failed to print processes list: no processes found in context");
100 DOCA_LOG_INFO(
"Number of processes extracted: %u", dpa_process_num);
102 for (uint32_t idx = 0; idx < dpa_process_num; idx++) {
103 DOCA_LOG_INFO(
" dpa_process_id=%u", dpa_process_list[idx].dpa_process_id);
104 DOCA_LOG_INFO(
" num_of_threads=%u", dpa_process_list[idx].num_of_threads);
123 if (dpa_thread_list ==
NULL) {
124 DOCA_LOG_ERR(
"Failed to print thread list: parameter dpa_thread_list=NULL");
128 if (dpa_threads_num == 0) {
129 DOCA_LOG_ERR(
"Failed to print thread list: no threads found in context");
133 DOCA_LOG_INFO(
"Number of threads extracted: %u", dpa_threads_num);
135 for (uint32_t idx = 0; idx < dpa_threads_num; idx++) {
136 DOCA_LOG_INFO(
" dpa_process_id=%u", dpa_thread_list[idx].dpa_process_id);
137 DOCA_LOG_INFO(
" dpa_thread_id=%u", dpa_thread_list[idx].dpa_thread_id);
138 DOCA_LOG_INFO(
" thread_name=%s", dpa_thread_list[idx].thread_name);
156 if (cumul_info_list ==
NULL) {
157 DOCA_LOG_ERR(
"Failed to print cumul list: parameter cumul_info_list=NULL");
161 if (cumul_samples_num == 0) {
162 DOCA_LOG_ERR(
"Failed to print cumul list: no samples found in context");
166 DOCA_LOG_INFO(
"Number of cumul samples_num: %u", cumul_samples_num);
168 for (uint32_t idx = 0; idx < cumul_samples_num; idx++) {
169 if (cumul_info_list[idx].instructions == 0)
171 DOCA_LOG_INFO(
" dpa_process_id=%u", cumul_info_list[idx].dpa_process_id);
172 DOCA_LOG_INFO(
" dpa_thread_id=%u", cumul_info_list[idx].dpa_thread_id);
175 DOCA_LOG_INFO(
" instructions=%lu", cumul_info_list[idx].instructions);
176 DOCA_LOG_INFO(
" num_executions=%lu", cumul_info_list[idx].num_executions);
194 if (event_info_list ==
NULL) {
195 DOCA_LOG_ERR(
"Failed to print perf event list: parameter event_info_list=NULL");
199 if (perf_event_samples_num == 0) {
200 DOCA_LOG_ERR(
"Failed to print perf event list: no samples found in context");
204 DOCA_LOG_DBG(
"Number of perf event samples_num: %u", perf_event_samples_num);
206 for (uint32_t idx = 0; idx < perf_event_samples_num; idx++) {
207 if (event_info_list[idx].instructions == 0)
209 DOCA_LOG_INFO(
" dpa_thread_id=%u", event_info_list[idx].dpa_thread_id);
212 DOCA_LOG_INFO(
" instructions=%u", event_info_list[idx].instructions);
213 DOCA_LOG_INFO(
" sample id per execution unit=%u", event_info_list[idx].sample_id_in_eu);
214 DOCA_LOG_INFO(
" execution unit id=%u", event_info_list[idx].eu_id);
248 DOCA_LOG_INFO(
"cumul_info_list %p: list of cumulative info counter was destroyed",
265 DOCA_LOG_WARN(
"Failed to restart telemetry_dpa counter counter with error=%s",
284 if (sample_objects->
dev !=
NULL) {
304 uint32_t max_event_sample,
308 uint32_t dpa_process_list_size = 0;
309 uint32_t dpa_thread_list_size = 0;
310 uint32_t dpa_cumul_samples_size = 0;
311 uint32_t dpa_max_perf_event_samples = 0;
315 &dpa_process_list_size);
317 DOCA_LOG_ERR(
"Failed to create process list: failed to retrieve the process list size");
322 DOCA_LOG_ERR(
"Failed to create process list: failed to allocate memory for processes info");
329 &dpa_thread_list_size);
331 DOCA_LOG_ERR(
"Failed to create thread list: failed to retrieve the thread list size");
336 DOCA_LOG_ERR(
"Failed to create thread list: failed to allocate memory for threads info");
344 &dpa_cumul_samples_size);
346 DOCA_LOG_ERR(
"Failed to create cumul info list: failed to retrieve cumul samples list size");
352 "Failed to create cumul info list: failed to allocate memory for cumul samples info");
356 if (max_event_sample != 0) {
361 "Failed to create event info list: failed to set maximum number of perf event samples");
367 &dpa_max_perf_event_samples);
370 "Failed to create event info list: failed to retrieve maximum number of perf event samples");
374 if (dpa_max_perf_event_samples != 0) {
379 "Failed to create event info list: failed to allocate memory for perf event samples info");
384 "Failed to create event info list: maximum number of perf event samples is set to 0");
400 uint8_t thread_id_set,
404 uint32_t max_event_sample,
413 DOCA_LOG_ERR(
"Failed to start telemetry_dpa: device does not support doca_telemetry_dpa");
416 DOCA_LOG_ERR(
"Failed to start telemetry_dpa: failed to query capability");
423 DOCA_LOG_ERR(
"Failed to start telemetry_dpa: failed to create telemetry dpa object with error=%s",
428 if (!process_id_set) {
431 DOCA_LOG_ERR(
"Failed to start telemetry_dpa: failed to retrieve all process id with error=%s",
438 if (!thread_id_set) {
441 DOCA_LOG_ERR(
"Failed to start telemetry_dpa: failed to retrieve all threads id with error=%s",
451 DOCA_LOG_ERR(
"Failed to start telemetry_dpa: failed to init sample objects with error=%s",
467 DOCA_LOG_ERR(
"Failed to start telemetry_dpa: Teardown failed with error=%s",
479 DOCA_LOG_INFO(
"Started doca_telemetry_dpa sample with the following parameters: ");
482 if (
cfg->process_id_set) {
485 if (
cfg->thread_id_set) {
488 if (
cfg->counter_type) {
504 cfg->max_event_sample,
529 DOCA_LOG_ERR(
"Failed to retrieve telemetry_dpa dpa timer freq with error=%s",
555 DOCA_LOG_WARN(
"Failed to restart telemetry_dpa counter counter with error=%s",
568 usleep(
cfg->run_time * 1000);
585 DOCA_LOG_ERR(
"Failed to read the cumul counter list with error=%s",
doca_telemetry_exporter_timestamp_t timestamp
static doca_error_t open_doca_device_with_pci(const char *pcie_value, struct doca_dev **retval)
DOCA_STABLE struct doca_devinfo * doca_dev_as_devinfo(const struct doca_dev *dev)
Get local device info from device. This should be useful when wanting to query information about devi...
DOCA_STABLE doca_error_t doca_dev_close(struct doca_dev *dev)
Destroy allocated local device instance.
#define DOCA_ERROR_PROPAGATE(r, t)
Save the first encountered doca_error_t.
enum doca_error doca_error_t
DOCA API return codes.
DOCA_STABLE const char * doca_error_get_name(doca_error_t error)
Returns the string representation of an error code name.
@ DOCA_ERROR_INVALID_VALUE
@ DOCA_ERROR_NOT_SUPPORTED
#define DOCA_LOG_ERR(format,...)
Generates an ERROR application log message.
#define DOCA_LOG_WARN(format,...)
Generates a WARNING application log message.
#define DOCA_LOG_INFO(format,...)
Generates an INFO application log message.
#define DOCA_LOG_DBG(format,...)
Generates a DEBUG application log message.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_get_max_perf_event_samples(struct doca_telemetry_dpa *dpa, uint32_t *dpa_max_perf_event_samples)
Get maximum number of perf event samples.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_get_thread_list_size(struct doca_telemetry_dpa *dpa, uint32_t process_id, uint32_t thread_id, uint32_t *dpa_thread_list_size)
Get memory size (in bytes) to allocate the thread list.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_counter_start(struct doca_telemetry_dpa *dpa, uint32_t process_id, enum doca_telemetry_dpa_counter_type type)
Start device counters sampling - trigger device to collect performance metrics.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_stop(struct doca_telemetry_dpa *dpa)
Stop telemetry DPA context.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_get_cumul_samples_size(struct doca_telemetry_dpa *dpa, uint32_t process_id, uint32_t thread_id, uint32_t *dpa_cumul_samples_size)
Get memory size (in bytes) to allocate the cumul samples.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_create(struct doca_dev *dev, struct doca_telemetry_dpa **dpa)
Create a DOCA telemetry DPA instance.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_read_thread_list(struct doca_telemetry_dpa *dpa, uint32_t process_id, uint32_t thread_id, uint32_t *dpa_threads_num, doca_telemetry_dpa_thread_info_t *thread_list)
Read threads info.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_read_perf_event_list(struct doca_telemetry_dpa *dpa, uint32_t process_id, uint32_t thread_id, uint32_t *perf_event_samples_num, doca_telemetry_dpa_event_sample_t *perf_event_list)
Read list of the performance event samples.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_set_max_perf_event_samples(struct doca_telemetry_dpa *dpa, uint32_t dpa_max_perf_event_samples)
Set maximum number of perf event samples.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_start(struct doca_telemetry_dpa *dpa)
Start context for telemetry DPA.
doca_telemetry_dpa_counter_type
Performance counters type.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_get_process_list_size(struct doca_telemetry_dpa *dpa, uint32_t process_id, uint32_t *dpa_process_list_size)
Get memory size (in bytes) to allocate the process list.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_get_all_process_id(const struct doca_devinfo *devinfo, uint32_t *all_process_id)
Get all process mask.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_read_processes_list(struct doca_telemetry_dpa *dpa, uint32_t process_id, uint32_t *dpa_process_num, doca_telemetry_dpa_process_info_t *process_list)
Read the processes info.
doca_telemetry_dpa_event_sample_type
List of the performance event samples type.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_destroy(struct doca_telemetry_dpa *dpa)
Destroy doca_telemetry_dpa previously created by doca_telemetry_dpa_create().
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_counter_restart(struct doca_telemetry_dpa *dpa, uint32_t process_id, enum doca_telemetry_dpa_counter_type type)
Restart device counters sampling.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_get_all_thread_id(const struct doca_devinfo *devinfo, uint32_t *all_thread_id)
Get all threads mask.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_get_dpa_timer_freq(struct doca_telemetry_dpa *dpa, uint32_t *dpa_timer_freq)
Get DPA timer frequency.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_counter_stop(struct doca_telemetry_dpa *dpa, uint32_t process_id, enum doca_telemetry_dpa_counter_type type)
Stop device counters sampling.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_read_cumul_info_list(struct doca_telemetry_dpa *dpa, uint32_t process_id, uint32_t thread_id, uint32_t *cumul_samples_num, doca_telemetry_dpa_cumul_info_t *cumul_info_list)
Read list of the cumulative info counters.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_cap_is_supported(const struct doca_devinfo *devinfo)
Check if given device is capable of executing telemetry DPA operations.
@ DOCA_TELEMETRY_DPA_COUNTER_TYPE_CUMULATIVE_EVENT
@ DOCA_TELEMETRY_DPA_EVENT_SAMPLE_TYPE_SCHEDULE_OUT
@ DOCA_TELEMETRY_DPA_EVENT_SAMPLE_TYPE_BUFFER_FULL
@ DOCA_TELEMETRY_DPA_EVENT_SAMPLE_TYPE_EMPTY_SAMPLE
@ DOCA_TELEMETRY_DPA_EVENT_SAMPLE_TYPE_SCHEDULE_IN
const struct ip_frag_config * cfg
Single cumulative info structure.
Single performance events tracer structure.
Single process structure.
doca_telemetry_dpa_process_info_t * dpa_process_list
doca_telemetry_dpa_event_sample_t * event_info_list
struct doca_telemetry_dpa * telemetry_dpa_obj
doca_telemetry_dpa_cumul_info_t * cumul_info_list
uint32_t cumul_samples_num
uint32_t perf_event_samples_num
doca_telemetry_dpa_thread_info_t * dpa_thread_list
doca_error_t telemetry_dpa_sample_run(const struct telemetry_dpa_sample_cfg *cfg)
DOCA_LOG_REGISTER(TELEMETRY_DPA::SAMPLE)
static doca_error_t telemetry_dpa_print_perf_event_list(uint32_t perf_event_samples_num, doca_telemetry_dpa_event_sample_t *event_info_list)
static doca_error_t telemetry_dpa_sample_context_init(uint8_t process_id_set, uint8_t thread_id_set, uint32_t process_id, uint32_t thread_id, enum doca_telemetry_dpa_counter_type counter_type, uint32_t max_event_sample, struct telemetry_dpa_sample_objects *sample_objects)
static doca_error_t telemetry_dpa_print_process_list(uint32_t dpa_process_num, doca_telemetry_dpa_process_info_t *dpa_process_list)
static doca_error_t telemetry_dpa_sample_allocate_output_objects(enum doca_telemetry_dpa_counter_type counter_type, uint32_t max_event_sample, struct telemetry_dpa_sample_objects *sample_objects)
static doca_error_t telemetry_dpa_print_cumul_list(uint32_t cumul_samples_num, doca_telemetry_dpa_cumul_info_t *cumul_info_list)
static doca_error_t telemetry_dpa_sample_cleanup(struct telemetry_dpa_sample_objects *sample_objects, enum doca_telemetry_dpa_counter_type counter_type)
static doca_error_t telemetry_dpa_print_thread_list(uint32_t dpa_threads_num, doca_telemetry_dpa_thread_info_t *dpa_thread_list)
const char * telemetry_dpa_event_sample_type_get_str(enum doca_telemetry_dpa_event_sample_type event_sample_type)
char process_name[MAX_PROCESS_NAME_LEN+1]