Skip to content

Commit

Permalink
zephyr_ll: move performance counters
Browse files Browse the repository at this point in the history
Move telemetry performance counters around the same function as the
performance overlay.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
  • Loading branch information
tobonex committed Aug 12, 2024
1 parent b8fa810 commit 9f88050
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/schedule/zephyr_ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,18 @@ static inline enum task_state do_task_run(struct task *task)
perf_cnt_init(&task->pcd);
#endif

#ifdef CONFIG_SOF_TELEMETRY
const uint32_t begin_stamp = (uint32_t)telemetry_timestamp();
#endif

state = task_run(task);

#ifdef CONFIG_SOF_TELEMETRY
const uint32_t current_stamp = (uint32_t)telemetry_timestamp();

telemetry_update(begin_stamp, current_stamp);
#endif

#if CONFIG_PERFORMANCE_COUNTERS
perf_cnt_stamp(&task->pcd, perf_trace_null, NULL);
task_perf_cnt_avg(&task->pcd, task_perf_avg_info, &ll_tr, task);
Expand Down Expand Up @@ -251,19 +261,6 @@ static void zephyr_ll_run(void *data)
NOTIFIER_TARGET_CORE_LOCAL, NULL, 0);
}

static void schedule_ll_callback(void *data)
{
#ifdef CONFIG_SOF_TELEMETRY
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)telemetry_timestamp();

telemetry_update(begin_stamp, current_stamp);
#endif
}

/*
* Called once for periodic tasks or multiple times for one-shot tasks
* TODO: start should be ignored in Zephyr LL scheduler implementation. Tasks
Expand Down Expand Up @@ -339,7 +336,7 @@ static int zephyr_ll_task_schedule_common(struct zephyr_ll *sch, struct task *ta

zephyr_ll_unlock(sch, &flags);

ret = domain_register(sch->ll_domain, task, &schedule_ll_callback, sch);
ret = domain_register(sch->ll_domain, task, &zephyr_ll_run, sch);
if (ret < 0)
tr_err(&ll_tr, "zephyr_ll_task_schedule: cannot register domain %d",
ret);
Expand Down

0 comments on commit 9f88050

Please sign in to comment.