I/O performance monitor: add I/O performance counters to IPC interface

Set up a measurement of number of input and output IPCs.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
This commit is contained in:
Tobiasz Dryjanski 2024-07-10 14:13:13 +02:00 committed by Kai Vehmanen
parent 75b5328e6a
commit 7aeebaf636
3 changed files with 32 additions and 2 deletions

View File

@ -476,7 +476,7 @@ static int io_global_perf_data_get(uint32_t *data_off_size, char *data)
{
#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
int ret;
struct global_perf_data *perf_data = (struct global_perf_data *)data;
struct io_global_perf_data *perf_data = (struct io_global_perf_data *)data;
ret = io_perf_monitor_get_performance_data(perf_data);
if (ret < 0)

View File

@ -70,6 +70,12 @@ struct ipc {
/* processing task */
struct task ipc_task;
#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
/* io performance measurement */
struct io_perf_data_item *io_perf_in_msg_count;
struct io_perf_data_item *io_perf_out_msg_count;
#endif
#ifdef __ZEPHYR__
struct k_work_delayable z_delayed_work;
#endif

View File

@ -32,6 +32,8 @@
#include <stddef.h>
#include <stdint.h>
#include <sof/debug/telemetry/performance_monitor.h>
LOG_MODULE_REGISTER(ipc, CONFIG_SOF_LOG_LEVEL);
SOF_DEFINE_REG_UUID(ipc);
@ -154,9 +156,14 @@ void ipc_send_queued_msg(void)
msg = list_first_item(&ipc->msg_list, struct ipc_msg,
list);
if (ipc_platform_send_msg(msg) == 0)
if (ipc_platform_send_msg(msg) == 0) {
/* Remove the message from the list if it has been successfully sent. */
list_item_del(&msg->list);
#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
/* Increment performance counters */
io_perf_monitor_update_data(ipc->io_perf_out_msg_count, 1);
#endif
}
out:
k_spin_unlock(&ipc->lock, key);
}
@ -274,6 +281,18 @@ int ipc_init(struct sof *sof)
list_init(&sof->ipc->msg_list);
list_init(&sof->ipc->comp_list);
#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
struct io_perf_data_item init_data = {IO_PERF_IPC_ID,
cpu_get_id(),
IO_PERF_INPUT_DIRECTION,
IO_PERF_POWERED_UP_ENABLED,
IO_PERF_D0IX_POWER_MODE,
0, 0, 0 };
io_perf_monitor_init_data(&sof->ipc->io_perf_in_msg_count, &init_data);
init_data.direction = IO_PERF_OUTPUT_DIRECTION;
io_perf_monitor_init_data(&sof->ipc->io_perf_out_msg_count, &init_data);
#endif
#ifdef __ZEPHYR__
k_work_init_delayable(&sof->ipc->z_delayed_work, ipc_work_handler);
#endif
@ -317,6 +336,11 @@ static enum task_state ipc_do_cmd(void *data)
{
struct ipc *ipc = data;
#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
/* Increment performance counters */
io_perf_monitor_update_data(ipc->io_perf_in_msg_count, 1);
#endif
/*
* 32-bit writes are atomic and at the moment no IPC processing is
* taking place, so, no need for a lock.