-
Notifications
You must be signed in to change notification settings - Fork 749
[nrf fromtree] Add cpu_load module #2657
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
Merged
Merged
+483
−9
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Mar 21, 2025
a29d0b6 to
64b465e
Compare
nordicjm
approved these changes
Apr 1, 2025
64b465e to
05b7bae
Compare
mstasiaknordic
approved these changes
Apr 9, 2025
kl-cruz
approved these changes
Apr 9, 2025
nika-nordic
approved these changes
Apr 9, 2025
adamkondraciuk
approved these changes
Apr 9, 2025
Add module which can measure CPU idle time. Idle time is measured in the pre/post CPU idle hooks but they are not provided by this module. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no> (cherry picked from commit c7d7aac)
Add new tracing API which is called when core is exiting from idle. Current implementation is using it to track CPU load. Implementation in tracing_none is now weak so it can be used if given backend does not support new API call. When CONFIG_CPU_LOAD is enabled then sys_trace_idle also calls a hook which stores the timing information when CPU entered idle. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no> (cherry picked from commit 4cbafc6)
Add calls to sys_trace_idle_exit when leaving idle state. It is used to track CPU load. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no> (cherry picked from commit 0ec2ad5)
Add test for CPU load. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no> (cherry picked from commit 688b561)
Add documentation for CPU load module. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no> (cherry picked from commit f68a086)
Add sys_trace_idle_exit to RISCV cpu_idle functions and allow enabling CPU_LOAD module for RISCV and disable it for SMP. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no> (cherry picked from commit 4026daa)
Allow test execution for riscv since it now supports cpu_load module. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no> (cherry picked from commit 29bc28a)
Add calls to sys_trace_idle and sys_trace_idle_exit in nrf54h specific idle states to allow measuring CPU load on nrf54h20 when power management is enabled. Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no> (cherry picked from commit 37fe750)
05b7bae to
97149a1
Compare
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Add cpu_load module with support for cortex_m and riscv.
nrf54h20dk//cpuppr and cpuflpr will report invalid value (100%) because of VPR bug which requires that they use custom idle functions which do not block interrupts when going to idle. FLPR on nRF54L does not have that bug so cpu_load works correctly on that target.