davidmillarpowe wrote on Sunday, February 04, 2018:
Does anyone have information on the use of vApplicationTickHook() to measure the execution time of a task?
Thanks.
davidmillarpowe wrote on Sunday, February 04, 2018:
Does anyone have information on the use of vApplicationTickHook() to measure the execution time of a task?
Thanks.
heinbali01 wrote on Sunday, February 04, 2018:
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 ( configUSE_TRACE_FACILITY == 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 portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vStartRunTimeCounter()
#define portGET_RUN_TIME_COUNTER_VALUE() 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.