shell: modules: kernel: streamline code
This commit includes cleanups to `kernel_service`: - `shell_tdata_dump()`: Adjust formatting to align with `.clang-format`. - `shell_stack_dump()`: Update to pass `sh` directly instead of `user_data` since it is already assigned. Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This commit is contained in:
parent
8fedee30ee
commit
b44250ae46
2 changed files with 10 additions and 10 deletions
|
@ -73,14 +73,14 @@ static void shell_tdata_dump(const struct k_thread *cthread, void *user_data)
|
||||||
tname = k_thread_name_get(thread);
|
tname = k_thread_name_get(thread);
|
||||||
|
|
||||||
shell_print(sh, "%s%p %-10s",
|
shell_print(sh, "%s%p %-10s",
|
||||||
(thread == k_current_get()) ? "*" : " ",
|
(thread == k_current_get()) ? "*" : " ",
|
||||||
thread,
|
thread,
|
||||||
tname ? tname : "NA");
|
tname ? tname : "NA");
|
||||||
/* Cannot use lld as it's less portable. */
|
/* Cannot use lld as it's less portable. */
|
||||||
shell_print(sh, "\toptions: 0x%x, priority: %d timeout: %" PRId64,
|
shell_print(sh, "\toptions: 0x%x, priority: %d timeout: %" PRId64,
|
||||||
thread->base.user_options,
|
thread->base.user_options,
|
||||||
thread->base.prio,
|
thread->base.prio,
|
||||||
(int64_t)thread->base.timeout.dticks);
|
(int64_t)thread->base.timeout.dticks);
|
||||||
shell_print(sh, "\tstate: %s, entry: %p",
|
shell_print(sh, "\tstate: %s, entry: %p",
|
||||||
k_thread_state_str(thread, state_str, sizeof(state_str)),
|
k_thread_state_str(thread, state_str, sizeof(state_str)),
|
||||||
thread->entry.pEntry);
|
thread->entry.pEntry);
|
||||||
|
|
|
@ -41,10 +41,10 @@ static void shell_stack_dump(const struct k_thread *thread, void *user_data)
|
||||||
/* Calculate the real size reserved for the stack */
|
/* Calculate the real size reserved for the stack */
|
||||||
pcnt = ((size - unused) * 100U) / size;
|
pcnt = ((size - unused) * 100U) / size;
|
||||||
|
|
||||||
shell_print(
|
shell_print(sh,
|
||||||
(const struct shell *)user_data, "%p %-" STRINGIFY(THREAD_MAX_NAM_LEN) "s "
|
"%p %-" STRINGIFY(THREAD_MAX_NAM_LEN) "s "
|
||||||
"(real size %4zu):\tunused %4zu\tusage %4zu / %4zu (%2u %%)",
|
"(real size %4zu):\tunused %4zu\tusage %4zu / %4zu (%2u %%)",
|
||||||
thread, tname ? tname : "NA", size, unused, size - unused, size, pcnt);
|
thread, tname ? tname : "NA", size, unused, size - unused, size, pcnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
K_KERNEL_STACK_ARRAY_DECLARE(z_interrupt_stacks, CONFIG_MP_MAX_NUM_CPUS,
|
K_KERNEL_STACK_ARRAY_DECLARE(z_interrupt_stacks, CONFIG_MP_MAX_NUM_CPUS,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue