diff --git a/app/boards/intel_adsp_ace15_mtpm.conf b/app/boards/intel_adsp_ace15_mtpm.conf index 31009202196a..88aeae9b3ed1 100644 --- a/app/boards/intel_adsp_ace15_mtpm.conf +++ b/app/boards/intel_adsp_ace15_mtpm.conf @@ -110,3 +110,4 @@ CONFIG_COMP_GOOGLE_RTC_AUDIO_PROCESSING=y CONFIG_GOOGLE_RTC_AUDIO_PROCESSING_MOCK=y CONFIG_KCPS_DYNAMIC_CLOCK_CONTROL=y +CONFIG_TIMING_FUNCTIONS=y diff --git a/app/boards/intel_adsp_ace20_lnl.conf b/app/boards/intel_adsp_ace20_lnl.conf index a5d7ce9ce269..11791ae15c19 100644 --- a/app/boards/intel_adsp_ace20_lnl.conf +++ b/app/boards/intel_adsp_ace20_lnl.conf @@ -83,6 +83,8 @@ CONFIG_LLEXT_STORAGE_WRITABLE=y CONFIG_MODULES=y CONFIG_LIBRARY_BASE_ADDRESS=0xa0688000 +CONFIG_TIMING_FUNCTIONS=y + # Temporary disabled options CONFIG_TRACE=n CONFIG_COMP_KPB=y diff --git a/src/audio/component.c b/src/audio/component.c index 23a44a73e19c..27eb4b1a3a00 100644 --- a/src/audio/component.c +++ b/src/audio/component.c @@ -495,13 +495,13 @@ int comp_copy(struct comp_dev *dev) #endif #ifdef CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS - const uint32_t begin_stamp = (uint32_t)sof_cycle_get_64(); + const uint32_t begin_stamp = (uint32_t)telemetry_timestamp(); #endif ret = dev->drv->ops.copy(dev); #ifdef CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS - const uint32_t cycles_consumed = (uint32_t)sof_cycle_get_64() - begin_stamp; + const uint32_t cycles_consumed = (uint32_t)telemetry_timestamp() - begin_stamp; comp_update_performance_data(dev, cycles_consumed); #endif diff --git a/src/include/sof/debug/telemetry/telemetry.h b/src/include/sof/debug/telemetry/telemetry.h index 6c46cd88646f..4f8a869a9dd6 100644 --- a/src/include/sof/debug/telemetry/telemetry.h +++ b/src/include/sof/debug/telemetry/telemetry.h @@ -7,6 +7,9 @@ #define __SOF_TELEMETRY_H__ #include +#ifdef __ZEPHYR__ +#include +#endif /* Slot in memory window 2 (Debug Window) to be used as telemetry slot */ #define SOF_DW_TELEMETRY_SLOT 1 @@ -85,4 +88,10 @@ struct telemetry_perf_queue { void telemetry_update(uint32_t begin_ccount, uint32_t current_ccount); +#ifdef CONFIG_TIMING_FUNCTIONS +#define telemetry_timestamp timing_counter_get +#else +#define telemetry_timestamp sof_cycle_get_64 +#endif + #endif /*__SOF_TELEMETRY_H__ */ diff --git a/src/schedule/zephyr_ll.c b/src/schedule/zephyr_ll.c index 4da220fee4d3..49b1cc0d63a2 100644 --- a/src/schedule/zephyr_ll.c +++ b/src/schedule/zephyr_ll.c @@ -254,11 +254,11 @@ static void zephyr_ll_run(void *data) static void schedule_ll_callback(void *data) { #ifdef CONFIG_SOF_TELEMETRY - const uint32_t begin_stamp = (uint32_t)sof_cycle_get_64(); + const uint32_t begin_stamp = (uint32_t)telemetry_timestamp(); #endif zephyr_ll_run(data); #ifdef CONFIG_SOF_TELEMETRY - const uint32_t current_stamp = (uint32_t)sof_cycle_get_64(); + const uint32_t current_stamp = (uint32_t)telemetry_timestamp(); telemetry_update(begin_stamp, current_stamp); #endif