vxworks下如何查看任务的内存使用
rt
请问命令是什么?谢谢
[解决办法]
taskShow tShell, 1
taskShow()
The following example shows the TCB contents for the shell task:
taskShow() – display task information from TCBs
STATUS taskShow
(
int tid, /* task ID */
int level /* 0 = summary, 1 = details, 2 = all tasks */
)
This routine displays the contents of a task control block (TCB) for a specified task. If leve
is 1, it also displays task options and registers. If level is 2, it displays all tasks.
The TCB display contains the following fields:
Field Meaning
NAME Task name
ENTRY Symbol name or address where task began execution
TID Task ID
PRI Priority
STATUS Task status, as formatted by taskStatusString()
PC Program counter
NAME ENTRY TID PRI STATUS PC SP ERRNO DELAY
---------- --------- -------- --- --------- -------- -------- ------ -----
tShell _shell 20efcac 1 READY 201dc90 20ef980 0 0
stack: base 0x20efcac end 0x20ed59c size 9532 high 1452 margin 8080
options: 0x1e
VX_UNBREAKABLE VX_DEALLOC_STACK VX_FP_TASK VX_STDIO
D0 = 0 D4 = 0 A0 = 0 A4 = 0
D1 = 0 D5 = 0 A1 = 0 A5 = 203a084 SR = 3000
D2 = 0 D6 = 0 A2 = 0 A6 = 20ef9a0 PC = 2038614
D3 = 0 D7 = 0 A3 = 0 A7 = 20ef980
[解决办法]
不一样吧!看注释。
checkStack()
checkStack() – print a summary of each task’s stack usage
void checkStack
(
int taskNameOrId /* task name or task ID; 0 = summarize all */
)
This command displays a summary of stack usage for a specified task, or for all tasks if no
argument is given. The summary includes the total stack size (SIZE), the current number
of stack bytes used (CUR), the maximum number of stack bytes used (HIGH), and the
number of bytes never used at the top of the stack (MARGIN = SIZE - HIGH). For
example:
-> checkStack tShell
NAME ENTRY TID SIZE CUR HIGH MARGIN
------------ ------------ -------- ----- ----- ----- ------
tShell _shell 23e1c78 9208 832 3632 5576
The maximum stack usage is determined by scanning down from the top of the stack for
the first byte whose value is not 0xee. In VxWorks, when a task is spawned, all bytes of a
task’s stack are initialized to 0xee.
DEFICIENCIES It is possible for a task to write beyond the end of its stack, but not write into the last part
of its stack. This will not be detected by checkStack().
RETURNS N/A
SEE ALSO usrLib, taskSpawn(), VxWorks Programmer’s Guide: Target Shell, windsh, Tornado User’s
Guide: Shell
[解决办法]
checkStack