Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeRTOS: add mutex hold count to task status info (IDFGH-3762) #5682

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/freertos/include/freertos/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ typedef struct xTASK_STATUS
eTaskState eCurrentState; /*!< The state in which the task existed when the structure was populated. */
UBaseType_t uxCurrentPriority; /*!< The priority at which the task was running (may be inherited) when the structure was populated. */
UBaseType_t uxBasePriority; /*!< The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */
UBaseType_t uxMutexesHeld; /*!< The number of mutexes currently held by the task. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dexterbg , could you please put this field around a configUSE_MUTEXES ifdef? Since this is more a debug feature, release applications may not use it, and it could be good to save more memory as possible on the TCBs.

uint32_t ulRunTimeCounter; /*!< The total run time allocated to the task so far, as defined by the run time stats clock. See http://www.freertos.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
StackType_t *pxStackBase; /*!< Points to the lowest address of the task's stack area. */
uint32_t usStackHighWaterMark; /*!< The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */
Expand Down
2 changes: 2 additions & 0 deletions components/freertos/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3753,10 +3753,12 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
#if ( configUSE_MUTEXES == 1 )
{
pxTaskStatusArray[ uxTask ].uxBasePriority = pxNextTCB->uxBasePriority;
pxTaskStatusArray[ uxTask ].uxMutexesHeld = pxNextTCB->uxMutexesHeld;
}
#else
{
pxTaskStatusArray[ uxTask ].uxBasePriority = 0;
pxTaskStatusArray[ uxTask ].uxMutexesHeld = 0;
}
#endif

Expand Down