-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
kernel: Add k_thread_runtime_stats_is_enabled function #80450
base: main
Are you sure you want to change the base?
Conversation
fc52903
to
075a033
Compare
70b4aa0
to
04e6d25
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.
Thanks for all of the POSIX clock work.
Just a question / suggestion regarding runtime function call overhead.
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.
Just some suggestions around CONFIG_POSIX_THREAD_CPUTIME
5302a73
to
e9323cc
Compare
I've made change, Please riewer again! |
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.
Kernel side seems reasonable to me.
That's one way to do it, but in Zephyr we almost always separate code and test commits. |
I've made change :) @cfriedt |
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.
Apart from the comments below, the commits should be reordered such that kernel: Add k_thread_runtime_stats_is_enabled function
comes before posix: Add posix CLOCK_THREAD_CPUTIME_ID support
.
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.
Forgot I had one pending comment 😬
This PR has been deferred to 4.1. Maybe I won't be in such a hurry to handle it. I will prepare a PR for the implementation of |
I've change them, please review again :) |
CI throws. Emmm, I don't know :(
|
@rruuaanng - this seems like an unrelated issue in CI. You might need to rebase once it's resolved on main. |
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.
refresh +1 while I'm here before the CI passes
Probably needs a rebase. qemu_arc_em was doing something kind of wacky, so I made a pr to disable it for the test that's failing. |
7891263
to
af1cf97
Compare
Add 'k_thread_runtime_stats_is_enabled' to 'usage.c', which's used to check whether runtime statistics collection is enabled for a thread. Signed-off-by: James Roy <[email protected]>
Add test for 'k_thread_runtime_stats_is_enabled(tid)'. Signed-off-by: James Roy <[email protected]>
Add posix 'CLOCK_THREAD_CPUTIME_ID' support to measure the total CPU execution time of the current thread. Signed-off-by: James Roy <[email protected]>
Add test for 'clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts)'. Signed-off-by: James Roy <[email protected]>
Ehm... There are really many errors in the unittest
|
Add 'k_thread_runtime_stats_is_enabled' to 'usage.c', which's used to check whether runtime statistics collection is enabled for a thread.
It can determine whether the thread has enabled runtime statistics collection when the program is running. It allows users to add conditional statements based on this function when using it.
for example:
And it can provide a complete support when similar operations are needed. for example
enable
,disable
,is_enabled
.For example, its use in the implementation of CLOCK_THREAD_CPUTIME_ID actually lacks k_thread_runtime_stats_is_enabled, which makes the entire function impossible to implement safely. It is necessary.