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

vTaskListTasks() prints core affinity mask #850

Merged

Conversation

Dazza0
Copy link
Contributor

@Dazza0 Dazza0 commented Oct 23, 2023

Description

Update vTaskListTasks() so that it prints uxCoreAffinityMask if SMP and core affinity masks are enabled. Given that vTaskListTasks() is commonly called in Demo applications, it would be worthwhile printing the core affinity mask for any future SMP FreeRTOS demos.

Test Steps

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.

@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a8650b9) 93.64% compared to head (fb45215) 93.64%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #850   +/-   ##
=======================================
  Coverage   93.64%   93.64%           
=======================================
  Files           6        6           
  Lines        2549     2549           
  Branches      608      608           
=======================================
  Hits         2387     2387           
  Misses        107      107           
  Partials       55       55           
Flag Coverage Δ
unittests 93.64% <ø> (ø)

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

Files Coverage Δ
tasks.c 94.82% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

chinglee-iot
chinglee-iot previously approved these changes Oct 24, 2023
Copy link
Member

@AniruddhaKanhere AniruddhaKanhere left a comment

Choose a reason for hiding this comment

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

Hello @Dazza0, thank you for taking the time to contribute to FreeRTOS.

The PR looks good to me, I am approving it with a minor comment.

( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority,
( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark,
( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber,
( unsigned int ) pxTaskStatusArray[ x ].uxCoreAffinityMask ); /*lint !e586 sprintf() allowed as this is compiled with many compilers and this is a utility function only - not part of the core kernel implementation. */
Copy link
Member

Choose a reason for hiding this comment

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

If we are casting this to (unsigned int) then in the string, should it not be %u instead of %x?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @AniruddhaKanhere I purposely made it %x instead of %u for readability/display reasons. uxCoreAffinityMask stores a bit mask, thus it would be more useful for users to read its value in hex.

Note: I've added a leading 0x in the string format to make it clear it's a hex value.

This commit updates vTaskListTasks so that it prints uxCoreAffinityMask if
core affinity is enabled in configuration.
@Dazza0 Dazza0 dismissed stale reviews from AniruddhaKanhere and chinglee-iot via fb45215 October 25, 2023 11:29
@Dazza0 Dazza0 force-pushed the vTaskListTasks-prints-affinity-mask branch from be31748 to fb45215 Compare October 25, 2023 11:29
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@AniruddhaKanhere AniruddhaKanhere left a comment

Choose a reason for hiding this comment

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

Hello @Dazza0,

Thank you for your response. It makes sense to me.
Also, thank you for making the 0x change.

The pull request looks good to me.

@AniruddhaKanhere AniruddhaKanhere merged commit 4ef0bb6 into FreeRTOS:main Oct 25, 2023
17 checks passed
n9wxu pushed a commit to n9wxu/FreeRTOS-Kernel that referenced this pull request Oct 26, 2023
This commit updates vTaskListTasks so that it prints uxCoreAffinityMask if
core affinity is enabled in configuration.
@Dazza0 Dazza0 deleted the vTaskListTasks-prints-affinity-mask branch October 29, 2023 18:42
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.

4 participants