Tick rate of RTOS, strange behaviour

ogor4 wrote on Friday, May 29, 2015:

Hello all,

I’m making series of tests for FreeRTOS and other RTOSs. One of the test look like this:

  • create thread which make series of calculation on [1024] unsigned long array (global), when all calculation are performed increase counter (unsigned long). Repeate whole proces again, and again…
  • create higher priority thread which preempt “calculation” thread after 15 seconds (using vTaskDelay).

I want to test it for tick rate 10, 100, 250, 500 and 1000 Hz.
I found this strange behaviour:

As you can see this is OS - independend (blue - first RTOS, red - second RTOS). 100 and 250 Hz performance are really bad, and 500 and 1000 Hz back to “normal”. I think that higher tick rate call OS more frequently and performance should decrease. Any ideas what are happened there?

FreeRTOS config: http://textuploader.com/z7ku

If you need more information don’t hestitate to ask.


rtel wrote on Friday, May 29, 2015:

I would expect the difference to be negligible.

Can you show the code that calculates the delay time.

Also can you verify the tick rate you think you are getting is the tick rate you actually get by viewing the xTickCount variable in task.c or using a scope as it may be in the strange cases the processor is just continuously reentering an interrupt.


ogor4 wrote on Friday, May 29, 2015:


I simply used
vTaskDelay((seconds * configTICK_RATE_HZ))

define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ).

I print the value of xTaskGetTickCount(), after higher priority thread wakes ups:

1000 Hz:
1 wake up: 15000 ticks
2 wake up: 30039 ticks (those 39 ticks is okay to me, since after wake up, task prints all test results to LCD screen; after printing goes to sleep again)
3 wake up: 45078 ticks

250 Hz:
1 wake up: 3750 ticks
2 wake up: 7510 ticks
3 wake up: 11270 ticks

100 Hz:
1 wake up: 1500 ticks
2 wake up: 3004 ticks
3 wake up: 4508 ticks

From my POV values are correct. I put the code of tasks here: http://textuploader.com/z2uc