14#ifndef __SOF_PERFORMANCE_MONITOR_H__
15#define __SOF_PERFORMANCE_MONITOR_H__
20#define WIN3_MBASE DT_REG_ADDR(DT_PHANDLE(DT_NODELABEL(mem_window3), memory))
22#define ADSP_PMW ((volatile uint32_t *) \
23 (sys_cache_uncached_ptr_get((__sparse_force void __sparse_cache *) \
24 (WIN3_MBASE + WIN3_OFFSET))))
26#if IS_ENABLED(CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS) || defined(__DOXYGEN__)
152#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
154struct io_perf_data_item {
158 uint32_t instance : 8;
160 uint32_t direction : 1;
164 uint32_t power_mode : 2;
167 uint32_t is_removed : 1;
192enum io_perf_data_item_dir {
193 IO_PERF_INPUT_DIRECTION = 0,
194 IO_PERF_OUTPUT_DIRECTION = 1,
197enum io_perf_data_item_state {
198 IO_PERF_POWERED_DOWN_DISABLED = 0,
199 IO_PERF_POWERED_UP_ENABLED = 1,
202enum io_perf_data_item_power_mode {
203 IO_PERF_D0_POWER_MODE = 0,
204 IO_PERF_D0IX_POWER_MODE = 1,
207enum io_perf_data_item_id {
212 IO_PERF_SOUND_WIRE_ID = 4,
218 IO_PERF_I3C_INTERRUPT_ID = 10,
219 IO_PERF_UART_ID = 11,
221 IO_PERF_CSI_2_ID = 13,
223 IO_PERF_INVALID_ID = 0xFF
226struct io_global_perf_data {
228 uint32_t perf_item_count;
230 struct io_perf_data_item perf_items[0];
237int io_perf_monitor_init(
void);
244int io_perf_monitor_release_slot(
struct io_perf_data_item *slot_id);
252io_perf_monitor_get_performance_data(
struct io_global_perf_data *io_global_perf_data);
273int io_perf_monitor_init_data(
struct io_perf_data_item **slot_id,
274 struct io_perf_data_item *init_data);
283void io_perf_monitor_update_data(
struct io_perf_data_item *slot_id,
291void io_perf_monitor_update_io_state(
struct io_perf_data_item *slot_id,
292 bool const power_up);
299void io_perf_monitor_update_power_mode(
struct io_perf_data_item *slot_id,
300 bool const power_mode);
IPC4 Base Firmware parameters, memory configuration, and status definitions.
ipc4_perf_measurements_state_set
Performance measurement process states.
Definition base_fw.h:447
@ IPC4_PERF_MEASUREMENTS_DISABLED
Performance measurements disabled.
Definition base_fw.h:448
struct perf_data_item_comp * perf_data_getnext(void)
Allocate next free performance data slot from Memory Window 3.
int free_performance_data(struct perf_data_item_comp *item)
Release an allocated performance data slot in Memory Window 3.
void disable_performance_counters(void)
Disable performance counters and unregister records marked for removal.
int get_extended_performance_data(struct extended_global_perf_data *const ext_global_perf_data)
Retrieve extended global performance telemetry data with per-core breakdown.
int reset_performance_counters(void)
Reset all performance measurement counters across all components.
int get_performance_data(struct global_perf_data *const global_perf_data)
Retrieve global aggregated performance telemetry data.
enum ipc4_perf_measurements_state_set perf_meas_get_state(void)
Query current global performance measurement state.
void perf_data_item_comp_init(struct perf_data_item_comp *perf, uint32_t resource_id, uint32_t power_mode)
Initializer for component performance data record.
void perf_meas_set_state(enum ipc4_perf_measurements_state_set state)
Set global performance measurement state machine.
int enable_performance_counters(void)
Reinitialize and activate performance counters for all created components.
Extended global performance data report (IPC4_EXTENDED_GLOBAL_PERF_DATA).
Definition base_fw.h:745
Global DSP performance summary.
Definition base_fw.h:767
Component performance data with wall clock cycle metrics.
Definition base_fw.h:754
struct perf_data_item item
Base performance item header.
Definition base_fw.h:755