performance measurements: add CONFIG for perf meas

Add config to enable global performance measurements.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
This commit is contained in:
Tobiasz Dryjanski 2024-06-06 10:53:30 +02:00 committed by Liam Girdwood
parent 11cf4dd8e3
commit 2a216ae4f3
3 changed files with 14 additions and 3 deletions

View File

@ -9,3 +9,12 @@ config SOF_TELEMETRY
systick_info measurement which measures scheduler task performance and may
slightly affect overall performance.
config SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS
bool "enable performance measurements"
default n
help
Enables performance measurements. Requires ADSP_MW interface. Each created component
can have its performance checked by measuring execution time of copy function.
Performance records are stored in the limited number of slots in Memory Window 3,
so only a certain number (PERFORMANCE_DATA_ENTRIES_COUNT) of components can be measured.

View File

@ -23,11 +23,14 @@ LOG_MODULE_DECLARE(ipc, CONFIG_SOF_LOG_LEVEL);
/* Systic variables, one set per core */
static int telemetry_systick_counter[CONFIG_MAX_CORE_COUNT];
#ifdef CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS
static int telemetry_prev_ccount[CONFIG_MAX_CORE_COUNT];
static int telemetry_perf_period_sum[CONFIG_MAX_CORE_COUNT];
static int telemetry_perf_period_cnt[CONFIG_MAX_CORE_COUNT];
static struct telemetry_perf_queue telemetry_perf_queue[CONFIG_MAX_CORE_COUNT];
#endif
#ifdef CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS
static void telemetry_perf_queue_append(struct telemetry_perf_queue *q, size_t element)
{
if (!q->full) {
@ -59,6 +62,7 @@ static size_t telemetry_perf_queue_avg(struct telemetry_perf_queue *q)
return 0;
return q->sum / q->size;
}
#endif
int telemetry_init(void)
{
@ -107,7 +111,7 @@ void telemetry_update(uint32_t begin_stamp, uint32_t current_stamp)
systick_info[prid].max_time_elapsed);
systick_info[prid].last_ccount = current_stamp;
#ifdef SOF_PERFORMANCE_MEASUREMENTS
#ifdef CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS
const size_t measured_systick = begin_stamp - telemetry_prev_ccount[prid];
telemetry_prev_ccount[prid] = begin_stamp;

View File

@ -12,8 +12,6 @@
#define SOF_AVG_PERF_MEAS_DEPTH 64
/* Number of runs taken to calculate average (algorithm resolution) */
#define SOF_AVG_PERF_MEAS_PERIOD 16
/* disables calculating systick_averages */
#define SOF_PERFORMANCE_MEASUREMENTS
/* to be moved to Zephyr */
#define WIN3_MBASE DT_REG_ADDR(DT_PHANDLE(DT_NODELABEL(mem_window3), memory))