Skip to content

Commit a09df34

Browse files
author
Jyri Sarha
committed
ipc4: handler: Kconfig option to add IPC processing timing prints
Kconfig option DEBUG_IPC_TIMINGS to add logging after IPC handling right before sending IPC reply. The logging contains both the reply and the original request message headers and the time that it took to process the request in micro seconds. The value can be used to collect statistics on changes in firmware response times. This also disables the logging of the received request on core 0 to avoid flooding the logs too much. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 5b98a5c commit a09df34

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

Kconfig.sof

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,19 @@ config DEBUG_IPC_COUNTERS
198198
help
199199
Select for enabling tracing IPC counter in SRAM_REG mailbox
200200

201+
config DEBUG_IPC_TIMINGS
202+
bool "Enable IPC message handling time logging"
203+
depends on DEBUG
204+
default n
205+
help
206+
Adds a logging after IPC handling right before sending IPC
207+
reply. The logging contains both the reply and the original
208+
request message headers and the time that it took to process
209+
the request in micro seconds. The value can be used to
210+
collect statistics on changes in firmware response
211+
times. This also disables the logging of the received request
212+
on core 0 to avoid flooding the logs too much.
213+
201214
config SCHEDULE_LOG_CYCLE_STATISTICS
202215
bool "Log cycles per tick statistics for each task separately"
203216
default y

src/ipc/ipc4/handler.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,11 +1556,19 @@ void ipc_cmd(struct ipc_cmd_hdr *_hdr)
15561556
{
15571557
struct ipc4_message_request *in = ipc4_get_message_request();
15581558
enum ipc4_message_target target;
1559+
#ifdef CONFIG_DEBUG_IPC_TIMINGS
1560+
struct ipc4_message_request req;
1561+
uint64_t tstamp;
1562+
#endif
15591563
int err;
15601564

1565+
#ifdef CONFIG_DEBUG_IPC_TIMINGS
1566+
req = *in;
1567+
tstamp = sof_cycle_get_64();
1568+
#else
15611569
if (cpu_is_primary(cpu_get_id()))
15621570
tr_info(&ipc_tr, "rx\t: %#x|%#x", in->primary.dat, in->extension.dat);
1563-
1571+
#endif
15641572
/* no process on scheduled thread */
15651573
atomic_set(&msg_data.delayed_reply, 0);
15661574
msg_data.delayed_error = 0;
@@ -1674,9 +1682,14 @@ void ipc_cmd(struct ipc_cmd_hdr *_hdr)
16741682

16751683
msg_reply.header = reply.primary.dat;
16761684

1685+
#ifdef CONFIG_DEBUG_IPC_TIMINGS
1686+
tr_info(&ipc_tr, "tx-reply\t: %#x|%#x to %#x|%#x in %llu us", msg_reply.header,
1687+
msg_reply.extension, req.primary.dat, req.extension.dat,
1688+
k_cyc_to_us_near64(sof_cycle_get_64() - tstamp));
1689+
#else
16771690
tr_dbg(&ipc_tr, "tx-reply\t: %#x|%#x", msg_reply.header,
16781691
msg_reply.extension);
1679-
1692+
#endif
16801693
ipc4_send_reply(&reply);
16811694
}
16821695
}

0 commit comments

Comments
 (0)