Exercise the new vPortGetHeapStats() function from the Win32 demo projects.

This commit is contained in:
Richard Barry 2019-07-05 20:21:59 +00:00
parent fa404422b9
commit 4d6570b009
7 changed files with 113 additions and 9 deletions

View file

@ -245,6 +245,7 @@ static void prvCheckTask( void *pvParameters )
{
TickType_t xNextWakeTime;
const TickType_t xCycleFrequency = pdMS_TO_TICKS( 4000UL );
HeapStats_t xHeapStats;
/* Just to remove compiler warning. */
( void ) pvParameters;
@ -370,10 +371,17 @@ const TickType_t xCycleFrequency = pdMS_TO_TICKS( 4000UL );
/* This is the only task that uses stdout so its ok to call printf()
directly. */
printf( "%s - tick count %zu - free heap %zu - min free heap %zu\r\n", pcStatusMessage,
xTaskGetTickCount(),
xPortGetFreeHeapSize(),
xPortGetMinimumEverFreeHeapSize() );
vPortGetHeapStats( &xHeapStats );
configASSERT( xHeapStats.xAvailableHeapSpaceInBytes == xPortGetFreeHeapSize() );
configASSERT( xHeapStats.xMinimumEverFreeBytesRemaining == xPortGetMinimumEverFreeHeapSize() );
printf( "%s - tick count %zu - free heap %zu - min free heap %zu - largest free block %zu \r\n",
pcStatusMessage,
xTaskGetTickCount(),
xHeapStats.xAvailableHeapSpaceInBytes,
xHeapStats.xMinimumEverFreeBytesRemaining,
xHeapStats.xSizeOfLargestFreeBlockInBytes );
}
}
/*-----------------------------------------------------------*/