Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Enhance vTaskList() and vTaskGetRunTimeStats

Posted 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 vTaskGetRunTimeStats

Posted 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 vTaskGetRunTimeStats

Posted 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 vTaskGetRunTimeStats

Posted 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 vTaskGetRunTimeStats

Posted 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.


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists