profcs task status will now show CPU is SMP is enabled

This commit is contained in:
Gregory Nutt
2016-02-19 15:34:36 -06:00
parent 3994b094c5
commit 050b3ee06a
4 changed files with 37 additions and 1 deletions
+25
View File
@@ -375,6 +375,7 @@ static FAR const struct proc_node_s *proc_findnode(FAR const char *relpath)
* Type: xxxxxxx {Task, pthread, Kthread, Invalid}
* PPID: xxxxx Parent thread ID
* Group: xxxxx Group ID
* CPU: xxx CPU (CONFIG_SMP only)
* State: xxxxxxxx,xxxxxxxxx {Invalid, Waiting, Ready, Running, Inactive},
* {Unlock, Semaphore, Signal, MQ empty, MQ full}
* Flags: xxx N,P,X
@@ -461,6 +462,30 @@ static ssize_t proc_status(FAR struct proc_file_s *procfile,
}
#endif
#ifdef CONFIG_SMP
if (tcb->task_state >= FIRST_ASSIGNED_STATE &&
tcb->task_state <= LAST_ASSIGNED_STATE)
{
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%d\n", "CPU:",
tcb->cpu);
}
else
{
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s---\n", "CPU:");
}
copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset);
totalsize += copysize;
buffer += copysize;
remaining -= copysize;
if (totalsize >= buflen)
{
return totalsize;
}
#endif
/* Show the thread state */
linesize = snprintf(procfile->line, STATUS_LINELEN, "%-12s%s\n", "State:",