NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_telemetry_dpa.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES, ALL RIGHTS RESERVED.
3  *
4  * This software product is a proprietary product of NVIDIA CORPORATION &
5  * AFFILIATES (the "Company") and all right, title, and interest in and to the
6  * software product, including all associated intellectual property rights, are
7  * and shall remain exclusively with the Company.
8  *
9  * This software product is governed by the End User License Agreement
10  * provided with the software product.
11  *
12  */
13 
22 #ifndef DOCA_TELEMETRY_DPA_H_
23 #define DOCA_TELEMETRY_DPA_H_
24 
25 #include <doca_error.h>
26 #include <doca_types.h>
27 
28 #define DOCA_TELEMETRY_DPA_PROCESS_NAME_SIZE (17)
29 #define DOCA_TELEMETRY_DPA_THREAD_NAME_SIZE (17)
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /**********************************************************************************************************************
36  * DOCA core opaque types
37  *********************************************************************************************************************/
38 struct doca_dev;
39 struct doca_devinfo;
40 
41 /*********************************************************************************************************************
42  * DOCA Telemetry DPA Context
43  *********************************************************************************************************************/
44 
48 struct doca_telemetry_dpa;
49 
57 };
58 
67 };
68 
77 };
78 
83  uint32_t dpa_process_id;
84  uint32_t num_of_threads;
87 
92  uint32_t dpa_process_id;
93  uint32_t dpa_thread_id;
96 
101  uint32_t dpa_process_id;
102  uint32_t dpa_thread_id;
103  uint64_t time;
104  uint64_t cycles;
105  uint64_t instructions;
106  uint64_t num_executions;
108 
113  uint64_t timestamp;
114  uint64_t cycles;
115  uint32_t instructions;
116  uint32_t dpa_thread_id;
117  uint16_t eu_id;
118  uint16_t sample_id_in_eu;
123 
140 doca_error_t doca_telemetry_dpa_cap_is_supported(const struct doca_devinfo *devinfo);
141 
158 doca_error_t doca_telemetry_dpa_create(struct doca_dev *dev, struct doca_telemetry_dpa **dpa);
159 
173 doca_error_t doca_telemetry_dpa_destroy(struct doca_telemetry_dpa *dpa);
174 
188 doca_error_t doca_telemetry_dpa_start(struct doca_telemetry_dpa *dpa);
189 
203 doca_error_t doca_telemetry_dpa_stop(struct doca_telemetry_dpa *dpa);
204 
228  uint32_t process_id,
229  uint32_t *dpa_process_num,
230  doca_telemetry_dpa_process_info_t *process_list);
231 
257 doca_error_t doca_telemetry_dpa_read_thread_list(struct doca_telemetry_dpa *dpa,
258  uint32_t process_id,
259  uint32_t thread_id,
260  uint32_t *dpa_threads_num,
261  doca_telemetry_dpa_thread_info_t *thread_list);
262 
283 doca_error_t doca_telemetry_dpa_counter_start(struct doca_telemetry_dpa *dpa,
284  uint32_t process_id,
286 
306 doca_error_t doca_telemetry_dpa_counter_restart(struct doca_telemetry_dpa *dpa,
307  uint32_t process_id,
309 
329 doca_error_t doca_telemetry_dpa_counter_stop(struct doca_telemetry_dpa *dpa,
330  uint32_t process_id,
332 
360  uint32_t process_id,
361  uint32_t thread_id,
362  uint32_t *cumul_samples_num,
363  doca_telemetry_dpa_cumul_info_t *cumul_info_list);
364 
392  uint32_t process_id,
393  uint32_t thread_id,
394  uint32_t *perf_event_samples_num,
395  doca_telemetry_dpa_event_sample_t *perf_event_list);
396 
414 doca_error_t doca_telemetry_dpa_get_dpa_timer_freq(struct doca_telemetry_dpa *dpa, uint32_t *dpa_timer_freq);
415 
435  uint32_t process_id,
436  uint32_t *dpa_process_list_size);
437 
459  uint32_t process_id,
460  uint32_t thread_id,
461  uint32_t *dpa_thread_list_size);
462 
484  uint32_t process_id,
485  uint32_t thread_id,
486  uint32_t *dpa_cumul_samples_size);
487 
506  uint32_t dpa_max_perf_event_samples);
507 
525  uint32_t *dpa_max_perf_event_samples);
526 
544  uint32_t *dpa_perf_event_samples_size);
545 
564 doca_error_t doca_telemetry_dpa_get_counter_state(struct doca_telemetry_dpa *dpa,
565  uint32_t process_id,
567 
586 doca_error_t doca_telemetry_dpa_get_counter_type(struct doca_telemetry_dpa *dpa,
587  uint32_t process_id,
589 
605 doca_error_t doca_telemetry_dpa_get_all_process_id(const struct doca_devinfo *devinfo, uint32_t *all_process_id);
606 
622 doca_error_t doca_telemetry_dpa_get_all_thread_id(const struct doca_devinfo *devinfo, uint32_t *all_thread_id);
623 
624 #ifdef __cplusplus
625 } /* extern "C" */
626 #endif
627 
628 #endif /* DOCA_TELEMETRY_DPA_H_ */
629 
#define DOCA_EXPERIMENTAL
To set a Symbol (or specifically a function) as experimental.
Definition: doca_compat.h:103
enum doca_error doca_error_t
DOCA API return codes.
struct doca_telemetry_dpa_cumul_info doca_telemetry_dpa_cumul_info_t
Single cumulative info structure.
doca_telemetry_dpa_counter_state
Performance counters state.
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_get_perf_event_samples_size(struct doca_telemetry_dpa *dpa, uint32_t *dpa_perf_event_samples_size)
Get memory size (in bytes) to allocate the perf event samples.
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.
struct doca_telemetry_dpa_thread_info doca_telemetry_dpa_thread_info_t
Single thread structure.
struct doca_telemetry_dpa_event_sample doca_telemetry_dpa_event_sample_t
Single performance events tracer structure.
#define DOCA_TELEMETRY_DPA_PROCESS_NAME_SIZE
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.
#define DOCA_TELEMETRY_DPA_THREAD_NAME_SIZE
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_get_counter_state(struct doca_telemetry_dpa *dpa, uint32_t process_id, enum doca_telemetry_dpa_counter_state *state)
Get counter state.
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.
struct doca_telemetry_dpa_process_info doca_telemetry_dpa_process_info_t
Single process structure.
DOCA_EXPERIMENTAL doca_error_t doca_telemetry_dpa_get_counter_type(struct doca_telemetry_dpa *dpa, uint32_t process_id, enum doca_telemetry_dpa_counter_type *type)
Get counter state and type.
@ DOCA_TELEMETRY_DPA_COUNTER_STATE_INACTIVE
@ DOCA_TELEMETRY_DPA_COUNTER_STATE_ACTIVE
@ DOCA_TELEMETRY_DPA_COUNTER_STATE_RESET
@ DOCA_TELEMETRY_DPA_COUNTER_TYPE_EVENT_TRACER
@ 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
uint8_t type
Definition: packets.h:0
Single cumulative info structure.
Single performance events tracer structure.
enum doca_telemetry_dpa_event_sample_type type
Single process structure.
char process_name[DOCA_TELEMETRY_DPA_PROCESS_NAME_SIZE]
Single thread structure.
char thread_name[DOCA_TELEMETRY_DPA_THREAD_NAME_SIZE]