idleTask – utilization
Hi,
is there a different method to measure time (with logic analyzer, pin L/H) how long FRTOS stays in the idleTask?
I have tried trace macros
traceTASK_SWITCHED_IN()
if (0 == strcmp(pxCurrentTCB->pcTaskName, "IDLE")) ….
traceTASK_SWITCHED_OUT()
if (0 == strcmp(pxCurrentTCB->pcTaskName, "IDLE")) ….
but it is a little uncomfortably to compare 5 bytes and call library function.
Thanks
Martin
idleTask – utilization
The idle task is automatically created when the scheduler is started. If you create all your tasks before the scheduler starts, and never delete any tasks, then you can use
traceTASK_SWITCHED_IN()
if( (uxCurrentNumberOfTasks – 1) == pxCurrentTCB->uxTCBNumber )
but configUSE_TRACE_FACILITY must be set to 1.
Another way is to store a handle to the idle. Assuming you store this in a variable called xIdleTaskHandle then you can do
traceTASK_SWITCHED_IN()
if( pxCurrentTCB == xIdleTaskHandle )
idleTask – utilization
Yes,
the first solution seems fine.
How to store xIdleTaskHandle? In vTaskStartScheduler() is called xTaskCreate( prvIdleTask, ( signed portCHAR * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL ); so I think that I should create vApplicationIdleHook(), call xTaskGetCurrentTaskHandle() in it and store to global variable?
Thank You
Martin
idleTask – utilization
That would work, but you could just edit the call to
xTaskCreate( prvIdleTask, ( signed portCHAR * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL );
as
xTaskCreate( prvIdleTask, ( signed portCHAR * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, tskIDLE_PRIORITY, &xIdleTaskHandle );
just the last parameter is different.
idleTask – utilization
Ok, I only wanted to avoid editing source code of FT(task.c).
Many thanks that you noticed configUSE_TRACE_FACILITY option. I was confused, why it don’t work before reading third paragraph :).
Martin