-
Notifications
You must be signed in to change notification settings - Fork 1.4k
tests: nrf5340_audio: Added high CPU load print #26101
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
base: main
Are you sure you want to change the base?
tests: nrf5340_audio: Added high CPU load print #26101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds high CPU load monitoring to the nRF5340 Audio application by integrating Zephyr's CPU load subsystem. When CPU usage exceeds 98%, a callback prints a warning message using printk instead of the logging subsystem to ensure the message is displayed even when high-priority threads monopolize CPU time.
- Added CPU load monitoring with a 98% threshold and callback handler
- Configured CPU load subsystem with periodic logging every 5 seconds
- Updated release notes to document the new high CPU load monitoring feature
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| applications/nrf5340_audio/src/utils/peripherals.c | Implements CPU load callback that prints warning when load exceeds 98% |
| applications/nrf5340_audio/prj.conf | Enables CPU load subsystem and configures periodic logging |
| doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst | Documents the new high CPU load callback feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CI InformationTo view the history of this post, click the 'edited' button above Inputs:Sources:sdk-nrf: PR head: 94b8a82f372d54ee11a180dd16fa0e76d948d19c more detailssdk-nrf:
Github labels
List of changed files detected by CI (3)Outputs:ToolchainVersion: 43683a87ea Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
|
You can find the documentation preview for this PR here. Preview links for modified nRF Connect SDK documents: |
| * Added: | ||
| * High CPU load callback using the Zephyr CPU load subsystem. | ||
| The callback uses a printk, as the logging subsystem will be scheduled out if higher priority threads take all CPU time. | ||
| This will make it easier to debug high CPU load situations in the application. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Added: | |
| * High CPU load callback using the Zephyr CPU load subsystem. | |
| The callback uses a printk, as the logging subsystem will be scheduled out if higher priority threads take all CPU time. | |
| This will make it easier to debug high CPU load situations in the application. | |
| * Added high CPU load callback using the Zephyr CPU load subsystem. | |
| The callback uses a :c:func:`printk` function, as the logging subsystem is scheduled out if higher priority threads take all CPU time. | |
| This makes debugging high CPU load situations easier in the application. |
e71f64e to
e7b8f51
Compare
e7b8f51 to
08fa00d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst
Outdated
Show resolved
Hide resolved
doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst
Outdated
Show resolved
Hide resolved
peknis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok after fixing the issues pointed out by Copilot.
08fa00d to
a974eed
Compare
a974eed to
19df3f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #include <zephyr/logging/log.h> | ||
| LOG_MODULE_REGISTER(peripherals, CONFIG_PERIPHERALS_LOG_LEVEL); | ||
|
|
||
| static struct board_version board_rev; |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic number 98 lacks explanation. Add a comment describing why this specific threshold was chosen (e.g., indicating near-saturation CPU load requiring attention).
| static struct board_version board_rev; | |
| static struct board_version board_rev; | |
| /* Threshold for high CPU load (in percent). 98% indicates near-saturation and requires attention. */ |
19df3f7 to
e75f5c6
Compare
Using the high CPU load monitoring feature, print a message using printk when the CPU load exceeds a defined threshold. OCT-3414 Signed-off-by: Kristoffer Skøien <[email protected]>
e75f5c6 to
94b8a82
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Disable LOG_PRINTK to ensure printk messages are displayed even under high CPU load, | ||
| # by preventing them from being processed by the logging subsystem. | ||
| CONFIG_LOG_PRINTK=n | ||
| CONFIG_CPU_LOAD_LOG_PERIODICALLY=5000 |
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on line 83 mentions 'Log high CPU load using printk', but CONFIG_CPU_LOAD_LOG_PERIODICALLY controls periodic CPU load logging through the logging subsystem, not the high CPU load callback. Consider adding a comment explaining that this enables periodic CPU load statistics logging every 5000ms, separate from the high load threshold callback.
| LOG_MODULE_REGISTER(peripherals, CONFIG_PERIPHERALS_LOG_LEVEL); | ||
|
|
||
| static struct board_version board_rev; | ||
| #define CPU_LOAD_HIGH_THRESHOLD_PERCENT 98 | ||
|
|
Copilot
AI
Dec 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider making CPU_LOAD_HIGH_THRESHOLD_PERCENT configurable via Kconfig instead of hardcoding it. This would allow different threshold values for different builds without modifying source code, improving maintainability and flexibility.
| LOG_MODULE_REGISTER(peripherals, CONFIG_PERIPHERALS_LOG_LEVEL); | |
| static struct board_version board_rev; | |
| #define CPU_LOAD_HIGH_THRESHOLD_PERCENT 98 | |
| #include <zephyr/kernel.h> | |
| LOG_MODULE_REGISTER(peripherals, CONFIG_PERIPHERALS_LOG_LEVEL); | |
| static struct board_version board_rev; |
Using the high CPU load monitoring feature, print a message using printk when the CPU load exceeds a defined threshold.
OCT-3414