Skip to content

Conversation

@ehud117
Copy link

@ehud117 ehud117 commented Sep 9, 2024

Fix getting stats on the current running task running time via vTaskGetInfo.
This is especially important if the current task is stuck
Description

I caused a task to stuck with while (true){} and when my watchdog catches it display the correct running time after my change.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…etInfo. This is especially important if the current task is stuck
@ehud117 ehud117 requested a review from a team as a code owner September 9, 2024 08:33
@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 9, 2024

@aggarg
Copy link
Member

aggarg commented Sep 9, 2024

ulRunTimeCounter is stored in TCB and is updated every time when a task is switched out to the time the task spent in the running state. The proposed change is not correct as the calling task can be switched out in the middle of this calculation which will invalidate the calculation. For example (code simplified for readability) -

if( pxTCB == pxCurrentTCB )
{
      uint32_t ulCurrentTotalRunTime;
      ulCurrentTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE();
      /* Context switch. */
      pxTaskStatus->ulRunTimeCounter += ( ulCurrentTotalRunTime - ulTaskSwitchedInTime );
}

whlie(1) is not a real use case. What problem are you trying to solve?

@aggarg
Copy link
Member

aggarg commented Sep 16, 2024

As I have not heard back, I am closing this PR. Feel free to reopen if you need anything from us.

@aggarg aggarg closed this Sep 16, 2024
moninom1 pushed a commit to moninom1/FreeRTOS-Kernel that referenced this pull request Sep 30, 2025
Add x64 configuration to Win32-MSVC demo.

This was originally contributed in this PR - FreeRTOS#1139

---------

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: José Simões <jose.simoes@eclo.solutions>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants