FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [November 2008 Threads] idleTask - utilizationPosted by Martin Velek on November 18, 2008 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
RE: idleTask - utilizationPosted by Dave on November 18, 2008 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 )
RE: idleTask - utilizationPosted by Martin Velek on November 18, 2008 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
RE: idleTask - utilizationPosted by Dave on November 18, 2008 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.
RE: idleTask - utilizationPosted by Martin Velek on November 18, 2008 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
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|