mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-12 17:17:44 -04:00
这是一个实用的排序,可以将任务列表以固定的顺序打印.
以前打印的任务列表是乱序的,查看非常不方便
This commit is contained in:
parent
4ad84923a0
commit
af2f1f7b3b
1 changed files with 11 additions and 2 deletions
13
tasks.c
13
tasks.c
|
@ -4422,7 +4422,7 @@ static void prvResetNextTaskUnblockTime( void )
|
||||||
void vTaskList( char * pcWriteBuffer )
|
void vTaskList( char * pcWriteBuffer )
|
||||||
{
|
{
|
||||||
TaskStatus_t * pxTaskStatusArray;
|
TaskStatus_t * pxTaskStatusArray;
|
||||||
UBaseType_t uxArraySize, x;
|
UBaseType_t uxArraySize, i, x;
|
||||||
char cStatus;
|
char cStatus;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4470,8 +4470,17 @@ static void prvResetNextTaskUnblockTime( void )
|
||||||
uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, NULL );
|
uxArraySize = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, NULL );
|
||||||
|
|
||||||
/* Create a human readable table from the binary data. */
|
/* Create a human readable table from the binary data. */
|
||||||
for( x = 0; x < uxArraySize; x++ )
|
for(i = 1; i <= uxArraySize; i++)
|
||||||
{
|
{
|
||||||
|
for(x = 0; x < uxArraySize; x++)
|
||||||
|
{
|
||||||
|
if(i == pxTaskStatusArray[x].xTaskNumber)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(x >= uxArraySize)
|
||||||
|
continue;
|
||||||
|
|
||||||
switch( pxTaskStatusArray[ x ].eCurrentState )
|
switch( pxTaskStatusArray[ x ].eCurrentState )
|
||||||
{
|
{
|
||||||
case eRunning:
|
case eRunning:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue