perf: agent: add perf counter to trace cpu load

Periodic stamp traces cpu ticks every time agent task run.
This peak value compared to cpu clock shows the peak load.
Platform art ticks are traced and allow for fine adjustment
of cpu ticks in case there is a jitter in agent task period.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
This commit is contained in:
Marcin Maka 2020-01-14 11:08:44 +01:00 committed by Liam Girdwood
parent 85525efe59
commit c4bb1958dc
2 changed files with 6 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#ifndef __SOF_LIB_AGENT_H__
#define __SOF_LIB_AGENT_H__
#include <sof/lib/perf_cnt.h>
#include <sof/schedule/task.h>
#include <config.h>
#include <stdbool.h>
@ -20,6 +21,9 @@ struct sa {
uint64_t last_check; /* time of last activity checking */
uint64_t panic_timeout; /* threshold of panic */
uint64_t warn_timeout; /* threshold of warning */
#if CONFIG_PERFORMANCE_COUNTERS
struct perf_cnt_data pcd;
#endif
struct task work;
};

View File

@ -44,6 +44,8 @@ static enum task_state validate(void *data)
current = platform_timer_get(timer_get());
delta = current - sa->last_check;
perf_cnt_stamp(TRACE_CLASS_SA, &sa->pcd, true);
/* panic timeout */
if (delta > sa->panic_timeout)
panic(SOF_IPC_PANIC_IDLE);