Skip to content

Commit 1187a1f

Browse files
author
Jyri Sarha
committed
zephyr: shell: Add sof module_container_usage command
Add sof module_container_usage command that prints out currently used resource containers and high water mark for each module instance. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent 7d68e2d commit 1187a1f

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

zephyr/sof_shell.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,32 @@ static int cmd_sof_module_heap_usage(const struct shell *sh,
6868
return 0;
6969
}
7070

71+
static int cmd_sof_module_container_usage(const struct shell *sh,
72+
size_t argc, char *argv[])
73+
{
74+
struct ipc *ipc = sof_get()->ipc;
75+
struct list_item *clist, *_clist;
76+
struct ipc_comp_dev *icd;
77+
78+
if (!ipc) {
79+
shell_print(sh, "No IPC");
80+
return 0;
81+
}
82+
83+
list_for_item_safe(clist, _clist, &ipc->comp_list) {
84+
size_t usage, hwm;
85+
86+
icd = container_of(clist, struct ipc_comp_dev, list);
87+
if (icd->type != COMP_TYPE_COMPONENT)
88+
continue;
89+
90+
usage = module_adapter_container_usage(comp_mod(icd->cd), &hwm);
91+
shell_print(sh, "comp id 0x%08x%9zu usage%9zu hwm",
92+
icd->id, usage, hwm);
93+
}
94+
return 0;
95+
}
96+
7197
SHELL_STATIC_SUBCMD_SET_CREATE(sof_commands,
7298
SHELL_CMD(test_inject_sched_gap, NULL,
7399
"Inject a gap to audio scheduling\n",
@@ -77,6 +103,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(sof_commands,
77103
"Print heap memory usage of each module\n",
78104
cmd_sof_module_heap_usage),
79105

106+
SHELL_CMD(module_container_usage, NULL,
107+
"Print resource tracking container usage of each module\n",
108+
cmd_sof_module_container_usage),
109+
80110
SHELL_SUBCMD_SET_END
81111
);
82112

0 commit comments

Comments
 (0)