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

Make the type used to hold run-time counter values configurable #350

Conversation

RichardBarry
Copy link
Contributor

Description

Introduce configRUN_TIME_COUNTER_TYPE which enables developers to define the type used to hold run time statistic counters. Defaults to uint32_t for backward compatibility. #define configRUN_TIME_COUNTER_TYPE to a type (for example, uint64_t) in FreeRTOSConfig.h to override the default.

Introduce ulTaskGetIdleRunTimePercent() to complement the pre-existing ulTaskGetIdleRunTimeCounter(). Whereas the pre-existing function returns the raw run time counter value, the new function returns the percentage of the entire run time consumed by the idle task. Note the amount of idle time is only a good measure of the slack time in a system if there are no other tasks executing at the idle priority, tickless idle is not used, and configIDLE_SHOULD_YIELD is set to 0.

Test Steps

Somewhat tested by the Win32 demo in the FreeRTOS/FreeRTOS repo which prints the amount of time used by the idle task in both its comprehensive and blinky demos.

Related Issue

Corresponding updates to the Win32Demo in the FreeRTOS/FreeRTOS repo are in a separate PR that will be created after this one.

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

…ine the type used to hold run time statistic counters. Defaults to uint32_t for backward compatibility. #define configRUN_TIME_COUNTER_TYPE to a type (for example, uint64_t) in FreeRTOSConfig.h to override the default.

Introduce ulTaskGetIdleRunTimePercent() to complement the pre-existing ulTaskGetIdleRunTimeCounter().  Whereas the pre-existing function returns the raw run time counter value, the new function returns the percentage of the entire run time consumed by the idle task.  Note the amount of idle time is only a good measure of the slack time in a system if there are no other tasks executing at the idle priority, tickless
idle is not used, and configIDLE_SHOULD_YIELD is set to 0.
@RichardBarry RichardBarry requested a review from a team as a code owner June 9, 2021 20:30
@codecov
Copy link

codecov bot commented Jun 9, 2021

Codecov Report

Merging #350 (5487418) into main (6a84f2c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #350   +/-   ##
=======================================
  Coverage   92.13%   92.13%           
=======================================
  Files           4        4           
  Lines        1272     1272           
  Branches      342      342           
=======================================
  Hits         1172     1172           
  Misses         53       53           
  Partials       47       47           
Flag Coverage Δ
unittests 92.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6a84f2c...5487418. Read the comment docs.

RichardBarry added a commit to RichardBarry/FreeRTOS that referenced this pull request Jun 10, 2021
…E and ulTaskGetIdleRunTimePercent(). This PR updates the Win32 demo to exercise both additions with configRUN_TIME_COUNTER_TYPE set to uint64_t.
include/FreeRTOS.h Outdated Show resolved Hide resolved
include/mpu_wrappers.h Outdated Show resolved Hide resolved
RichardBarry and others added 2 commits June 10, 2021 18:23
Commit changes to mpu_prototypes.h which were missed from the original commit.
@cobusve cobusve merged commit ddc840f into FreeRTOS:main Jun 14, 2021
@RichardBarry RichardBarry deleted the make-type-used-for-run-time-counter-configurable branch June 16, 2021 01:16
n9wxu pushed a commit to FreeRTOS/FreeRTOS that referenced this pull request Mar 18, 2022
* PR FreeRTOS/FreeRTOS-Kernel#350 introduced configRUN_TIME_COUNTER_TYPE and ulTaskGetIdleRunTimePercent().  This PR updates the Win32 demo to exercise both additions with configRUN_TIME_COUNTER_TYPE set to uint64_t.

* Add ultaskgetidleruntimepercent to lexicon.txt.

Co-authored-by: Cobus van Eeden <[email protected]>
laroche pushed a commit to laroche/FreeRTOS-Kernel that referenced this pull request Apr 18, 2024
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