stack record: fix ps can't show stack used

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2024-03-07 11:38:51 +08:00 committed by Xiang Xiao
parent 632b13fe03
commit 63db77628e
1 changed files with 18 additions and 18 deletions

View File

@ -1040,6 +1040,24 @@ static ssize_t proc_stack(FAR struct proc_file_s *procfile,
buffer += copysize;
remaining -= copysize;
#ifdef CONFIG_STACK_COLORATION
if (totalsize >= buflen)
{
return totalsize;
}
/* Show the stack size */
linesize = procfs_snprintf(procfile->line, STATUS_LINELEN, "%-12s%ld\n",
"StackUsed:", (long)up_check_tcbstack(tcb));
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining,
&offset);
totalsize += copysize;
buffer += copysize;
remaining -= copysize;
#endif
#if CONFIG_SCHED_STACK_RECORD > 0
linesize = procfs_snprintf(procfile->line, STATUS_LINELEN, "%-12s%zu\n",
"StackMax: ",
@ -1091,24 +1109,6 @@ static ssize_t proc_stack(FAR struct proc_file_s *procfile,
}
#endif
#ifdef CONFIG_STACK_COLORATION
if (totalsize >= buflen)
{
return totalsize;
}
/* Show the stack size */
linesize = procfs_snprintf(procfile->line, STATUS_LINELEN, "%-12s%ld\n",
"StackUsed:", (long)up_check_tcbstack(tcb));
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining,
&offset);
totalsize += copysize;
buffer += copysize;
remaining -= copysize;
#endif
return totalsize;
}