Update win32 demo to exercise configRUN_TIME_COUNTER_TYPE (#623)

* PR https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/350 introduced configRUN_TIME_COUNTER_TYPE and ulTaskGetIdleRunTimePercent().  This PR updates the Win32 demo to exercise both additions with configRUN_TIME_COUNTER_TYPE set to uint64_t.

* Add ultaskgetidleruntimepercent to lexicon.txt.

Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
This commit is contained in:
RichardBarry 2022-03-18 10:31:59 -07:00 committed by GitHub
parent c75769438a
commit 92b26dbf99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 10 deletions

View file

@ -46,7 +46,7 @@
#define configUSE_DAEMON_TASK_STARTUP_HOOK 1 #define configUSE_DAEMON_TASK_STARTUP_HOOK 1
#define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */ #define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */ #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 52 * 1024 ) ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 52 * 1024 ) ) /* This demo tests heap_5 so places multiple blocks within this total heap size. See mainREGION_1_SIZE to mainREGION_3_SIZE definitions in main.c. */
#define configMAX_TASK_NAME_LEN ( 12 ) #define configMAX_TASK_NAME_LEN ( 12 )
#define configUSE_TRACE_FACILITY 1 #define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
@ -75,7 +75,8 @@
#define configMAX_PRIORITIES ( 7 ) #define configMAX_PRIORITIES ( 7 )
/* Run time stats gathering configuration options. */ /* Run time stats gathering configuration options. */
unsigned long ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */ #define configRUN_TIME_COUNTER_TYPE uint64_t
configRUN_TIME_COUNTER_TYPE ulGetRunTimeCounterValue( void ); /* Prototype of function that returns run time counter. */
void vConfigureTimerForRunTimeStats( void ); /* Prototype of function that initialises the run time counter. */ void vConfigureTimerForRunTimeStats( void ); /* Prototype of function that initialises the run time counter. */
#define configGENERATE_RUN_TIME_STATS 1 #define configGENERATE_RUN_TIME_STATS 1
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats() #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats()

View file

@ -71,10 +71,10 @@ LARGE_INTEGER liPerformanceCounterFrequency, liInitialRunTimeValue;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
unsigned long ulGetRunTimeCounterValue( void ) configRUN_TIME_COUNTER_TYPE ulGetRunTimeCounterValue( void )
{ {
LARGE_INTEGER liCurrentCount; LARGE_INTEGER liCurrentCount;
unsigned long ulReturn; configRUN_TIME_COUNTER_TYPE ulReturn;
/* What is the performance counter value now? */ /* What is the performance counter value now? */
QueryPerformanceCounter( &liCurrentCount ); QueryPerformanceCounter( &liCurrentCount );
@ -90,7 +90,7 @@ unsigned long ulReturn;
} }
else else
{ {
ulReturn = ( unsigned long ) ( ( liCurrentCount.QuadPart - llInitialRunTimeCounterValue ) / llTicksPerHundedthMillisecond ); ulReturn = ( configRUN_TIME_COUNTER_TYPE ) ( ( liCurrentCount.QuadPart - llInitialRunTimeCounterValue ) / llTicksPerHundedthMillisecond );
} }
return ulReturn; return ulReturn;

View file

@ -70,7 +70,7 @@ The blinky demo is implemented and described in main_blinky.c.
If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 then the comprehensive test and If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 then the comprehensive test and
demo application will be built. The comprehensive test and demo application is demo application will be built. The comprehensive test and demo application is
implemented and described in main_full.c. */ implemented and described in main_full.c. */
#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0 #define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 1
/* This demo uses heap_5.c, and these constants define the sizes of the regions /* This demo uses heap_5.c, and these constants define the sizes of the regions
that make up the total heap. heap_5 is only used for test and example purposes that make up the total heap. heap_5 is only used for test and example purposes
@ -78,7 +78,7 @@ as this demo could easily create one large heap region instead of multiple
smaller heap regions - in which case heap_4.c would be the more appropriate smaller heap regions - in which case heap_4.c would be the more appropriate
choice. See http://www.freertos.org/a00111.html for an explanation. */ choice. See http://www.freertos.org/a00111.html for an explanation. */
#define mainREGION_1_SIZE 8201 #define mainREGION_1_SIZE 8201
#define mainREGION_2_SIZE 29905 #define mainREGION_2_SIZE 31905
#define mainREGION_3_SIZE 7807 #define mainREGION_3_SIZE 7807
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -245,7 +245,7 @@ uint32_t ulReceivedValue;
console output) from a FreeRTOS task. */ console output) from a FreeRTOS task. */
if( ulReceivedValue == mainVALUE_SENT_FROM_TASK ) if( ulReceivedValue == mainVALUE_SENT_FROM_TASK )
{ {
printf( "Message received from task\r\n" ); printf( "Message received from task - idle time %llu%%\r\n", ulTaskGetIdleRunTimePercent() );
} }
else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER ) else if( ulReceivedValue == mainVALUE_SENT_FROM_TIMER )
{ {

View file

@ -389,12 +389,13 @@ HeapStats_t xHeapStats;
configASSERT( xHeapStats.xAvailableHeapSpaceInBytes == xPortGetFreeHeapSize() ); configASSERT( xHeapStats.xAvailableHeapSpaceInBytes == xPortGetFreeHeapSize() );
configASSERT( xHeapStats.xMinimumEverFreeBytesRemaining == xPortGetMinimumEverFreeHeapSize() ); configASSERT( xHeapStats.xMinimumEverFreeBytesRemaining == xPortGetMinimumEverFreeHeapSize() );
printf( "%s - tick count %zu - free heap %zu - min free heap %zu - largest free block %zu \r\n", printf( "%s - tick count %zu - free heap %zu - min free heap %zu - largest free block %zu - idle time %llu%%\r\n",
pcStatusMessage, pcStatusMessage,
xTaskGetTickCount(), xTaskGetTickCount(),
xHeapStats.xAvailableHeapSpaceInBytes, xHeapStats.xAvailableHeapSpaceInBytes,
xHeapStats.xMinimumEverFreeBytesRemaining, xHeapStats.xMinimumEverFreeBytesRemaining,
xHeapStats.xSizeOfLargestFreeBlockInBytes ); xHeapStats.xSizeOfLargestFreeBlockInBytes,
ulTaskGetIdleRunTimePercent() );
} }
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -2827,6 +2827,7 @@ ulstartingperiodms
ulstatsoverflowcount ulstatsoverflowcount
ulstringlength ulstringlength
ultaskendtrace ultaskendtrace
ultaskgetidleruntimepercent
ultasknotifytake ultasknotifytake
ultasknotifytakeindexed ultasknotifytakeindexed
ultasknotifyvalueclearindexed ultasknotifyvalueclearindexed