Skip to content

Commit 2a216ae

Browse files
tobonexlgirdwood
authored andcommitted
performance measurements: add CONFIG for perf meas
Add config to enable global performance measurements. Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
1 parent 11cf4dd commit 2a216ae

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/debug/telemetry/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,12 @@ config SOF_TELEMETRY
99
systick_info measurement which measures scheduler task performance and may
1010
slightly affect overall performance.
1111

12+
config SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS
13+
bool "enable performance measurements"
14+
default n
15+
help
16+
Enables performance measurements. Requires ADSP_MW interface. Each created component
17+
can have its performance checked by measuring execution time of copy function.
18+
Performance records are stored in the limited number of slots in Memory Window 3,
19+
so only a certain number (PERFORMANCE_DATA_ENTRIES_COUNT) of components can be measured.
20+

src/debug/telemetry/telemetry.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@ LOG_MODULE_DECLARE(ipc, CONFIG_SOF_LOG_LEVEL);
2323

2424
/* Systic variables, one set per core */
2525
static int telemetry_systick_counter[CONFIG_MAX_CORE_COUNT];
26+
#ifdef CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS
2627
static int telemetry_prev_ccount[CONFIG_MAX_CORE_COUNT];
2728
static int telemetry_perf_period_sum[CONFIG_MAX_CORE_COUNT];
2829
static int telemetry_perf_period_cnt[CONFIG_MAX_CORE_COUNT];
2930
static struct telemetry_perf_queue telemetry_perf_queue[CONFIG_MAX_CORE_COUNT];
31+
#endif
3032

33+
#ifdef CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS
3134
static void telemetry_perf_queue_append(struct telemetry_perf_queue *q, size_t element)
3235
{
3336
if (!q->full) {
@@ -59,6 +62,7 @@ static size_t telemetry_perf_queue_avg(struct telemetry_perf_queue *q)
5962
return 0;
6063
return q->sum / q->size;
6164
}
65+
#endif
6266

6367
int telemetry_init(void)
6468
{
@@ -107,7 +111,7 @@ void telemetry_update(uint32_t begin_stamp, uint32_t current_stamp)
107111
systick_info[prid].max_time_elapsed);
108112
systick_info[prid].last_ccount = current_stamp;
109113

110-
#ifdef SOF_PERFORMANCE_MEASUREMENTS
114+
#ifdef CONFIG_SOF_TELEMETRY_PERFORMANCE_MEASUREMENTS
111115
const size_t measured_systick = begin_stamp - telemetry_prev_ccount[prid];
112116

113117
telemetry_prev_ccount[prid] = begin_stamp;

src/include/sof/debug/telemetry/telemetry.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#define SOF_AVG_PERF_MEAS_DEPTH 64
1313
/* Number of runs taken to calculate average (algorithm resolution) */
1414
#define SOF_AVG_PERF_MEAS_PERIOD 16
15-
/* disables calculating systick_averages */
16-
#define SOF_PERFORMANCE_MEASUREMENTS
1715

1816
/* to be moved to Zephyr */
1917
#define WIN3_MBASE DT_REG_ADDR(DT_PHANDLE(DT_NODELABEL(mem_window3), memory))

0 commit comments

Comments
 (0)