FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [June 2012 Threads] Enhance vTaskList() and vTaskGetRunTimeStatsPosted by Preet Kang on June 1, 2012 Barry,
The vTaskList() and vTaskGetRunTimeStats() can be enhanced to not use pcStatsString[] at all, which will reduce RAM footprint by 100 bytes. The execution speed will also benefit. Instead of sprintf() and strcat(), we can use this: sprintf(vBuff + strlen(vBuff), "%s ...", taskName);
This way, sprintf will append to vBuff rather than using sprintf and strcat().
I've also enhanced the vTaskGetRunTimeStats() by adding vTaskResetRunTimeStats(). Without resetting the run time counters, it is difficult to see CPU utilization of recent activity. This change is really trivial, which is to reset Task counters, ulRunTimeCounter, and have a Portable function to reset the hardware timer.
Let me know if you'd like me to post code. I've got a working/tested version that also follows your coding standards.
Preet
RE: Enhance vTaskList() and vTaskGetRunTimeStatsPosted by Richard on June 2, 2012 Yes! Please post the code. The best place would be the "any other" forum in the FreeRTOS Interactive site:
http://interactive.freertos.org/forums/135282-any-other-files-any-other-manufacturers-any-other-business
It would also be an idea to post a feature request in the SourceForge tracker to point to your FreeRTOS interactive post too, to ensure it doesn't get lost in the noise.
Regards.
RE: Enhance vTaskList() and vTaskGetRunTimeStatsPosted by hackridsourceforge on June 26, 2013 Hi,
i did some modifications, too:
static void prvListTaskWithinSingleList( const signed char *pcWriteBuffer, xList *pxList, signed char cStatus ) { volatile tskTCB *pxNextTCB, *pxFirstTCB; unsigned short usStackRemaining;
/* Write the details of all the TCB's in pxList into the buffer. */ listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList ); do { listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList ); #if ( portSTACK_GROWTH > 0 ) { usStackRemaining = usTaskCheckFreeStackSpace( ( unsigned char * ) pxNextTCB->pxEndOfStack ); } #else { usStackRemaining = usTaskCheckFreeStackSpace( ( unsigned char * ) pxNextTCB->pxStack ); } #endif
sprintf( pcStatusString, ( char * ) "%24s\t\t%c\t%u\t%u\t%u\r\n", pxNextTCB->pcTaskName, cStatus, ( unsigned int ) pxNextTCB->uxPriority, usStackRemaining, ( unsigned int ) pxNextTCB->uxTCBNumber ); strcat( ( char * ) pcWriteBuffer, ( char * ) pcStatusString );
} while( pxNextTCB != pxFirstTCB ); }
otherwise the prints in the console windows get messed up by variing task name lengths.
is there a way to sort the output of vTaskList eg by task number so that repetive prints only vary in the numbers printed and not in the task position in the printed table?
RE: Enhance vTaskList() and vTaskGetRunTimeStatsPosted by hackridsourceforge on June 26, 2013 by the way:
where is the code uploaded by preetpal? did it made it to a freertos release?
thanks
RE: Enhance vTaskList() and vTaskGetRunTimeStatsPosted by Richard on June 26, 2013 I have already made updates to remove pcStatsString[].
The next release will generate the run time and task stats as binary data, then have the existing functions that format the data into a human readable form from the binary data as external utility functions - thus removing sprintf() from tasks.c. Users are then free to use their own functions to format the data in any way they wish from the binary data, or indeed just use the binary data itself.
Regards.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|