Skip to content

Commit

Permalink
I/O performance monitor: Add I/O measurements for IDC interface
Browse files Browse the repository at this point in the history
Set up a counter of input and output IDCs.

Signed-off-by: Tobiasz Dryjanski <tobiaszx.dryjanski@intel.com>
  • Loading branch information
tobonex committed Jul 25, 2024
1 parent e04abc7 commit 0e10666
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/idc/idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include <stdint.h>
#include <sof/lib/ams.h>

#include <sof/debug/telemetry/performance_monitor.h>

LOG_MODULE_REGISTER(idc, CONFIG_SOF_LOG_LEVEL);

/** \brief IDC message payload per core. */
Expand Down Expand Up @@ -481,6 +483,11 @@ static void idc_complete(void *data)
uint32_t type = iTS(idc->received_msg.header);
k_spinlock_key_t key;

#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
/* Increment performance counters */
io_perf_monitor_update_data(idc->io_perf_out_msg_count, 1);
#endif

switch (type) {
case iTS(IDC_MSG_IPC):
/* Signal the host */
Expand Down Expand Up @@ -511,6 +518,18 @@ int idc_init(void)
/* initialize idc data */
(*idc)->payload = platform_shared_get(static_payload, sizeof(static_payload));

#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
struct io_perf_data_item init_data = {IDC_ID,
cpu_get_id(),
INPUT_DIRECTION,
POWERED_UP_ENABLED,
D0IX_POWER_MODE,
0, 0, 0 };
io_perf_monitor_init_data(&(*idc)->io_perf_in_msg_count, &init_data);
init_data.direction = OUTPUT_DIRECTION;
io_perf_monitor_init_data(&(*idc)->io_perf_out_msg_count, &init_data);
#endif

/* process task */
#ifndef __ZEPHYR__
schedule_task_init_edf(&(*idc)->idc_task, SOF_UUID(idc_cmd_task_uuid),
Expand Down
12 changes: 12 additions & 0 deletions src/idc/zephyr_idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <sof/trace/trace.h>
#include <sof/lib/uuid.h>

#include <sof/debug/telemetry/performance_monitor.h>

LOG_MODULE_REGISTER(zephyr_idc, CONFIG_SOF_LOG_LEVEL);

SOF_DEFINE_REG_UUID(zephyr_idc);
Expand Down Expand Up @@ -88,6 +90,11 @@ static void idc_handler(struct k_p4wq_work *work)
idc->received_msg.header = msg->header;
idc->received_msg.extension = msg->extension;

#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
/* Increment performance counters */
io_perf_monitor_update_data(idc->io_perf_in_msg_count, 1);
#endif

switch (msg->header) {
case IDC_MSG_POWER_UP:
/* Run the core initialisation? */
Expand Down Expand Up @@ -151,6 +158,11 @@ int idc_send_msg(struct idc_msg *msg, uint32_t mode)

k_p4wq_submit(q_zephyr_idc + target_cpu, work);

#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
/* Increment performance counters */
io_perf_monitor_update_data(idc->io_perf_out_msg_count, 1);
#endif

switch (mode) {
case IDC_BLOCKING:
ret = k_p4wq_wait(work, K_USEC(IDC_TIMEOUT));
Expand Down
7 changes: 7 additions & 0 deletions zephyr/include/rtos/idc.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <stdint.h>
#include <rtos/cache.h>

#include <sof/debug/telemetry/performance_monitor.h>

/** \brief IDC send blocking flag. */
#define IDC_BLOCKING 0

Expand Down Expand Up @@ -171,6 +173,11 @@ struct idc {
struct task idc_task; /**< IDC processing task */
struct idc_payload *payload;
int irq;
#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
};

/* idc trace context, used by multiple units */
Expand Down

0 comments on commit 0e10666

Please sign in to comment.