How to measure the time,to send&receive the message from"Message queue" for different number of messages

sasikalaswathi wrote on Thursday, September 19, 2019:

I want to validate the time taken to send the “message” to message queue and receive the message from message queue. could you suggest any method how to validate that time?

heinbali01 wrote on Thursday, September 19, 2019:

The easiest way to measure time is calling xTaskGetTickCount().
If your FreeRTOS clock runs at 1000 H0z, it will give you a precision of 1 or 2 millisecond.
Sending / receiving messages through a message queue, will take a fraction of a millisecond, so you will need a more precise clock. Normally I’d use a Timer-Counter, which can be configured to run at any speed. A 32-bit timer can give you microseconds, and a timer interrupt at every second to count the seconds as well.
Mind you that the speed depends heavily on a a few settings: stack checking makes things slower. And also the compiler optimisation level has a big influence.

xz8987f wrote on Thursday, September 19, 2019:

If you are running FreeRTOS on an ARM Cortex M3/4/7, then you could use the ARM cycle counter: https://mcuoneclipse.com/2017/01/30/cycle-counting-on-arm-cortex-m-with-dwt/

heinbali01 wrote on Thursday, September 19, 2019:

And if you’re using Xilinx Zynq, you can use XTime_GetTime(). See an example in the attachment “hr_gettime.c”