Skip to content

Commit 41edf3e

Browse files
Jyri Sarhalgirdwood
authored andcommitted
ipc4: handler: Kconfig option to add IPC processing timing prints
Kconfig option DEBUG_IPC_TIMINGS to add logging after IPC handling before putting IPC reply to send queue. 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 781dacd commit 41edf3e

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

Kconfig.sof

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,19 @@ config DEBUG_IPC_COUNTERS
205205
help
206206
Select for enabling tracing IPC counter in SRAM_REG mailbox
207207

208+
config DEBUG_IPC_TIMINGS
209+
bool "Enable IPC message handling time logging"
210+
depends on DEBUG
211+
default n
212+
help
213+
Adds a logging after IPC handling before putting IPC reply
214+
to send queue. The logging contains both the reply and the
215+
original request message headers and the time that it took
216+
to process the request in micro seconds. The value can be
217+
used to collect statistics on changes in firmware response
218+
times. This also disables the logging of the received
219+
request on core 0 to avoid flooding the logs too much.
220+
208221
config SCHEDULE_LOG_CYCLE_STATISTICS
209222
bool "Log cycles per tick statistics for each task separately"
210223
default y

src/ipc/ipc4/handler.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,11 +1558,19 @@ void ipc_cmd(struct ipc_cmd_hdr *_hdr)
15581558
{
15591559
struct ipc4_message_request *in = ipc4_get_message_request();
15601560
enum ipc4_message_target target;
1561+
#ifdef CONFIG_DEBUG_IPC_TIMINGS
1562+
struct ipc4_message_request req;
1563+
uint64_t tstamp;
1564+
#endif
15611565
int err;
15621566

1567+
#ifdef CONFIG_DEBUG_IPC_TIMINGS
1568+
req = *in;
1569+
tstamp = sof_cycle_get_64();
1570+
#else
15631571
if (cpu_is_primary(cpu_get_id()))
15641572
tr_info(&ipc_tr, "rx\t: %#x|%#x", in->primary.dat, in->extension.dat);
1565-
1573+
#endif
15661574
/* no process on scheduled thread */
15671575
atomic_set(&msg_data.delayed_reply, 0);
15681576
msg_data.delayed_error = 0;
@@ -1676,9 +1684,14 @@ void ipc_cmd(struct ipc_cmd_hdr *_hdr)
16761684

16771685
msg_reply.header = reply.primary.dat;
16781686

1687+
#ifdef CONFIG_DEBUG_IPC_TIMINGS
1688+
tr_info(&ipc_tr, "tx-reply\t: %#x|%#x to %#x|%#x in %llu us", msg_reply.header,
1689+
msg_reply.extension, req.primary.dat, req.extension.dat,
1690+
k_cyc_to_us_near64(sof_cycle_get_64() - tstamp));
1691+
#else
16791692
tr_dbg(&ipc_tr, "tx-reply\t: %#x|%#x", msg_reply.header,
16801693
msg_reply.extension);
1681-
1694+
#endif
16821695
ipc4_send_reply(&reply);
16831696
}
16841697
}

0 commit comments

Comments
 (0)