From 178f4f9ab723e81250d5a0bc44c4974abffd1187 Mon Sep 17 00:00:00 2001 From: Tobiasz Dryjanski Date: Fri, 9 Aug 2024 16:10:22 +0200 Subject: [PATCH 1/5] telemetry: add abstraction to time measurement Adds abstract function to change time source for performance measurement via config. Signed-off-by: Tobiasz Dryjanski --- src/include/sof/debug/telemetry/telemetry.h | 9 +++++++++ 1 file changed, 9 insertions(+) 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__ */ From bc0607c0395a5a4f46d4afe5d0f18fdbb76fc9f9 Mon Sep 17 00:00:00 2001 From: Tobiasz Dryjanski Date: Mon, 12 Aug 2024 13:29:10 +0200 Subject: [PATCH 2/5] zephyr_ll:change time counting for telemetry Change performance counter for telemetry to abstract one. This enables choice of time source. Signed-off-by: Tobiasz Dryjanski --- src/schedule/zephyr_ll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From c7da1c18cadfe96cd70e8459c4ed86d1c2e9b293 Mon Sep 17 00:00:00 2001 From: Tobiasz Dryjanski Date: Mon, 12 Aug 2024 16:20:36 +0200 Subject: [PATCH 3/5] performance monitor: change to new counters Change performance counters to use abstract function to use multiple time sources via config. Signed-off-by: Tobiasz Dryjanski --- src/audio/component.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 From b06cded615b02c13acbeb6f5050fff70fffb9ced Mon Sep 17 00:00:00 2001 From: Tobiasz Dryjanski Date: Mon, 12 Aug 2024 14:05:35 +0200 Subject: [PATCH 4/5] performance monitor: change timer source to ccount for mtl Use ccount for performance measurement for mtl to have a better comparison with reference firmware. Signed-off-by: Tobiasz Dryjanski --- app/boards/intel_adsp_ace15_mtpm.conf | 1 + 1 file changed, 1 insertion(+) 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 From be2738db8060af1fd2f9235abd260a3825274c15 Mon Sep 17 00:00:00 2001 From: Tobiasz Dryjanski Date: Fri, 13 Sep 2024 17:29:49 +0200 Subject: [PATCH 5/5] performance monitor: change timer source to ccount for lnl Use ccount for performance measurement for lnl to have a better comparison with reference firmware. Signed-off-by: Tobiasz Dryjanski --- app/boards/intel_adsp_ace20_lnl.conf | 2 ++ 1 file changed, 2 insertions(+) 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