posix: multi process: add support for times() #97357
Open
+263
−31
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 support for the
times()
function, which can be used to get the number of ticks spent in "system" and "user" mode, and which returns the "real time" that has expired, since an arbitrary point in the past.The following invariant should always hold:
The
times()
function measures time for the calling process and all of it's child processes. In Zephyr, we don't support separate processes (yet), so the time spent in child processes is zero.Additionally, in Zephyr we do not differentiate between "system" time (i.e. time spent executing kernel code) and "user" time (time spent executing application code). We only have information on "total time" (time spent executing code) and "execution time" (time spent executing code plus idle time).
For now, only report utime, since it is not clear how to obtain other values.
Closes #51978