vApplicationTickHook()

Does anyone have information on the use of vApplicationTickHook() to measure the execution time of a task? Thanks.

vApplicationTickHook()

Yes, vApplicationTickHook() can be used to measure execution times of task, but I would not recommend it. The hook is running from an ISR. In a way, xTaskGetTickCount() can also be useful to measure clock ticks. What I like to use is this: ~~~

if ( configUSETRACEFACILITY == 1 )

UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime );

endif

~~~ It uses some MACRO’s that must be defined by you: ~~~

define portCONFIGURETIMERFORRUNTIME_STATS() vStartRunTimeCounter()

define portGETRUNTIMECOUNTERVALUE() ulGetRunTimeCounterValue()

~~~ Please check-out freertos.org to find the details. You can use a high-resolution TC (timer/counter) to measure the time. This allows you to get statistics in units of micro-seconds.