Skip to content

Conversation

@malsyned
Copy link
Contributor

In V11, FreeRTOS changed ulTotalRunTime from an integer to an array of integers. On SMP, the array has one entry per CPU, but it's still a one-element array even without SMP support compiled in.

Try finding the length of the array with sizeof(a)/sizeof(a[0]). If that succeeds, sum all CPU runtimes to get the total runtime. If it fails, assume V10 or earlier and fall back to the previous technique.

@malsyned
Copy link
Contributor Author

@hwmland @haneefdm @PhilippHaefele I would love your input on this.

@hwmland
Copy link
Contributor

hwmland commented Feb 11, 2025

Looks OK for me.

@Jonarw
Copy link

Jonarw commented Mar 5, 2025

Any chance of this getting merged and released soon? I would love to use runtime stats in my FreeRTOS v11 based project!

@haneefdm
Copy link
Contributor

I tried to merge this but it has conflicts with recently merged PR#45. Sorry for the late merge.

@Jonarw, Could you resolve them please?

@malsyned
Copy link
Contributor Author

I'll look into this today, thanks for the heads up

In V11, FreeRTOS changed ulTotalRunTime from an integer to an array of
integers. On SMP, the array has one entry per CPU, but it's still a
one-element array even without SMP support compiled in.

Try finding the length of the array with sizeof(a)/sizeof(a[0]). If that
succeeds, sum all CPU runtimes to get the total runtime. If it fails,
assume V10 or earlier and fall back to the previous technique.
Convert `updateTotalRuntime()` to an async function. Use
`RTOSVarHelper.getVarChildren()` to check for the presence of children
and to get their values.
@malsyned malsyned force-pushed the freertos-11-runtime branch from 209c92d to f801fc7 Compare April 11, 2025 15:42
@malsyned
Copy link
Contributor Author

malsyned commented Apr 11, 2025

OK, I rebased onto the head of main. While I was in there, I also reworked this change into a much simpler one that is more consistent with the way the rest of the code is written.

I tested this updated PR with versions of FreeRTOS that used both an array and a scalar for ulTotalRunTime.

Hopefully you don't mind that I rewrote updateTotalRuntime() to be an async function. It made the logic a lot simpler to express without changing its interface.

@haneefdm haneefdm merged commit 0866241 into mcu-debug:main Apr 11, 2025
3 checks passed
@malsyned malsyned deleted the freertos-11-runtime branch April 14, 2025 22:22
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